Patchwork D2398: histedit: use the new stack definition for histedit

login
register
mail settings
Submitter phabricator
Date Feb. 28, 2018, 11:59 p.m.
Message ID <b88c37e18dda7f00576c4b1c68ee0305@localhost.localdomain>
Download mbox | patch
Permalink /patch/28514/
State Not Applicable
Headers show

Comments

phabricator - Feb. 28, 2018, 11:59 p.m.
lothiraldan updated this revision to Diff 6214.
Herald added a reviewer: durin42.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2398?vs=6012&id=6214

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/destutil.py

CHANGE DETAILS




To: lothiraldan, #hg-reviewers, indygreg, durin42
Cc: indygreg, mercurial-devel

Patch

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -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
 
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -221,7 +221,7 @@ 
     default=False,
 )
 configitem('histedit', 'defaultrev',
-    default=configitem.dynamicdefault,
+    default=None,
 )
 configitem('histedit', 'dropmissing',
     default=False,