Beispiel #1
0
        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);
        }
Beispiel #2
0
        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));
        }
Beispiel #3
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));
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        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()));
        }
Beispiel #6
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));
        }
Beispiel #7
0
 public void Outgoing_RepositoryWithNoDefaultDestination_ThrowsMercurialExecutionException()
 {
     Repo2.Init();
     Assert.Throws <MercurialExecutionException>(() => Repo2.Outgoing());
 }
Beispiel #8
0
 public override void SetUp()
 {
     base.SetUp();
     Repo1.Init();
     Repo2.Init();
 }