public void ShouldCallInitializerWithConfiguredWorkingDirectoryIfAlternativeIsConfigured() { // Setup P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.WorkingDirectory = "p4sOwnWorkingDirectory"; p4InitializerMock.Setup(initializer => initializer.Initialize(p4, "myProject", "p4sOwnWorkingDirectory")).Verifiable(); projectMock.SetupGet(_project => _project.Name).Returns("myProject").Verifiable(); // Execute p4.Initialize(project); // Verify VerifyAll(); projectMock.VerifyNoOtherCalls(); }
static Patcher CreatePatcher(Options opts) { var patcher = new Patcher(opts.WorkingPath); if (opts.P4Edit) { var p4 = new P4(opts.WorkingPath); patcher.BeforeApplyingPatches += (filepaths) => { foreach (var f in filepaths) { p4.Edit(f); } }; } return(patcher); }
public void GetForceSourceIfGetSourceTrue() { P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.AutoGetSource = true; p4.ForceSync = true; DateTime modificationsToDate = new DateTime(2002, 10, 31, 5, 5, 0); ProcessInfo processInfo = new ProcessInfo("getSource"); processInfoCreatorMock.Setup(creator => creator.CreateProcessInfo(p4, "sync -f //depot/myproject/...@2002/10/31:05:05:00")).Returns(processInfo).Verifiable(); mockProcessExecutor.Setup(executor => executor.Execute(processInfo)).Returns(new ProcessResult("", "", 0, false)).Verifiable(); p4.GetSource(IntegrationResultMother.CreateSuccessful(modificationsToDate)); VerifyAll(); }
public void ShouldCallInitializerWithGivenWorkingDirectoryIfAlternativeSetToEmpty() { // Setup P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.WorkingDirectory = ""; p4InitializerMock.Setup(initializer => initializer.Initialize(p4, "myProject", "workingDirFromProject")).Verifiable(); projectMock.SetupGet(_project => _project.Name).Returns("myProject").Verifiable(); projectMock.SetupGet(_project => _project.WorkingDirectory).Returns("workingDirFromProject").Verifiable(); // Execute p4.Initialize(project); // Verify VerifyAll(); }
public void LabelSourceControlFailsIfLabelIsOnlyNumeric() { P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.ApplyLabel = true; try { p4.LabelSourceControl(IntegrationResultMother.CreateSuccessful("123")); Assert.Fail("Perforce labelling should fail if a purely numeric label is attempted to be applied"); } catch (CruiseControlException) {} VerifyAll(); }
public void CreateGetChangeListsProcessInDifferentTimeZone() { P4 p4 = new P4(); p4.View = "//depot/myproj/..."; DateTime from = new DateTime(2002, 10, 20, 2, 0, 0); DateTime to = new DateTime(2002, 10, 31, 5, 5, 0); p4.TimeZoneOffset = -4.5; ProcessInfo process = p4.CreateChangeListProcess(from, to); string expectedArgs = "-s changes -s submitted //depot/myproj/...@2002/10/19:21:30:00,@2002/10/31:00:35:00"; Assert.AreEqual("p4", process.FileName); Assert.AreEqual(expectedArgs, process.Arguments); }
public void Init(P4.Repository rep) { if (rep == null) { mDepotTreeView.Enabled = false; return; } // Initialize the depot tree view P4.P4Directory root = new P4.P4Directory(rep, null, "depot", "//depot", null, null); TreeNode rootNode = new TreeNode("Depot"); rootNode.Tag = root; rootNode.ImageIndex = 0; rootNode.SelectedImageIndex = 0; rootNode.Nodes.Add(new TreeNode("empty")); mDepotTreeView.Nodes.Clear(); mDepotTreeView.Nodes.Add(rootNode); }
public void GetForceSourceIfGetSourceTrue() { P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.AutoGetSource = true; p4.ForceSync = true; DateTime modificationsToDate = new DateTime(2002, 10, 31, 5, 5, 0); ProcessInfo processInfo = new ProcessInfo("getSource"); processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "sync -f @2002/10/31:05:05:00"); mockProcessExecutor.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo); p4.GetSource(IntegrationResultMother.CreateSuccessful(modificationsToDate)); VerifyAll(); }
public void ShouldCallInitializerWithGivenWorkingDirectoryIfAlternativeSetToEmpty() { // Setup P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.WorkingDirectory = ""; p4InitializerMock.Expect("Initialize", p4, "myProject", "workingDirFromProject"); projectMock.ExpectAndReturn("Name", "myProject"); projectMock.ExpectAndReturn("WorkingDirectory", "workingDirFromProject"); // Execute p4.Initialize(project); // Verify VerifyAll(); }
public void ShouldCallInitializerWithConfiguredWorkingDirectoryIfAlternativeIsConfigured() { // Setup P4 p4 = CreateP4(); p4.View = "//depot/myproject/..."; p4.WorkingDirectory = "p4sOwnWorkingDirectory"; p4InitializerMock.Expect("Initialize", p4, "myProject", "p4sOwnWorkingDirectory"); projectMock.ExpectAndReturn("Name", "myProject"); projectMock.ExpectNoCall("WorkingDirectory"); // Execute p4.Initialize(project); // Verify VerifyAll(); }
public void ShouldNotTryAndDeleteClientSpecIfClientSpecNotSet() { // Setup P4 p4 = new P4(); p4.Client = null; Assert.IsTrue(Directory.Exists(tempDirPath)); // Execute p4Purger.Purge(p4, tempDirPath); // Verify Assert.IsFalse(Directory.Exists(tempDirPath)); VerifyAll(); processInfoCreatorMock.VerifyNoOtherCalls(); processExecutorMock.VerifyNoOtherCalls(); }
public override int GetHashCode() { var hashCode = 2018318558; hashCode = hashCode * -1521134295 + T1.GetHashCode(); hashCode = hashCode * -1521134295 + T2.GetHashCode(); hashCode = hashCode * -1521134295 + T3.GetHashCode(); hashCode = hashCode * -1521134295 + T4.GetHashCode(); hashCode = hashCode * -1521134295 + T5.GetHashCode(); hashCode = hashCode * -1521134295 + P1.GetHashCode(); hashCode = hashCode * -1521134295 + P2.GetHashCode(); hashCode = hashCode * -1521134295 + P3.GetHashCode(); hashCode = hashCode * -1521134295 + P4.GetHashCode(); hashCode = hashCode * -1521134295 + P5.GetHashCode(); hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode(); hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode(); return(hashCode); }
public void ReadConfigDefaults() { string xml = @" <sourceControl name=""p4""> <view>//depot/anotherproject/...</view> </sourceControl> "; P4 p4 = CreateP4WithNoArgContructor(xml); Assert.AreEqual("p4", p4.Executable); Assert.AreEqual("//depot/anotherproject/...", p4.View); Assert.AreEqual("", p4.Client); Assert.AreEqual("", p4.User); Assert.AreEqual("", p4.Password); Assert.AreEqual("", p4.Port); Assert.AreEqual(false, p4.UseExitCode); Assert.AreEqual(@"^error: .*", p4.ErrorPattern); Assert.AreEqual(@"file\(s\) up-to-date\.", p4.AcceptableErrors[0]); }
public override int GetHashCode() { var hashCode = -1044093539; hashCode = hashCode * -1521134295 + T1.GetHashCode(); hashCode = hashCode * -1521134295 + T2.GetHashCode(); hashCode = hashCode * -1521134295 + T3.GetHashCode(); hashCode = hashCode * -1521134295 + T4.GetHashCode(); hashCode = hashCode * -1521134295 + T5.GetHashCode(); hashCode = hashCode * -1521134295 + P1.GetHashCode(); hashCode = hashCode * -1521134295 + P2.GetHashCode(); hashCode = hashCode * -1521134295 + P3.GetHashCode(); hashCode = hashCode * -1521134295 + P4.GetHashCode(); hashCode = hashCode * -1521134295 + P5.GetHashCode(); hashCode = hashCode * -1521134295 + JunctionIndex.GetHashCode(); hashCode = hashCode * -1521134295 + NearestJunctionIndex.GetHashCode(); hashCode = hashCode * -1521134295 + Length.GetHashCode(); hashCode = hashCode * -1521134295 + Lock.GetHashCode(); return(hashCode); }
private void CheckOutMaps(ProjectParams Params) { Log("Running Step:- RebuildLightMaps::CheckOutMaps"); // Setup a P4 Cl we will use to submit the new lightmaps WorkingCL = P4.CreateChange(P4Env.Client, String.Format("{0} rebuilding lightmaps from changelist {1}", Params.ShortProjectName, P4Env.Changelist)); Log("Working in {0}", WorkingCL); string AllMapsWildcardCmdline = String.Format("{0}\\...\\*.umap", Params.RawProjectPath.Directory); string Output = ""; P4.P4Output(out Output, String.Format("edit -c {0} {1}", WorkingCL, AllMapsWildcardCmdline)); // We need to ensure that any error in the output log is observed. // P4 is still successful if it manages to run the operation. if (FoundCheckOutErrorInP4Output(Output) == true) { LogError("Failed to check out every one of the project maps."); throw new AutomationException("Failed to check out every one of the project maps."); } }
/** * Cleanup anything this build may leave behind and inform the user */ private void HandleFailure(String FailureMessage) { try { if (WorkingCL != -1) { P4.RevertAll(WorkingCL); P4.DeleteChange(WorkingCL); } SendCompletionMessage(false, FailureMessage); } catch (P4Exception P4Ex) { LogError("Failed to clean up P4 changelist: " + P4Ex.Message); } catch (Exception SendMailEx) { LogError("Failed to notify that build succeeded: " + SendMailEx.Message); } }
public void ShouldNotTryAndDeleteClientSpecIfClientSpecNotSet() { // Setup DynamicMock p4Mock = new DynamicMock(typeof(P4)); P4 p4 = (P4)p4Mock.MockInstance; p4.Client = null; processInfoCreatorMock.ExpectNoCall("CreateProcessInfo", typeof(P4), typeof(string)); processExecutorMock.ExpectNoCall("Execute", typeof(ProcessInfo)); Assert.IsTrue(Directory.Exists(tempDirPath)); // Execute p4Purger.Purge(p4, tempDirPath); // Verify Assert.IsFalse(Directory.Exists(tempDirPath)); VerifyAll(); }
public void ShouldDeleteClientSpecAndWorkingDirectoryOnPurge() { // Setup P4 p4 = new P4(); p4.Client = "myClient"; ProcessInfo processInfo = new ProcessInfo("deleteclient"); processInfoCreatorMock.Setup(creator => creator.CreateProcessInfo(p4, "client -d myClient")).Returns(processInfo).Verifiable(); processExecutorMock.Setup(executor => executor.Execute(processInfo)).Returns(new ProcessResult("", "", 0, false)).Verifiable(); Assert.IsTrue(Directory.Exists(tempDirPath)); // Execute p4Purger.Purge(p4, tempDirPath); // Verify Assert.IsFalse(Directory.Exists(tempDirPath)); VerifyAll(); }
public override void ExecuteBuild() { var Preview = ParseParam("preview"); var ArtistSync = ParseParam("artist"); var BranchPath = CommandUtils.GetDirectoryName(P4Env.BuildRootP4); var LabelParam = ParseParamValue("label"); var GameName = ParseParamValue("game"); if (GameName == null) { GameName = ""; } string ProgramSyncLabelName = null; if (!string.IsNullOrWhiteSpace(LabelParam)) { if (!LabelParam.StartsWith(BranchPath) || !P4.ValidateLabelContent(LabelParam)) { throw new AutomationException("Label {0} either doesn't exist or is not valid for the current branch path {1}.", LabelParam, BranchPath); } ProgramSyncLabelName = LabelParam; } else { ProgramSyncLabelName = GetLatestPromotedLabel(BranchPath, GameName, true); } if (ProgramSyncLabelName == null) { throw new AutomationException("Label for {0} was not found.", string.IsNullOrWhiteSpace(GameName) ? string.Format("branch {0} shared-promotable", BranchPath) : string.Format("branch {0} and game {1}", BranchPath, GameName)); } SyncToLabel(BranchPath, ProgramSyncLabelName, ArtistSync, Preview); }
public void CreatesAClientWithGivenClientNameIfSpecified() { // Setup P4 p4 = new P4(); p4.Client = "myClient"; p4.View = "//mydepot/...,//myotherdepot/..."; ProcessInfo processInfo = new ProcessInfo("createclient"); ProcessInfo processInfoWithStdInContent = new ProcessInfo("createclient"); processInfoWithStdInContent.StandardInputContent = "Client: myClient\n\nRoot: " + path + "\n\nView:\n //mydepot/... //myClient/mydepot/...\n //myotherdepot/... //myClient/myotherdepot/...\n"; processInfoCreatorMock.Setup(creator => creator.CreateProcessInfo(p4, "client -i")).Returns(processInfo).Verifiable(); processExecutorMock.Setup(executor => executor.Execute(processInfoWithStdInContent)).Returns(new ProcessResult("", "", 0, false)).Verifiable(); // Execute p4Initializer.Initialize(p4, "myProject", path); // Verify VerifyAll(); }
public int CompareTo(object obj) { IP comp = (IP)obj; int result = P1.CompareTo(comp.P1); if (result != 0) { return(result); } result = P2.CompareTo(comp.P2); if (result != 0) { return(result); } result = P3.CompareTo(comp.P3); if (result != 0) { return(result); } result = P4.CompareTo(comp.P4); return(result); }
public void ShouldDeleteClientSpecAndWorkingDirectoryOnPurge() { // Setup DynamicMock p4Mock = new DynamicMock(typeof(P4)); P4 p4 = (P4)p4Mock.MockInstance; p4.Client = "myClient"; ProcessInfo processInfo = new ProcessInfo("deleteclient"); processInfoCreatorMock.ExpectAndReturn("CreateProcessInfo", processInfo, p4, "client -d myClient"); processExecutorMock.ExpectAndReturn("Execute", new ProcessResult("", "", 0, false), processInfo); Assert.IsTrue(Directory.Exists(tempDirPath)); // Execute p4Purger.Purge(p4, tempDirPath); // Verify Assert.IsFalse(Directory.Exists(tempDirPath)); VerifyAll(); }
/// <summary> /// allocate correct pool type and add it to types /// </summary> internal static AbstractStoragePool newPool(string name, AbstractStoragePool superPool, List <AbstractStoragePool> types) { try { switch (name) { case "testenum": return(superPool = new P0(types.Count)); case "testenum:default": return(superPool = new P1(types.Count, (P0)superPool)); case "testenum:second": return(superPool = new P2(types.Count, (P0)superPool)); case "testenum:third": return(superPool = new P3(types.Count, (P0)superPool)); case "testenum:last": return(superPool = new P4(types.Count, (P0)superPool)); default: if (null == superPool) { return(superPool = new BasePool <SkillObject>(types.Count, name, AbstractStoragePool.noKnownFields, AbstractStoragePool.NoAutoFields)); } else { return(superPool = superPool.makeSubPool(types.Count, name)); } } } finally { types.Add(superPool); } }
/// <summary> /// allocate correct pool type and add it to types /// </summary> internal static AbstractStoragePool newPool(string name, AbstractStoragePool superPool, List <AbstractStoragePool> types) { try { switch (name) { case "a": return(superPool = new P0(types.Count)); case "b": return(superPool = new P1(types.Count, (P0)superPool)); case "c": return(superPool = new P2(types.Count, (P1)superPool)); case "d": return(superPool = new P3(types.Count, (P1)superPool)); case "noserializeddata": return(superPool = new P4(types.Count)); default: if (null == superPool) { return(superPool = new BasePool <SkillObject>(types.Count, name, AbstractStoragePool.noKnownFields, AbstractStoragePool.NoAutoFields)); } else { return(superPool = superPool.makeSubPool(types.Count, name)); } } } finally { types.Add(superPool); } }
protected override void Check() { _x = 2; P1.ShouldBe(4); P3.ShouldBe(1); _x = 10; P1.ShouldBe(20); P3.ShouldBe(5); P2.ShouldBe(77); var c1 = new C(7); c1.P.ShouldBe(7); var c2 = new C(77); c2.P.ShouldBe(77); P4 = 9; P4.ShouldBe(9); P4 = 11; P4.ShouldBe(11); P5 = 13; _x.ShouldBe(13); P5 = 131; _x.ShouldBe(131); P6 = 16; P6.ShouldBe(16); P6 = 8; P6.ShouldBe(8); }
static void Drawing_OnEndScene(EventArgs args) { if (P1.X != 0) { Utility.DrawCircle(P1.To3D(), 100, Color.Red); } if (P2.X != 0) { Utility.DrawCircle(P2.To3D(), 100, Color.Red); } if (P3.X != 0) { Utility.DrawCircle(P3.To3D(), 100, Color.Red); } if (P4.X != 0) { Utility.DrawCircle(P4.To3D(), 100, Color.Red); } if (P5.X != 0) { Utility.DrawCircle(P5.To3D(), 100, Color.Red); } }
public void CreateGetDescribeProcessWithSpecifiedArgs() { string xml = @" <sourceControl name=""p4""> <executable>c:\bin\p4.exe</executable> <view>//depot/myproject/...</view> <client>myclient</client> <user>me</user> <password>mypassword</password> <port>anotherserver:2666</port> </sourceControl> "; string changes = "3327 3328 332"; string expectedArgs = "-s -c myclient -p anotherserver:2666 -u me -P mypassword" + " describe -s " + changes; P4 p4 = CreateP4WithNoArgContructor(xml); ProcessInfo process = p4.CreateDescribeProcess(changes); Assert.AreEqual("c:\\bin\\p4.exe", process.FileName); Assert.AreEqual(expectedArgs, process.Arguments); }
void OnCollisionStay(Collision collisionInfo) { if (collisionInfo.gameObject.tag == "Player") { //instructions for interact fireText.gameObject.SetActive(true); //turns off if (Input.GetKey(KeyCode.E)) { this.gameObject.SetActive(false); fireText.gameObject.SetActive(false); //gross but can't think of a better way right now //activates lit up platforms P1.SetActive(true); P2.SetActive(true); P3.SetActive(true); P4.SetActive(true); P5.SetActive(true); P6.SetActive(true); } } }
protected void DoBuildCookRun(ProjectParams Params) { const ProjectBuildTargets ClientTargets = ProjectBuildTargets.ClientCooked | ProjectBuildTargets.ServerCooked; bool bGenerateNativeScripts = Params.RunAssetNativization; int WorkingCL = -1; if (P4Enabled && GlobalCommandLine.Submit && AllowSubmit) { WorkingCL = P4.CreateChange(P4Env.Client, String.Format("{0} build from changelist {1}", Params.ShortProjectName, P4Env.Changelist)); } Project.Build(this, Params, WorkingCL, bGenerateNativeScripts ? (ProjectBuildTargets.All & ~ClientTargets) : ProjectBuildTargets.All); Project.Cook(Params); if (bGenerateNativeScripts) { // crash reporter is built along with client targets, so we need to // include that target flag here as well - note: that its not folded // into ClientTargets because the editor needs its own CrashReporter // as well (which would be built above) Project.Build(this, Params, WorkingCL, ClientTargets | ProjectBuildTargets.CrashReporter); } Project.CopyBuildToStagingDirectory(Params); Project.Package(Params, WorkingCL); Project.Archive(Params); Project.Deploy(Params); PrintRunTime(); Project.Run(Params); Project.GetFile(Params); // Check everything in! if (WorkingCL != -1) { int SubmittedCL; P4.Submit(WorkingCL, out SubmittedCL, true, true); } }
/// <summary> /// Syncs to given label. /// </summary> /// <param name="BranchPath">Current branch path.</param> /// <param name="LabelName">Label name to sync.</param> /// <param name="bArtistSync">Perform artist sync? (binaries to label, content to latest)</param> /// <param name="bPreview">Perform preview sync? (p4 sync -n)</param> private void SyncToLabel(string BranchPath, string LabelName, bool bArtistSync = true, bool bPreview = false) { var ProgramRevisionSpec = "@" + LabelName; List <string> SyncSteps; if (bArtistSync) { // Get latest CL number to sync cause @head can change during // different syncs and it could create integrity problems in // workspace. var ContentRevisionSpec = "@" + P4.GetLatestCLNumber().ToString(); var GameName = ParseGameNameFromLabel(LabelName); var ArtistSyncRulesPath = string.Format("{0}/{1}/Build/ArtistSyncRules.xml", BranchPath, string.IsNullOrWhiteSpace(GameName) ? "Samples" : GameName); var SyncRules = string.Join("\n", P4.P4Print(ArtistSyncRulesPath + "#head")); if (string.IsNullOrWhiteSpace(SyncRules)) { throw new AutomationException("The path {0} is not valid or file is empty.", ArtistSyncRulesPath); } SyncSteps = GenerateSyncSteps(SyncRules, ContentRevisionSpec, ProgramRevisionSpec); } else { SyncSteps = new List <string>(); SyncSteps.Add("/..." + ProgramRevisionSpec); // all files to label } foreach (var SyncStep in SyncSteps) { P4.Sync((bPreview ? "-n " : "") + BranchPath + SyncStep); } }
public void ReadConfig() { string xml = string.Format(@" <sourceControl type=""p4""> <executable>c:\bin\p4.exe</executable> <view>//depot/myproject/...</view> <client>myclient</client> <user>me</user> <password>mypassword</password> <port>anotherserver:2666</port> <workingDirectory>myWorkingDirectory</workingDirectory> <p4WebURLFormat>http://perforceWebServer:8080/@md=d&cd=//&c=3IB@/{{0}}?ac=10</p4WebURLFormat> <timeZoneOffset>{0}</timeZoneOffset> <useExitCode>true</useExitCode> <errorPattern>Error: (.*)</errorPattern> <acceptableErrors> <acceptableError>(.*)\.accept1</acceptableError> <acceptableError>(.*)\.accept2</acceptableError> </acceptableErrors> </sourceControl> ", -5.5); P4 p4 = CreateP4WithNoArgContructor(xml); Assert.AreEqual(@"c:\bin\p4.exe", p4.Executable); Assert.AreEqual("//depot/myproject/...", p4.View); Assert.AreEqual("myclient", p4.Client); Assert.AreEqual("me", p4.User); Assert.AreEqual("mypassword", p4.Password); Assert.AreEqual("anotherserver:2666", p4.Port); Assert.AreEqual("myWorkingDirectory", p4.WorkingDirectory); Assert.AreEqual("http://*****:*****@md=d&cd=//&c=3IB@/{0}?ac=10", p4.P4WebURLFormat); Assert.AreEqual(-5.5, p4.TimeZoneOffset); Assert.AreEqual(true, p4.UseExitCode); Assert.AreEqual("Error: (.*)", p4.ErrorPattern); Assert.AreEqual(@"(.*)\.accept1", p4.AcceptableErrors[0]); Assert.AreEqual(@"(.*)\.accept2", p4.AcceptableErrors[1]); }
public DepotPathDlg(P4.Repository rep) { InitializeComponent(); Init(rep); }