public void Phase_OfPushedChangeset_ChangesToPublic() { if (ClientExecutable.CurrentVersion < new Version(2, 1)) { Assert.Inconclusive("The phase command is not present in this Mercurial version"); } Repo1.Init(); File.WriteAllText(Path.Combine(Repo1.Path, "test1.txt"), "dummy content"); Repo1.AddRemove(); Repo1.Commit("Test"); Repo2.Init(); Repo1.Push(Repo2.Path); ChangesetPhase[] phases = null; try { phases = Repo1.Phase("0").ToArray(); } catch (Exception ex) { Console.WriteLine(ex); } CollectionAssert.AreEqual(new[] { new ChangesetPhase(0, Phases.Public), }, phases); }
public void Pull_TwoChangesets_InvokesIncomingHookOnce() { if (IsUsingPersistentClient) { Assert.Inconclusive("Hook tests does not function correctly under the persistent client"); return; } Repo1.Init(); Repo2.Clone(Repo1.Path); WriteTextFileAndCommit(Repo1, "test.txt", "dummy1", "dummy1", true); WriteTextFileAndCommit(Repo1, "test.txt", "dummy2", "dummy2", true); Repo2.SetHook("changegroup"); var command = new CustomCommand("pull") .WithAdditionalArgument(string.Format(CultureInfo.InvariantCulture, "\"{0}\"", Repo1.Path)); Repo2.Execute(command); Assert.That(command.RawExitCode, Is.EqualTo(0)); Assert.That(command.RawStandardOutput.Count("Revision:"), Is.EqualTo(1)); Assert.That(command.RawStandardOutput.Count("Url:"), Is.EqualTo(1)); Assert.That(command.RawStandardOutput.Count("Source:"), Is.EqualTo(1)); }
public void Outgoing_CloneOfMasterWithNoExtraChanges_ReturnsEmptyCollection() { Repo1.Init(); Repo2.Clone(Repo1.Path); Changeset[] outgoing = Repo2.Outgoing().ToArray(); Assert.That(outgoing.Length, Is.EqualTo(0)); }
public void Bundle_UnrelatedDestinationRepository_ThrowsMercurialExecutionException() { Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Init(); WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", "dummy", true); Assert.Throws <MercurialExecutionException>(() => Repo1.Bundle(GetTempFileName(), Repo2.Path)); }
public void Unbundle_NoRepository_ThrowsMercurialExecutionException() { string bundleFileName = GetTempFileName(); Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo1.Bundle(bundleFileName, new BundleCommand().WithAll()); Assert.Throws <MercurialExecutionException>(() => Repo2.Unbundle(bundleFileName)); }
public void Outgoing_UnrelatedRepositoryWithoutForce_ThrowsMercurialExecutionException() { Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Init(); WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", "dummy", true); Assert.Throws <MercurialExecutionException>(() => Repo2.Outgoing(Repo1.Path)); }
public void Phase_OfNonExistantChangeset_ThrowsMercurialExecutionException() { if (ClientExecutable.CurrentVersion < new Version(2, 1)) { Assert.Inconclusive("The phase command is not present in this Mercurial version"); } Repo1.Init(); Assert.Throws <MercurialExecutionException>(() => Repo1.Phase("600").ToArray()); }
public void Outgoing_CloneOfMasterWithExtraChanges_ReturnsTheExtraChangesets() { const string commitMessage = "commit message in clone"; Repo1.Init(); Repo2.Clone(Repo1.Path); WriteTextFileAndCommit(Repo2, "test.txt", "dummy", commitMessage, true); Changeset[] outgoing = Repo2.Outgoing().ToArray(); Assert.That(outgoing.Length, Is.EqualTo(1)); Assert.That(outgoing[0].CommitMessage, Is.EqualTo(commitMessage)); }
public void Bundle_PulledIntoEmptyRepository_ProducesCloneOfSource() { string bundleFileName = GetTempFileName(); Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Init(); Repo1.Bundle(bundleFileName, Repo2.Path); Repo2.Pull(bundleFileName); CollectionAssert.AreEqual(Repo1.Log(new LogCommand().WithIncludePathActions()), Repo2.Log(new LogCommand().WithIncludePathActions())); }
public void Outgoing_UnrelatedRepositoryWithForce_ReturnsCollectionOfChangesets() { const string commitMessage = "commit message in clone"; Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Init(); WriteTextFileAndCommit(Repo2, "test2.txt", "dummy", commitMessage, true); Changeset[] outgoing = Repo2.Outgoing(Repo1.Path, new OutgoingCommand().WithForce()).ToArray(); Assert.That(outgoing.Length, Is.EqualTo(1)); Assert.That(outgoing[0].CommitMessage, Is.EqualTo(commitMessage)); }
public void Incoming_SavingTheBundle_AllowsPullFromBundle() { string bundleFileName = Path.GetTempFileName(); Repo1.Init(); Repo2.Clone(Repo1.Path); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Incoming(new IncomingCommand().WithBundleFileName(bundleFileName)); Changeset[] log = Repo2.Log().ToArray(); Assert.That(log.Length, Is.EqualTo(0)); Repo2.Pull(bundleFileName); log = Repo2.Log().ToArray(); Assert.That(log.Length, Is.EqualTo(1)); }
public void Pull_OneChangeset_InvokesIncomingHookOnce() { Repo1.Init(); Repo2.Clone(Repo1.Path); WriteTextFileAndCommit(Repo1, "test.txt", "dummy", "dummy", true); Repo2.SetHook("incoming"); var command = new CustomCommand("pull") .WithAdditionalArgument(string.Format(CultureInfo.InvariantCulture, "\"{0}\"", Repo1.Path)); Repo2.Execute(command); Assert.That(command.RawExitCode, Is.EqualTo(0)); Assert.That(command.RawStandardOutput.Count("Revision:"), Is.EqualTo(1)); Assert.That(command.RawStandardOutput.Count("Url:"), Is.EqualTo(1)); Assert.That(command.RawStandardOutput.Count("Source:"), Is.EqualTo(1)); }
public void Bundle_DestinationIsACompleteClone_ThrowsNoChangesFoundMercurialExecutionExceptionAndLeavesFileAsIs() { string bundleFileName = GetTempFileName(); Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Clone(Repo1.Path); Assert.Throws <NoChangesFoundMercurialExecutionException>(() => Repo1.Bundle(bundleFileName, Repo2.Path)); long length; using (var stream = new FileStream(bundleFileName, FileMode.Open)) { length = stream.Length; } Assert.That(length, Is.EqualTo(0)); }
public void Bundle_DestinationIsEmpty_ProducesBundleFile() { string bundleFileName = GetTempFileName(); Repo1.Init(); WriteTextFileAndCommit(Repo1, "test1.txt", "dummy", "dummy", true); Repo2.Init(); Repo1.Bundle(bundleFileName, Repo2.Path); long length; using (var stream = new FileStream(bundleFileName, FileMode.Open)) { length = stream.Length; } Assert.That(length, Is.GreaterThan(0)); }
public void Unbundle_NullOrEmptyFileName_ThrowsArgumentNullException(string input) { Repo1.Init(); Assert.Throws <ArgumentNullException>(() => Repo1.Unbundle(input)); }
public void Unbundle_InvalidFile_ThrowsMercurialExecutionException() { Repo1.Init(); Assert.Throws <MercurialExecutionException>(() => Repo1.Unbundle(GetTempFileName())); }
public override void SetUp() { base.SetUp(); Repo1.Init(); Repo2.Init(); }