D7897: rebase: fix bug where `--collapse` would apply diff on missing file

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 16 11:32:30 EST 2020


Closed by commit rHGe733c59f3c09: rebase: fix bug where `--collapse` would apply diff on missing file (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7897?vs=19333&id=19374

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7897/new/

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

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

CHANGE DETAILS

diff --git a/tests/test-rebase-collapse.t b/tests/test-rebase-collapse.t
--- a/tests/test-rebase-collapse.t
+++ b/tests/test-rebase-collapse.t
@@ -288,6 +288,18 @@
 
   $ hg rebase -s F --dest I --collapse # root (F) is not a merge
   rebasing 6:c82b08f646f1 "F" (F)
+  file 'E' was deleted in local [dest] but was modified in other [source].
+  You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.
+  What do you want to do? u
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ echo F > E
+  $ hg resolve -m
+  (no more unresolved files)
+  continue: hg rebase --continue
+  $ hg rebase -c
+  rebasing 6:c82b08f646f1 "F" (F)
   rebasing 7:a6db7fa104e1 "G" (G)
   rebasing 8:e1d201b72d91 "H" (H tip)
   saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1486,15 +1486,16 @@
     repo.ui.debug(b" merge against %d:%s\n" % (rev, ctx))
     if base is not None:
         repo.ui.debug(b"   detach base %d:%s\n" % (base, repo[base]))
-    # When collapsing in-place, the parent is the common ancestor, we
-    # have to allow merging with it.
+
+    # See explanation in merge.graft()
+    mergeancestor = repo.changelog.isancestor(p1ctx.node(), ctx.node())
     stats = mergemod.update(
         repo,
         rev,
         branchmerge=True,
         force=True,
         ancestor=base,
-        mergeancestor=collapse,
+        mergeancestor=mergeancestor,
         labels=[b'dest', b'source'],
         wc=wctx,
     )



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list