D8843: rebase: fix regression in file change detection introduced by 0ecb3b11fcad

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

D8843: rebase: fix regression in file change detection introduced by 0ecb3b11fcad

pulkit (Pulkit Goyal)
mjacob created this revision.
Herald added a reviewer: martinvonz.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before 0ecb3b11fcad <https://phab.mercurial-scm.org/rHG0ecb3b11fcadf4849ee1f4fcc151e26e311b0773>, `wctx._compact()`, was called by `wctx.nofilechanges()` as
  a side effect. Later, it turned out that this side effect is needed to correctly
  detect which files changed. See https://phab.mercurial-scm.org/D8733#131949 for
  the history.
 
  The problem could also be triggered by running `tests/test-rebase-parameters.t`
  with `--extra-config-opt rebase.experimental.inmemory=1`.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D8843

AFFECTED FILES
  hgext/rebase.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -963,3 +963,21 @@
   |/
   o  0: d20a80d4def3 'base'
   
+
+  $ cd ..
+
+Test (virtual) working directory without changes, created by merge conflict
+resolution. There was a regression where the file was incorrectly detected as
+changed although the file contents were the same as in the parent.
+
+  $ hg init nofilechanges
+  $ cd nofilechanges
+  $ echo a > a; hg add a; hg ci -m a
+  $ echo foo > test; hg add test; hg ci -m b
+  $ hg up 0 -q
+  $ echo bar > test; hg add test; hg ci -m c
+  created new head
+  $ hg rebase -d 2 -d 1 --tool :local
+  rebasing 2:ca2749322ee5 "c" (tip)
+  note: not rebasing 2:ca2749322ee5 "c" (tip), its destination already has all its changes
+  saved backup bundle to $TESTTMP/nofilechanges/.hg/strip-backup/ca2749322ee5-6dc7e94b-rebase.hg
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1442,6 +1442,10 @@
     if b'branch' in extra:
         branch = extra[b'branch']
 
+    # FIXME: We call _compact() because it's required to correctly detect
+    # changed files. This was added to fix a regression shortly before the 5.5
+    # release. A proper fix will be done in the default branch.
+    wctx._compact()
     memctx = wctx.tomemctx(
         commitmsg,
         date=date,



To: mjacob, martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel