[PATCH] test-merge-tools: fix flaky test by avoiding debugsetparents

Martin von Zweigbergk martinvonz at google.com
Wed Feb 11 00:24:03 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1423613835 28800
#      Tue Feb 10 16:17:15 2015 -0800
# Node ID 4bba350e6e54c663a0763870bcd7a6f95857f601
# Parent  415414caf43924082eeab9ef1ce329cb2ab1f8eb
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().

diff -r 415414caf439 -r 4bba350e6e54 tests/test-merge-tools.t
--- a/tests/test-merge-tools.t	Mon Feb 09 16:20:55 2015 -0800
+++ 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!


More information about the Mercurial-devel mailing list