Patchwork D10917: rewriteutil: check for divergence on unfiltered repo

login
register
mail settings
Submitter phabricator
Date June 29, 2021, 9:20 p.m.
Message ID <differential-rev-PHID-DREV-o6zopogwqjfvk5vqy75m-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49231/
State Superseded
Headers show

Comments

phabricator - June 29, 2021, 9:20 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this patch, the code looking for divergence could crash when
  tried to look up a common predecessor in the filtered repo. This patch
  fixes that by checking for divergence in an unfiltered repo.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/rewriteutil.py
  tests/test-amend.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -281,10 +281,11 @@ 
   obsoleted 1 changesets
   $ hg co --hidden $node_B_split2
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-BROKEN: Should not complain about a filtered predecessor
+BROKEN: Should not be considered divergence (issue6262)
   $ hg amend -m 'revived B-split2'
-  abort: filtered revision '16084da537dd8f84cfdb3055c633772269d62e1b' (known-bad-output !)
-  [255]
+  abort: cannot amend 809fe227532f, as that creates content-divergence with c68306a86921, from 16084da537dd (known-bad-output !)
+  (add --verbose for details or see 'hg help evolution.instability') (known-bad-output !)
+  [10]
 #endif
 
 Cannot amend public changeset
diff --git a/mercurial/rewriteutil.py b/mercurial/rewriteutil.py
--- a/mercurial/rewriteutil.py
+++ b/mercurial/rewriteutil.py
@@ -86,7 +86,7 @@ 
         )
 
     if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
-        new_divergence = _find_new_divergence(repo, revs)
+        new_divergence = _find_new_divergence(repo.unfiltered(), revs)
         if new_divergence:
             local_ctx, other_ctx, base_ctx = new_divergence
             msg = _(