diff tests/test-touch.t @ 5979:4a09e95d29c9 stable

rewriteutil: fix broken touch of merge commits (issue6416) `rewriteutil.rewrite()` is for rewriting a linear chain of commits into a single commit, i.e. what `hg fold` does. Many of the callers passed in a single commit because they wanted to rewrite just a single commit (e.g. `hg touch`). Before this patch, the code worked by going through the commits to fold and adding up all the modified files in them, then building a `memctx` based on that. As reported in issue6416, that can lose changes in merge commits. We could probably fix that without changing the existing code too much, but it seems the easiest way is to rewrite the code so it instead creates the new commit by effectively checking out the base and then revert to the head of the chain, so that's what this patch does. It does so by using in-memory merge.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 05 Oct 2020 08:35:17 -0700
parents bf48247af25a
children e97fbded40a5 3fdfeca7e45f
line wrap: on
line diff
--- a/tests/test-touch.t	Mon Oct 05 09:02:21 2020 -0700
+++ b/tests/test-touch.t	Mon Oct 05 08:35:17 2020 -0700
@@ -256,12 +256,10 @@
   $ hg status --hidden --change 'min(desc("merge"))'
   A right1
   A right2
-BROKEN: should be the same as "5"
   $ hg status --hidden --change 'max(desc("merge"))'
+  A right1
   A right2
-BROKEN: There should be no difference
   $ hg status --hidden --rev 'min(desc("merge"))' --rev 'max(desc("merge"))'
-  R right1
   $ cd ..
 
 Check that touching a merge commit doesn't lose copies
@@ -315,10 +313,10 @@
   left -> merge-copy-left
   $ hg debugpathcopies 'min(desc("right"))' 'min(desc("merge"))'
   base -> copy-on-left
-  right -> merge-copy-right (missing-correct-output !)
+  right -> merge-copy-right
   $ hg debugpathcopies 'min(desc("right"))' 'max(desc("merge"))'
   base -> copy-on-left
-  right -> merge-copy-right (missing-correct-output !)
+  right -> merge-copy-right
   $ cd ..
 
 Make sure touch doesn't fail to warn about divergence (issue6107)