Read about our upcoming Code of Conduct on this issue

Commit fa6bdb59 authored by Anton Shestakov's avatar Anton Shestakov
Browse files

prune: spell --successor flag without any unnecessary shortcuts

If a user wants to spell out -s, it makes sense to allow that. Before this
patch, prune would complain that --successor is not a recognized option.
Obviously people don't usually need to spell --successors by hand thanks to
shell completion (at least for Bash) using debugcomplete to see all available
flags, so this patch doesn't bring any need for more typing.

And thanks to Mercurial understanding shortened forms of command-line flags as
long as they are unambiguous, the old-style `--succ` flags still work normally,
and there are tests that use them. But two tests now use the full form to
demonstrate that both ways work.

--HG--
branch : stable
parent d0965c5c5335
......@@ -7,6 +7,7 @@ Changelog
* pick: no longer forget file in case of conflict (issue6037)
* pick: properly report and cleanup "unfinished state"
* prune: don't update wcp if pruned revision are unrelated (issue6137)
* prune: spell --successor flag without any unnecessary shortcuts
* evolve: properly prune changeset with no change in case of conflict (issue5967)
* touch: detect resulting divergence in more cases (issue6107)
......
......@@ -1276,7 +1276,7 @@ def stripwrapper(orig, ui, repo, *revs, **kwargs):
revs = repo.revs("(%ld)::", revs)
kwargs['rev'] = []
kwargs['new'] = []
kwargs['succ'] = []
kwargs['successor'] = []
kwargs['biject'] = False
return cmdrewrite.cmdprune(ui, repo, *revs, **kwargs)
......
......@@ -958,7 +958,7 @@ def _getmetadata(**opts):
@eh.command(
'prune|obsolete',
[('n', 'new', [], _("successor changeset (DEPRECATED)")),
('s', 'succ', [], _("successor changeset"), _('REV')),
('s', 'successor', [], _("successor changeset"), _('REV')),
('r', 'rev', [], _("revisions to prune"), _('REV')),
('k', 'keep', None, _("does not modify working copy during prune")),
('n', 'note', '', _('store a note on prune'), _('TEXT')),
......@@ -985,12 +985,12 @@ def cmdprune(ui, repo, *revs, **opts):
When you prune the parent of your working copy, Mercurial updates the working
copy to a non-obsolete parent.
You can use ``-s/--succ`` to tell Mercurial that a newer version (successor) of the
pruned changeset exists. Mercurial records successor revisions in obsolescence
markers.
You can use ``-s/--successor`` to tell Mercurial that a newer version
(successor) of the pruned changeset exists. Mercurial records successor
revisions in obsolescence markers.
If you prune a single revision and specify multiple revisions in
``-s/--succ``, you are recording a "split" and must acknowledge it by
``-s/--successor``, you are recording a "split" and must acknowledge it by
passing ``--split``. Similarly, when you prune multiple changesets with a
single successor, you must pass the ``--fold`` option.
......@@ -1001,7 +1001,7 @@ def cmdprune(ui, repo, *revs, **opts):
"""
_checknotesize(ui, opts)
revs = scmutil.revrange(repo, list(revs) + opts.get('rev'))
succs = opts['new'] + opts['succ']
succs = opts['new'] + opts['successor']
bookmarks = set(opts.get('bookmark'))
metadata = _getmetadata(**opts)
biject = opts.get('pair') or opts.get('biject')
......
......@@ -42,7 +42,7 @@ Create a split commit
$ printf "pp" > pp;
$ hg add pp
$ hg commit -m "_pp"
$ hg prune --succ "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
$ hg prune --successor "desc(_oo) + desc(_pp)" -r "desc('oo+pp')" --split
1 changesets pruned
1 new orphan changesets
$ hg log -G
......
......@@ -595,7 +595,7 @@ Normal testing
picking 3:0e84df4912da "add 3"
$ hg graft -r1
grafting 1:73d38bb17fd7 "add 1"
$ hg prune -r2 --succ .
$ hg prune -r2 --successor .
1 changesets pruned
$ glog --hidden
@ 6:417185465d2c@default(draft) add 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment