[Updated] [+ ] D12088: fix: remove unnecessary and overly strict check for divergence

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Jan 26 18:29:46 UTC 2022


martinvonz updated this revision to Diff 31980.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12088?vs=31979&id=31980

BRANCH
  default

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

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

AFFECTED FILES
  hgext/fix.py
  tests/test-fix.t

CHANGE DETAILS

diff --git a/tests/test-fix.t b/tests/test-fix.t
--- a/tests/test-fix.t
+++ b/tests/test-fix.t
@@ -1169,8 +1169,9 @@
   $ hg commit -Aqm "foo"
   $ hg ci --amend -m rewritten
   $ hg --hidden fix -r 0
-  abort: fixing obsolete revision could cause divergence
-  [255]
+  abort: cannot fix b87e30dbf19b, as that creates content-divergence with 2e007a78dfb8
+  (add --verbose for details or see 'hg help evolution.instability')
+  [10]
 
   $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
   2 new content-divergent changesets
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -149,7 +149,6 @@
     mdiff,
     merge,
     mergestate as mergestatemod,
-    obsolete,
     pycompat,
     registrar,
     rewriteutil,
@@ -463,8 +462,6 @@
         revs = set(logcmdutil.revrange(repo, opts[b'rev']))
         if opts.get(b'working_dir'):
             revs.add(wdirrev)
-        for rev in revs:
-            checkfixablectx(ui, repo, repo[rev])
     # Allow fixing only wdir() even if there's an unfinished operation
     if not (len(revs) == 1 and wdirrev in revs):
         cmdutil.checkunfinished(repo)
@@ -481,16 +478,6 @@
     return revs
 
 
-def checkfixablectx(ui, repo, ctx):
-    """Aborts if the revision shouldn't be replaced with a fixed one."""
-    if ctx.obsolete():
-        # It would be better to actually check if the revision has a successor.
-        if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
-            raise error.Abort(
-                b'fixing obsolete revision could cause divergence'
-            )
-
-
 def pathstofix(ui, repo, pats, opts, match, basectxs, fixctx):
     """Returns the set of files that should be fixed in a context
 



To: martinvonz, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220126/97dc729e/attachment-0002.html>


More information about the Mercurial-patches mailing list