changeset 47553:debc29900b97

rewriteutil: look up common predecessor on unfiltered repo 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 looking up the common predecessor in an unfiltered repo. Differential Revision: https://phab.mercurial-scm.org/D10917
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 29 Jun 2021 14:02:34 -0700
parents 93ca7d3278b9
children c8f8d2dba6c7
files mercurial/rewriteutil.py tests/test-amend.t
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/rewriteutil.py	Wed Jul 07 10:07:28 2021 -0700
+++ b/mercurial/rewriteutil.py	Tue Jun 29 14:02:34 2021 -0700
@@ -145,7 +145,7 @@
     for r in obsrevs:
         div = find_new_divergence_from(repo, repo[r])
         if div:
-            return (repo[r], repo[div[0]], repo[div[1]])
+            return (repo[r], repo[div[0]], repo.unfiltered()[div[1]])
     return None
 
 
--- a/tests/test-amend.t	Wed Jul 07 10:07:28 2021 -0700
+++ b/tests/test-amend.t	Tue Jun 29 14:02:34 2021 -0700
@@ -273,9 +273,9 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 Try to cause divergence
   $ hg amend -m C11
-  abort: filtered revision '26805aba1e600a82e93661149f2313866a221a7b' (known-bad-output !)
-  [255]
- [10]
+  abort: cannot amend 2758767f5d17, as that creates content-divergence with bfcb433a0dea, from 26805aba1e60
+  (add --verbose for details or see 'hg help evolution.instability')
+  [10]
 #endif
 
 Cannot amend public changeset