Mercurial > hg-stable
changeset 37006:2987726085c6
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
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Fri, 19 Jan 2018 17:09:24 +0100 |
parents | a72198790e15 |
children | 68fcc5503ec5 |
files | hgext/histedit.py mercurial/destutil.py |
diffstat | 2 files changed, 12 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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