public override bool Run(string[] args) { Console.WriteLine(""); Console.WriteLine("Identifying branch..."); Console.WriteLine(""); var nodeBranch = CurrentNode.Properties["Branch"]; var identifier = new GitBranchIdentifier(); var branch = identifier.Identify(); Console.WriteLine("Branch: " + branch); if (nodeBranch != branch) { CurrentNode.Properties["Branch"] = branch; CurrentNode.Save(); Console.WriteLine("Updated branch in file node properties."); } else { Console.WriteLine("The branch name specified in the file node properties matches the current branch. Keeping as is."); } return(!IsError); }
public void Test_Identify() { var branchName = "TestBranch"; var initializer = new TestSourceProjectInitializer(OriginalDirectory, WorkingDirectory); initializer.CloneSource = true; initializer.Initialize(); var gitter = new Gitter(); gitter.Branch(branchName, true); // Create a new test branch and move to it gitter.Branch("zz"); // Create a branch at the end of the list var identifier = new GitBranchIdentifier(); var identifiedBranch = identifier.Identify(); Assert.AreEqual(branchName, identifiedBranch, "Branch doesn't match."); }
public override bool Run(string[] args) { new FilesGrabber( OriginalDirectory, CurrentDirectory ).GrabOriginalFiles(); var branch = new GitBranchIdentifier().Identify(); var gitter = new Gitter(); var testBranchName = "TestBranch"; // Create a new branch and check it out gitter.Branch(testBranchName, true); var testFileName = Path.GetFullPath("test.txt"); File.WriteAllText(testFileName, "Test content"); gitter.Add(testFileName); gitter.Commit("Added test file"); // Increment the version so the .node files conflict ExecuteScript("IncrementVersion", "3"); // Commit the version related files ExecuteScript("CommitVersion"); // Checkout the original branch gitter.Checkout(branch); // Run the MergeBranch script ExecuteScript("MergeBranch", testBranchName); ExecuteScript("HelloWorld"); return(!IsError); }