Patchwork D7684: histedit: use rewriteutil.precheck() instead of reimplementing it

login
register
mail settings
Submitter phabricator
Date Dec. 18, 2019, 6:48 a.m.
Message ID <75fbf5f861d2c6a0ef646b1ed167c92a@localhost.localdomain>
Download mbox | patch
Permalink /patch/43972/
State Not Applicable
Headers show

Comments

phabricator - Dec. 18, 2019, 6:48 a.m.
Closed by commit rHGbde97bee321f: histedit: use rewriteutil.precheck() instead of reimplementing it (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/D7684?vs=18828&id=18859

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

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-obsolete.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -307,7 +307,7 @@ 
   o  0:cb9a9f314b8b (public) a
   
   $ hg histedit -r '.~2'
-  abort: cannot edit public changeset: cb9a9f314b8b
+  abort: cannot edit public changesets
   (see 'hg help phases' for details)
   [255]
 
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -230,6 +230,7 @@ 
     pycompat,
     registrar,
     repair,
+    rewriteutil,
     scmutil,
     state as statemod,
     util,
@@ -2306,23 +2307,9 @@ 
     When keep is false, the specified set can't have children."""
     revs = repo.revs(b'%n::%n', old, new)
     if revs and not keep:
-        if not obsolete.isenabled(
-            repo, obsolete.allowunstableopt
-        ) and repo.revs(b'(%ld::) - (%ld)', revs, revs):
-            raise error.Abort(
-                _(
-                    b'can only histedit a changeset together '
-                    b'with all its descendants'
-                )
-            )
+        rewriteutil.precheck(repo, revs, b'edit')
         if repo.revs(b'(%ld) and merge()', revs):
             raise error.Abort(_(b'cannot edit history that contains merges'))
-        root = repo[revs.first()]  # list is already sorted by repo.revs()
-        if not root.mutable():
-            raise error.Abort(
-                _(b'cannot edit public changeset: %s') % root,
-                hint=_(b"see 'hg help phases' for details"),
-            )
     return pycompat.maplist(repo.changelog.node, revs)