예제 #1
0
        public void BackoutHead_CurrentlyOnAnotherBranch_LeaveUsWhereWeWere()
        {
            /*
             * o  changeset:   3:61688974b0c3
             |  tag:         tip
             |  summary:     backout
             |
             | @  changeset:   2:79a705ba0bbd
             | |  summary:     daeao4yo.zb2-->ok
             | |
             | o |  changeset:   1:0be0d43dd824
             |/    summary:     daeao4yo.zb2-->bad
             |
             | o  changeset:   0:534055cd5da5
             |      summary:     Add daeao4yo.zb2
             */
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                setup.ChangeAndCheckinFile(path, "bad");
                setup.AssertHeadOfWorkingDirNumber("1");
                setup.Repository.Update("0");                //go back to start a new branch
                setup.ChangeAndCheckinFile(path, "ok");
                setup.AssertHeadCount(2);

                string backoutRev = setup.Repository.BackoutHead("1", "backout");
                Assert.AreEqual("3", backoutRev);
                setup.AssertHeadCount(2);

                setup.AssertHeadOfWorkingDirNumber("2");                //expect to be left on the branch we were on, not the backed out one
                Assert.AreEqual("0", setup.Repository.GetRevisionWorkingSetIsBasedOn().Parents[0].LocalRevisionNumber);
            }
        }
예제 #2
0
        public void BackoutHead_BackingOutTheCurrentHead_LeaveUsOnTheNewHead()
        {
            /*
             * @  changeset:   2:0ced43559525
             |  tag:         tip
             |  summary:     backout
             |
             | o  changeset:   1:ddc098603f64
             |  summary:     tuetcscw.u0v-->bad
             |
             | o  changeset:   0:999cb7368d7a
             | summary:     Add tuetcscw.u0v
             */
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                setup.ChangeAndCheckinFile(path, "bad");
                setup.AssertHeadOfWorkingDirNumber("1");
                setup.AssertHeadCount(1);

                string backoutRev = setup.Repository.BackoutHead("1", "backout");
                Assert.AreEqual("2", backoutRev);
                setup.AssertHeadCount(1);

                setup.AssertHeadOfWorkingDirNumber("2");
            }
        }
예제 #3
0
        public void BackoutHead_BackingOutTheCurrentHead_LeaveUsOnTheNewHead()
        {
            /*
            @  changeset:   2:0ced43559525
            |  tag:         tip
            |  summary:     backout
            |
            o  changeset:   1:ddc098603f64
            |  summary:     tuetcscw.u0v-->bad
            |
            o  changeset:   0:999cb7368d7a
               summary:     Add tuetcscw.u0v
            */
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                setup.ChangeAndCheckinFile(path, "bad");
                setup.AssertHeadOfWorkingDirNumber("1");
                setup.AssertHeadCount(1);

                string backoutRev = setup.Repository.BackoutHead("1", "backout");
                Assert.AreEqual("2", backoutRev);
                setup.AssertHeadCount(1);

                setup.AssertHeadOfWorkingDirNumber("2");
            }
        }
예제 #4
0
 public void AddAndCheckinFiles_UserNameHasASpace_DoesnotDie()
 {
     using (var setup = new HgTestSetup())
     {
         setup.Repository.SetUserNameInIni("charlie brown", new NullProgress());
         var path = setup.Root.GetNewTempFile(true).Path;
         setup.ChangeAndCheckinFile(path, "hello");
         //setup.Repository.AddAndCheckinFiles(new List<string>(new[]{}), );
     }
 }
예제 #5
0
 public void AddAndCheckinFiles_UserNameHasASpace_DoesnotDie()
 {
     using (var setup = new HgTestSetup())
     {
         setup.Repository.SetUserNameInIni("charlie brown", new NullProgress());
         var path = setup.Root.GetNewTempFile(true).Path;
         setup.ChangeAndCheckinFile(path, "hello");
         //setup.Repository.AddAndCheckinFiles(new List<string>(new[]{}), );
     }
 }
예제 #6
0
        public void MakeBundle_ValidBase_BundleFileExistsAndReturnsTrue()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                Revision revision = setup.Repository.GetTip();
                setup.ChangeAndCheckinFile(path, "bad");

                var bundleFilePath = setup.Root.GetNewTempFile(true).Path;
                Assert.That(setup.Repository.MakeBundle(new [] { revision.Number.Hash }, bundleFilePath), Is.True);
                Assert.That(File.Exists(bundleFilePath), Is.True);
            }
        }
예제 #7
0
        public void BackoutHead_CurrentlyOnAnotherBranch_LeaveUsWhereWeWere()
        {
            /*
            o  changeset:   3:61688974b0c3
            |  tag:         tip
            |  summary:     backout
            |
            | @  changeset:   2:79a705ba0bbd
            | |  summary:     daeao4yo.zb2-->ok
            | |
            o |  changeset:   1:0be0d43dd824
            |/    summary:     daeao4yo.zb2-->bad
            |
            o  changeset:   0:534055cd5da5
                summary:     Add daeao4yo.zb2
            */
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                setup.ChangeAndCheckinFile(path, "bad");
                setup.AssertHeadOfWorkingDirNumber("1");
                setup.Repository.Update("0");//go back to start a new branch
                setup.ChangeAndCheckinFile(path, "ok");
                setup.AssertHeadCount(2);

                string backoutRev = setup.Repository.BackoutHead("1", "backout");
                Assert.AreEqual("3",backoutRev);
                setup.AssertHeadCount(2);

                setup.AssertHeadOfWorkingDirNumber("2");//expect to be left on the branch we were on, not the backed out one
                Assert.AreEqual("0", setup.Repository.GetRevisionWorkingSetIsBasedOn().Parents[0].LocalRevisionNumber);
            }
        }
예제 #8
0
        public void MakeBundle_ValidBase_BundleFileExistsAndReturnsTrue()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                File.WriteAllText(path, "original");
                setup.Repository.AddAndCheckinFile(path);
                Revision revision = setup.Repository.GetTip();
                setup.ChangeAndCheckinFile(path, "bad");

                var bundleFilePath = setup.Root.GetNewTempFile(true).Path;
                Assert.That(setup.Repository.MakeBundle(new []{revision.Number.Hash}, bundleFilePath), Is.True);
                Assert.That(File.Exists(bundleFilePath), Is.True);
            }
        }