test-merge-tools: fix flaky test by avoiding debugsetparents
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 10 Feb 2015 16:17:15 -0800
changeset 24121 9d0b6ef92eb2
parent 24120 a450e0a2ba0a
child 24122 da14b8eba806
test-merge-tools: fix flaky test by avoiding debugsetparents debugsetparents is a debug command and does not provide the same guarantees as non-debug commands do. In particular, when the user sets a different parent, any clean files will remain clean in the dirstate even though the new parent might have a different version of the file (so it should appear modified compared to the new parent). Let's instead achieve the same effect by updating to the new parent and reverting the contents back to what they were. This fix can be tested by passing '--config debug.dirstate.delaywrite=2' to the 'hg update' command in the beforemerge().
tests/test-merge-tools.t
--- a/tests/test-merge-tools.t	Fri Feb 06 00:55:29 2015 +0000
+++ b/tests/test-merge-tools.t	Tue Feb 10 16:17:15 2015 -0800
@@ -603,7 +603,8 @@
   true.priority=1
   true.executable=cat
   # hg update -C 1
-  $ hg debugsetparent 0
+  $ hg update -q 0
+  $ hg revert -q -r 1 .
   $ hg update -r 2
   merging f
   revision 1
@@ -628,7 +629,8 @@
   true.priority=1
   true.executable=cat
   # hg update -C 1
-  $ hg debugsetparent 0
+  $ hg update -q 0
+  $ hg revert -q -r 1 .
   $ hg update -r 2 --tool false
   merging f
   merging f failed!