# HG changeset patch # User Boris Feld # Date 2018-01-19 16:09:24 # Node ID 2987726085c641f12a4fcef5594d516967c1a6e3 # Parent a72198790e15329d6b4f1210ca48afa080446135 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 diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -221,7 +221,7 @@ configitem('experimental', 'histedit.aut default=False, ) configitem('histedit', 'defaultrev', - default=configitem.dynamicdefault, + default=None, ) configitem('histedit', 'dropmissing', default=False, diff --git a/mercurial/destutil.py b/mercurial/destutil.py --- a/mercurial/destutil.py +++ b/mercurial/destutil.py @@ -340,18 +340,20 @@ def destmerge(repo, action='merge', sour 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