示例#1
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");
            }
        }
示例#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_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);
            }
        }
示例#4
0
        public void BackoutHead_UsesCommitMessage()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                setup.Repository.AddAndCheckinFile(path);
                File.WriteAllText(path, "2");
                setup.Repository.AddAndCheckinFile(path);
                var theMessage = "testing";
                setup.Repository.BackoutHead("1", theMessage);
                setup.AssertLocalNumberOfTip("2");
                setup.AssertHeadOfWorkingDirNumber("2");
                setup.AssertHeadCount(1);

                setup.AssertCommitMessageOfRevision("2", theMessage);
            }
        }
示例#5
0
        public void BackoutHead_UsesCommitMessage()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                setup.Repository.AddAndCheckinFile(path);
                File.WriteAllText(path, "2");
                setup.Repository.AddAndCheckinFile(path);
                var theMessage = "testing";
                setup.Repository.BackoutHead("1", theMessage);
                setup.AssertLocalNumberOfTip("2");
                setup.AssertHeadOfWorkingDirNumber("2");
                setup.AssertHeadCount(1);

                //for debuging a weird TeamCity failure of this
                Assert.AreEqual((int)'t', (int)(setup.Repository.GetRevision("2").Summary.Trim())[0]);
                Assert.AreEqual((int)'t', (int)(setup.Repository.GetRevision("2").Summary)[0]);
                Assert.AreEqual(theMessage, setup.Repository.GetRevision("2").Summary);

                setup.AssertCommitMessageOfRevision("2", theMessage);
            }
        }
示例#6
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);
            }
        }
示例#7
0
        public void BackoutHead_UsesCommitMessage()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                setup.Repository.AddAndCheckinFile(path);
                File.WriteAllText(path,"2");
                setup.Repository.AddAndCheckinFile(path);
                var theMessage = "testing";
                setup.Repository.BackoutHead("1", theMessage);
                setup.AssertLocalNumberOfTip("2");
                setup.AssertHeadOfWorkingDirNumber("2");
                setup.AssertHeadCount(1);

                setup.AssertCommitMessageOfRevision("2",theMessage);
            }
        }
示例#8
0
        public void BackoutHead_UsesCommitMessage()
        {
            using (var setup = new HgTestSetup())
            {
                var path = setup.Root.GetNewTempFile(true).Path;
                setup.Repository.AddAndCheckinFile(path);
                File.WriteAllText(path,"2");
                setup.Repository.AddAndCheckinFile(path);
                var theMessage = "testing";
                setup.Repository.BackoutHead("1", theMessage);
                setup.AssertLocalNumberOfTip("2");
                setup.AssertHeadOfWorkingDirNumber("2");
                setup.AssertHeadCount(1);

                //for debuging a weird TeamCity failure of this
                Assert.AreEqual((int)'t', (int)(setup.Repository.GetRevision("2").Summary.Trim())[0]);
                Assert.AreEqual((int)'t', (int)(setup.Repository.GetRevision("2").Summary)[0]);
                Assert.AreEqual(theMessage, setup.Repository.GetRevision("2").Summary);

                setup.AssertCommitMessageOfRevision("2",theMessage);
            }
        }