Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit bc6fe41

Browse files
committed
<p4> source control block modifications (Feature #239)
1 parent 3d75efb commit bc6fe41

File tree

2 files changed

+58
-31
lines changed
  • project
    • UnitTests/Core/SourceControl/Perforce
    • core/sourcecontrol/Perforce

2 files changed

+58
-31
lines changed

project/UnitTests/Core/SourceControl/Perforce/P4Test.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -429,38 +429,38 @@ public void DontLabelSourceControlIfApplyLabelNotSetEvenIfInvalidLabel()
429429
VerifyAll();
430430
}
431431

432-
[Test]
433-
public void GetSourceIfGetSourceTrue()
434-
{
435-
P4 p4 = CreateP4();
436-
p4.View = "//depot/myproject/...";
437-
p4.AutoGetSource = true;
432+
[Test]
433+
public void GetSourceIfGetSourceTrue()
434+
{
435+
P4 p4 = CreateP4();
436+
p4.View = "//depot/myproject/...";
437+
p4.AutoGetSource = true;
438438

439439
DateTime modificationsToDate = new DateTime(2002, 10, 31, 5, 5, 0);
440-
ProcessInfo processInfo = new ProcessInfo("getSource");
441-
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "sync @2002/10/31:05:05:00");
442-
mockProcessExecutor.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);
440+
ProcessInfo processInfo = new ProcessInfo("getSource");
441+
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "sync //depot/myproject/...@2002/10/31:05:05:00");
442+
mockProcessExecutor.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);
443443
p4.GetSource(IntegrationResultMother.CreateSuccessful(modificationsToDate));
444444

445-
VerifyAll();
446-
}
445+
VerifyAll();
446+
}
447447

448-
[Test]
449-
public void GetForceSourceIfGetSourceTrue()
450-
{
451-
P4 p4 = CreateP4();
452-
p4.View = "//depot/myproject/...";
453-
p4.AutoGetSource = true;
454-
p4.ForceSync = true;
448+
[Test]
449+
public void GetForceSourceIfGetSourceTrue()
450+
{
451+
P4 p4 = CreateP4();
452+
p4.View = "//depot/myproject/...";
453+
p4.AutoGetSource = true;
454+
p4.ForceSync = true;
455455

456456
DateTime modificationsToDate = new DateTime(2002, 10, 31, 5, 5, 0);
457-
ProcessInfo processInfo = new ProcessInfo("getSource");
458-
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "sync -f @2002/10/31:05:05:00");
459-
mockProcessExecutor.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);
457+
ProcessInfo processInfo = new ProcessInfo("getSource");
458+
processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "sync -f //depot/myproject/...@2002/10/31:05:05:00");
459+
mockProcessExecutor.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo);
460460
p4.GetSource(IntegrationResultMother.CreateSuccessful(modificationsToDate));
461461

462-
VerifyAll();
463-
}
462+
VerifyAll();
463+
}
464464

465465
[Test]
466466
public void DontGetSourceIfGetSourceFalse()

project/core/sourcecontrol/Perforce/P4.cs

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,30 @@ private void InitialiseDefaults()
172172
[ReflectorProperty("port", Required = false)]
173173
public string Port { get; set; }
174174

175+
/// <summary>
176+
/// The perforce character set to use.
177+
/// </summary>
178+
/// <version>1.8</version>
179+
/// <default>Performance environment setting</default>
180+
[ReflectorProperty("charset", Required = false)]
181+
public string CharSet { get; set; }
182+
183+
/// <summary>
184+
/// The perforce command character set to use.
185+
/// </summary>
186+
/// <version>1.8</version>
187+
/// <default>Performance environment setting</default>
188+
[ReflectorProperty("commandcharset", Required = false)]
189+
public string CommandCharSet { get; set; }
190+
191+
/// <summary>
192+
/// Encoding Code page to use for communicating with perforce
193+
/// </summary>
194+
/// <version>1.8</version>
195+
/// <default>CurrentEmpty String, will default to an encoding for the operating system's current ANSI code page.</default>
196+
[ReflectorProperty("codepage", Required = false)]
197+
public int CodePage { get; set; }
198+
175199
/// <summary>
176200
/// The working directory to use.
177201
/// </summary>
@@ -509,15 +533,18 @@ public override void GetSource(IIntegrationResult result)
509533

510534
private string CreateSyncCommandLine(DateTime modificationsToDate)
511535
{
512-
string commandline = "sync";
513-
if (ForceSync)
514-
{
515-
commandline += " -f";
516-
}
536+
StringBuilder commandline = new StringBuilder("sync");
537+
if (ForceSync)
538+
{
539+
commandline.Append(" -f");
540+
}
517541

518-
commandline += " @" + FormatDate(modificationsToDate);
542+
foreach (string viewline in View.Split(','))
543+
{
544+
commandline.Append(' ').Append(viewline).Append('@').Append(FormatDate(modificationsToDate));
545+
}
519546

520-
return commandline;
547+
return commandline.ToString();
521548
}
522549

523550
/// <summary>
@@ -595,4 +622,4 @@ private void FillIssueUrl(Modification[] modifications)
595622
}
596623
}
597624
}
598-
}
625+
}

0 commit comments

Comments
 (0)