Read about our upcoming Code of Conduct on this issue

This instance was upgraded to Heptapod 0.28.0 today

Commit 788fc45f authored by Rodrigo Damazio Bovendorp's avatar Rodrigo Damazio Bovendorp
Browse files

help: categorizing evolve and topic commands

This makes them show up under the right categories in 'hg help'.

Differential Revision: https://phab.mercurial-scm.org/D6999
parent d3ad50b40a4e
Pipeline #743 passed with stage
in 14 minutes and 43 seconds
......@@ -465,7 +465,8 @@ def setupparentcommand(ui):
_alias, statuscmd = cmdutil.findcmd(b'status', commands.table)
pstatusopts = [o for o in statuscmd[1] if o[1] != b'rev']
@eh.command(b'pstatus', pstatusopts)
@eh.command(b'pstatus', pstatusopts,
**compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
def pstatus(ui, repo, *args, **kwargs):
"""show status combining committed and uncommited changes
......@@ -480,7 +481,8 @@ def setupparentcommand(ui):
_alias, diffcmd = cmdutil.findcmd(b'diff', commands.table)
pdiffopts = [o for o in diffcmd[1] if o[1] != b'rev']
@eh.command(b'pdiff', pdiffopts)
@eh.command(b'pdiff', pdiffopts,
**compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
def pdiff(ui, repo, *args, **kwargs):
"""show diff combining committed and uncommited changes
......@@ -989,7 +991,8 @@ def _findprevtarget(repo, displayer, movebookmark=False, topic=True):
(b'n', b'dry-run', False,
_(b'do not perform actions, just print what would be done'))],
b'[OPTION]...',
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
def cmdprevious(ui, repo, **opts):
"""update to parent revision
......@@ -1048,7 +1051,8 @@ def cmdprevious(ui, repo, **opts):
(b'n', b'dry-run', False,
_(b'do not perform actions, just print what would be done'))],
b'[OPTION]...',
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_WORKING_DIRECTORY'))
def cmdnext(ui, repo, **opts):
"""update to next child revision
......@@ -1339,8 +1343,16 @@ def _setuphelp(ui):
if entry[0] == b"evolution":
break
else:
help.helptable.append(([b"evolution"], _(b"Safely Rewriting History"),
_helploader))
if util.safehasattr(help, 'TOPIC_CATEGORY_CONCEPTS'):
help.helptable.append(([b"evolution"],
_(b"Safely Rewriting History"),
_helploader,
help.TOPIC_CATEGORY_CONCEPTS))
else:
# hg <= 4.7 (c303d65d2e34)
help.helptable.append(([b"evolution"],
_(b"Safely Rewriting History"),
_helploader))
help.helptable.sort()
evolvestateversion = 0
......
......@@ -109,7 +109,8 @@ interactiveopt = [[b'i', b'interactive', None, _(b'use interactive mode')]]
(b'n', b'note', b'', _(b'store a note on amend'), _(b'TEXT')),
] + walkopts + commitopts + commitopts2 + commitopts3 + interactiveopt,
_(b'[OPTION]... [FILE]...'),
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_COMMITTING'))
def amend(ui, repo, *pats, **opts):
"""combine a changeset with updates and replace it with a new one
......@@ -454,7 +455,8 @@ def _uncommitdirstate(repo, oldctx, match, interactive):
(b'', b'revert', False, _(b'discard working directory changes after uncommit')),
(b'n', b'note', b'', _(b'store a note on uncommit'), _(b'TEXT')),
] + commands.walkopts + commitopts + commitopts2 + commitopts3,
_(b'[OPTION]... [NAME]'))
_(b'[OPTION]... [NAME]'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def uncommit(ui, repo, *pats, **opts):
"""move changes from parent revision to working directory
......@@ -690,7 +692,8 @@ def _patchtocommit(ui, repo, old, fp, message=None, extras=None):
(b'n', b'note', b'', _(b'store a note on fold'), _(b'TEXT')),
] + commitopts + commitopts2 + commitopts3,
_(b'hg fold [OPTION]... [-r] REV'),
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def fold(ui, repo, *revs, **opts):
"""fold multiple revisions into a single one
......@@ -820,7 +823,8 @@ def fold(ui, repo, *revs, **opts):
(b'', b'fold', None, _(b"also fold specified revisions into one")),
(b'n', b'note', b'', _(b'store a note on metaedit'), _(b'TEXT')),
] + commitopts + commitopts2 + commitopts3,
_(b'hg metaedit [OPTION]... [-r] [REV]'))
_(b'hg metaedit [OPTION]... [-r] [REV]'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def metaedit(ui, repo, *revs, **opts):
"""edit commit information
......@@ -979,7 +983,8 @@ def _getmetadata(**opts):
(b'B', b'bookmark', [], _(b"remove revs only reachable from given"
b" bookmark"), _(b'BOOKMARK'))] + metadataopts,
_(b'[OPTION] [-r] REV...'),
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
# XXX -U --noupdate option to prevent wc update and or bookmarks update ?
def cmdprune(ui, repo, *revs, **opts):
"""mark changesets as obsolete or succeeded by another changeset
......@@ -1173,7 +1178,8 @@ def cmdprune(ui, repo, *revs, **opts):
(b'n', b'note', b'', _(b"store a note on split"), _(b'TEXT')),
] + commitopts + commitopts2 + commitopts3,
_(b'hg split [OPTION] [-r REV] [FILES]'),
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def cmdsplit(ui, repo, *pats, **opts):
"""split a changeset into smaller changesets
......@@ -1348,7 +1354,8 @@ def cmdsplit(ui, repo, *pats, **opts):
b'mark the new revision as successor of the old one potentially creating '
b'divergence')],
# allow to choose the seed ?
_(b'[-r] revs'))
_(b'[-r] revs'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def touch(ui, repo, *revs, **opts):
"""create successors identical to their predecessors but the changeset ID
......@@ -1449,7 +1456,8 @@ def touchnodes(ui, repo, revs, displayer, **opts):
(b'c', b'continue', False, b'continue interrupted pick'),
(b'a', b'abort', False, b'abort interrupted pick'),
] + mergetoolopts,
_(b'[-r] rev'))
_(b'[-r] rev'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def cmdpick(ui, repo, *revs, **opts):
"""move a commit on the top of working directory parent and updates to it."""
......
......@@ -17,6 +17,7 @@ from mercurial import (
obsolete,
obsutil,
pycompat,
registrar,
repair,
scmutil,
util,
......@@ -515,3 +516,12 @@ def markersoperations(markers):
if meta.get(b'operation'))
return sorted(operations)
# help category compatibility
# hg <= 4.7 (c303d65d2e34)
def helpcategorykwargs(categoryname):
"""Backwards-compatible specification of the helpategory argument."""
category = getattr(registrar.command, categoryname, None)
if not category:
return {}
return {'helpcategory': category}
......@@ -1505,7 +1505,8 @@ def divergentsets(repo, ctx):
b' in the repo')),
] + mergetoolopts,
_(b'[OPTIONS]...'),
helpbasic=True
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT')
)
def evolve(ui, repo, **opts):
"""solve troubled changesets in your repository
......
......@@ -50,7 +50,7 @@ class exthelper(object):
@eh.command('mynewcommand',
[('r', 'rev', [], _('operate on these revisions'))],
_('-r REV...'),
helpcategory=command.CATEGORY_XXX)
**compat.helpcategorykwargs('CATEGORY_XXX'))
def newcommand(ui, repo, *revs, **opts):
# implementation goes here
......
......@@ -50,7 +50,8 @@ def enableeffectflags(ui):
(b'p', b'patch', False, _(b'show the patch between two obs versions')),
(b'f', b'filternonlocal', False, _(b'filter out non local commits')),
] + commands.formatteropts,
_(b'hg olog [OPTION]... [REV]'))
_(b'hg olog [OPTION]... [REV]'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_NAVIGATION'))
def cmdobshistory(ui, repo, *revs, **opts):
"""show the obsolescence history of the specified revisions
......
......@@ -36,7 +36,8 @@ identicalflag = 4
_(b"do not modify working directory during rewind")),
],
_(b'[--as-divergence] [--exact] [--keep] [--to REV]... [--from REV]...'),
helpbasic=True)
helpbasic=True,
**compat.helpcategorykwargs('CATEGORY_CHANGE_MANAGEMENT'))
def rewind(ui, repo, **opts):
"""rewind a stack of changesets to a previous state
......
......@@ -634,7 +634,8 @@ revsetpredicate = topicrevset.revsetpredicate
(b'', b'age', False, b'show when you last touched the topics'),
(b'', b'current', None, b'display the current topic only'),
] + commands.formatteropts,
_(b'hg topics [TOPIC]'))
_(b'hg topics [TOPIC]'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_ORGANIZATION'))
def topics(ui, repo, topic=None, **opts):
"""View current topic, set current topic, change topic for a set of revisions, or see all topics.
......@@ -777,7 +778,8 @@ def topics(ui, repo, topic=None, **opts):
(b'c', b'children', None,
_(b'display data about children outside of the stack'))
] + commands.formatteropts,
_(b'hg stack [TOPIC]'))
_(b'hg stack [TOPIC]'),
**compat.helpcategorykwargs('CATEGORY_CHANGE_NAVIGATION'))
def cmdstack(ui, repo, topic=b'', **opts):
"""list all changesets in a topic and other information
......
......@@ -10,6 +10,7 @@ from __future__ import absolute_import
from mercurial import (
obsolete,
pycompat,
registrar,
)
getmarkers = None
......@@ -34,3 +35,12 @@ else:
def branchmapitems(branchmap):
return branchmap.iteritems()
# py3-transform: on
# help category compatibility
# hg <= 4.7 (c303d65d2e34)
def helpcategorykwargs(categoryname):
"""Backwards-compatible specification of the helpategory argument."""
category = getattr(registrar.command, categoryname, None)
if not category:
return {}
return {'helpcategory': category}
......@@ -122,10 +122,15 @@
list of commands:
stack list all changesets in a topic and other information
Change organization:
topics View current topic, set current topic, change topic for a set
of revisions, or see all topics.
Change navigation:
stack list all changesets in a topic and other information
(use 'hg help -v topic' to show built-in aliases and global options)
$ hg help topics
hg topics [TOPIC]
......
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