histedit: use the new stack definition for histedit
authorBoris Feld <boris.feld@octobus.net>
Fri, 19 Jan 2018 17:09:24 +0100
changeset 37003 2987726085c6
parent 37002 a72198790e15
child 37004 68fcc5503ec5
histedit: use the new stack definition for histedit Now that we have a common stack definition, use it in the hg histedit command. Differential Revision: https://phab.mercurial-scm.org/D2398
hgext/histedit.py
mercurial/destutil.py
--- a/hgext/histedit.py	Fri Jan 19 16:52:56 2018 +0100
+++ b/hgext/histedit.py	Fri Jan 19 17:09:24 2018 +0100
@@ -221,7 +221,7 @@
     default=False,
 )
 configitem('histedit', 'defaultrev',
-    default=configitem.dynamicdefault,
+    default=None,
 )
 configitem('histedit', 'dropmissing',
     default=False,
--- a/mercurial/destutil.py	Fri Jan 19 16:52:56 2018 +0100
+++ b/mercurial/destutil.py	Fri Jan 19 17:09:24 2018 +0100
@@ -340,18 +340,20 @@
                                 onheadcheck=onheadcheck, destspace=destspace)
     return repo[node].rev()
 
-histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())'
-
 def desthistedit(ui, repo):
     """Default base revision to edit for `hg histedit`."""
-    default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
-    if default:
+    default = ui.config('histedit', 'defaultrev')
+
+    if default is None:
+        revs = stack.getstack(repo)
+    elif default:
         revs = scmutil.revrange(repo, [default])
-        if revs:
-            # The revset supplied by the user may not be in ascending order nor
-            # take the first revision. So do this manually.
-            revs.sort()
-            return revs.first()
+
+    if revs:
+        # The revset supplied by the user may not be in ascending order nor
+        # take the first revision. So do this manually.
+        revs.sort()
+        return revs.first()
 
     return None