D2398: histedit: use the new stack definition for histedit
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Fri Feb 23 10:36:57 UTC 2018
lothiraldan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Now that we have a common stack definition, use it in the hg histedit command.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2398
AFFECTED FILES
mercurial/destutil.py
CHANGE DETAILS
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', None)
+
+ 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
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list