Ejemplo n.º 1
0
        public void Pull_FromOtherWithRevisionSpecification_OnlyPullsInRelevantChanges()
        {
            WriteTextFileAndCommit(Repo1, "test1.txt", "initial contents", "initial commit", true);
            WriteTextFileAndCommit(Repo1, "test1.txt", "changed contents", "2nd commit", false);
            WriteTextFileAndCommit(Repo1, "test1.txt", "changed contents again", "3rd commit", false);

            Repo2.Pull(
                Repo1.Path, new PullCommand
            {
                Revisions =
                {
                    RevSpec.Single(1),
                },
            });

            Changeset[] pulledChangesets   = Repo2.Log().OrderBy(c => c.RevisionNumber).ToArray();
            Changeset[] originalChangesets = Repo1.Log(
                new LogCommand
            {
                Revisions =
                {
                    RevSpec.Range(0, 1),
                },
            }).OrderBy(c => c.RevisionNumber).ToArray();
            CollectionAssert.AreEqual(pulledChangesets, originalChangesets);
        }
Ejemplo n.º 2
0
        public void Pull_FromOther_PullsInAllChanges()
        {
            WriteTextFileAndCommit(Repo1, "test1.txt", "initial contents", "initial commit", true);
            WriteTextFileAndCommit(Repo1, "test1.txt", "changed contents", "2nd commit", false);

            Repo2.Pull(Repo1.Path);

            CollectionAssert.AreEqual(Repo2.Log(), Repo1.Log());
        }
Ejemplo n.º 3
0
        public void Pull_ForceIntoUnrelatedNonEmptyRepository_PerformsPull()
        {
            WriteTextFileAndCommit(Repo1, "test1.txt", "initial contents", "initial commit", true);
            WriteTextFileAndCommit(Repo2, "test2.txt", "initial contents", "initial commit", true);

            Repo2.Pull(
                Repo1.Path, new PullCommand
            {
                Force = true,
            });

            Assert.That(Repo2.Log().Count(), Is.EqualTo(2));
        }
Ejemplo n.º 4
0
        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));
        }
Ejemplo n.º 5
0
        public void Pull_Branch_OnlyPullsThatBranch()
        {
            WriteTextFileAndCommit(Repo1, "test1.txt", "initial contents", "initial commit", true);
            Repo2.Pull(Repo1.Path);

            Repo1.Branch("newbranch");
            WriteTextFileAndCommit(Repo1, "test2.txt", "initial contents", "2nd commit", true);
            Repo1.Update(0);
            WriteTextFileAndCommit(Repo1, "test3.txt", "initial contents", "3rd commit", true);

            Changeset[] log = Repo2.Log().ToArray();
            Assert.That(log.Length, Is.EqualTo(1));

            Repo2.Pull(
                Repo1.Path, new PullCommand
            {
                Branches =
                {
                    "newbranch",
                },
            });
            log = Repo2.Log().ToArray();
            Assert.That(log.Length, Is.EqualTo(2));
        }
Ejemplo n.º 6
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()));
        }