##// END OF EJS Templates
commands: add value for cmdtype argument for read only commands...
Pulkit Goyal -
r35105:4b288d11 default
parent child Browse files
Show More
@@ -65,6 +65,7 b' table = {}'
65 table.update(debugcommandsmod.command._table)
65 table.update(debugcommandsmod.command._table)
66
66
67 command = registrar.command(table)
67 command = registrar.command(table)
68 readonly = registrar.command.readonly
68
69
69 # common command options
70 # common command options
70
71
@@ -1060,7 +1061,7 b' def branch(ui, repo, label=None, **opts)'
1060 _('show only branches that have unmerged heads (DEPRECATED)')),
1061 _('show only branches that have unmerged heads (DEPRECATED)')),
1061 ('c', 'closed', False, _('show normal and closed branches')),
1062 ('c', 'closed', False, _('show normal and closed branches')),
1062 ] + formatteropts,
1063 ] + formatteropts,
1063 _('[-c]'))
1064 _('[-c]'), cmdtype=readonly)
1064 def branches(ui, repo, active=False, closed=False, **opts):
1065 def branches(ui, repo, active=False, closed=False, **opts):
1065 """list repository named branches
1066 """list repository named branches
1066
1067
@@ -1254,7 +1255,7 b' def bundle(ui, repo, fname, dest=None, *'
1254 ('', 'decode', None, _('apply any matching decode filter')),
1255 ('', 'decode', None, _('apply any matching decode filter')),
1255 ] + walkopts + formatteropts,
1256 ] + walkopts + formatteropts,
1256 _('[OPTION]... FILE...'),
1257 _('[OPTION]... FILE...'),
1257 inferrepo=True)
1258 inferrepo=True, cmdtype=readonly)
1258 def cat(ui, repo, file1, *pats, **opts):
1259 def cat(ui, repo, file1, *pats, **opts):
1259 """output the current or given revision of files
1260 """output the current or given revision of files
1260
1261
@@ -1600,7 +1601,7 b' def _docommit(ui, repo, *pats, **opts):'
1600 ('l', 'local', None, _('edit repository config')),
1601 ('l', 'local', None, _('edit repository config')),
1601 ('g', 'global', None, _('edit global config'))] + formatteropts,
1602 ('g', 'global', None, _('edit global config'))] + formatteropts,
1602 _('[-u] [NAME]...'),
1603 _('[-u] [NAME]...'),
1603 optionalrepo=True)
1604 optionalrepo=True, cmdtype=readonly)
1604 def config(ui, repo, *values, **opts):
1605 def config(ui, repo, *values, **opts):
1605 """show combined config settings from all hgrc files
1606 """show combined config settings from all hgrc files
1606
1607
@@ -1773,7 +1774,7 b" def debugcomplete(ui, cmd='', **opts):"
1773 ('c', 'change', '', _('change made by revision'), _('REV'))
1774 ('c', 'change', '', _('change made by revision'), _('REV'))
1774 ] + diffopts + diffopts2 + walkopts + subrepoopts,
1775 ] + diffopts + diffopts2 + walkopts + subrepoopts,
1775 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
1776 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
1776 inferrepo=True)
1777 inferrepo=True, cmdtype=readonly)
1777 def diff(ui, repo, *pats, **opts):
1778 def diff(ui, repo, *pats, **opts):
1778 """diff repository (or selected files)
1779 """diff repository (or selected files)
1779
1780
@@ -1863,7 +1864,7 b' def diff(ui, repo, *pats, **opts):'
1863 ('', 'switch-parent', None, _('diff against the second parent')),
1864 ('', 'switch-parent', None, _('diff against the second parent')),
1864 ('r', 'rev', [], _('revisions to export'), _('REV')),
1865 ('r', 'rev', [], _('revisions to export'), _('REV')),
1865 ] + diffopts,
1866 ] + diffopts,
1866 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
1867 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'), cmdtype=readonly)
1867 def export(ui, repo, *changesets, **opts):
1868 def export(ui, repo, *changesets, **opts):
1868 """dump the header and diffs for one or more changesets
1869 """dump the header and diffs for one or more changesets
1869
1870
@@ -1944,7 +1945,7 b' def export(ui, repo, *changesets, **opts'
1944 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
1945 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
1945 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
1946 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
1946 ] + walkopts + formatteropts + subrepoopts,
1947 ] + walkopts + formatteropts + subrepoopts,
1947 _('[OPTION]... [FILE]...'))
1948 _('[OPTION]... [FILE]...'), cmdtype=readonly)
1948 def files(ui, repo, *pats, **opts):
1949 def files(ui, repo, *pats, **opts):
1949 """list tracked files
1950 """list tracked files
1950
1951
@@ -2317,7 +2318,7 b' def _dograft(ui, repo, *revs, **opts):'
2317 ('d', 'date', None, _('list the date (short with -q)')),
2318 ('d', 'date', None, _('list the date (short with -q)')),
2318 ] + formatteropts + walkopts,
2319 ] + formatteropts + walkopts,
2319 _('[OPTION]... PATTERN [FILE]...'),
2320 _('[OPTION]... PATTERN [FILE]...'),
2320 inferrepo=True)
2321 inferrepo=True, cmdtype=readonly)
2321 def grep(ui, repo, pattern, *pats, **opts):
2322 def grep(ui, repo, pattern, *pats, **opts):
2322 """search revision history for a pattern in specified files
2323 """search revision history for a pattern in specified files
2323
2324
@@ -2560,7 +2561,7 b' def grep(ui, repo, pattern, *pats, **opt'
2560 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
2561 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
2561 ('c', 'closed', False, _('show normal and closed branch heads')),
2562 ('c', 'closed', False, _('show normal and closed branch heads')),
2562 ] + templateopts,
2563 ] + templateopts,
2563 _('[-ct] [-r STARTREV] [REV]...'))
2564 _('[-ct] [-r STARTREV] [REV]...'), cmdtype=readonly)
2564 def heads(ui, repo, *branchrevs, **opts):
2565 def heads(ui, repo, *branchrevs, **opts):
2565 """show branch heads
2566 """show branch heads
2566
2567
@@ -2633,7 +2634,7 b' def heads(ui, repo, *branchrevs, **opts)'
2633 ('s', 'system', [], _('show help for specific platform(s)')),
2634 ('s', 'system', [], _('show help for specific platform(s)')),
2634 ],
2635 ],
2635 _('[-ecks] [TOPIC]'),
2636 _('[-ecks] [TOPIC]'),
2636 norepo=True)
2637 norepo=True, cmdtype=readonly)
2637 def help_(ui, name=None, **opts):
2638 def help_(ui, name=None, **opts):
2638 """show help for a given topic or a help overview
2639 """show help for a given topic or a help overview
2639
2640
@@ -2675,7 +2676,7 b' def help_(ui, name=None, **opts):'
2675 ('B', 'bookmarks', None, _('show bookmarks')),
2676 ('B', 'bookmarks', None, _('show bookmarks')),
2676 ] + remoteopts + formatteropts,
2677 ] + remoteopts + formatteropts,
2677 _('[-nibtB] [-r REV] [SOURCE]'),
2678 _('[-nibtB] [-r REV] [SOURCE]'),
2678 optionalrepo=True)
2679 optionalrepo=True, cmdtype=readonly)
2679 def identify(ui, repo, source=None, rev=None,
2680 def identify(ui, repo, source=None, rev=None,
2680 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
2681 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
2681 """identify the working directory or specified revision
2682 """identify the working directory or specified revision
@@ -3249,7 +3250,7 b' def locate(ui, repo, *pats, **opts):'
3249 _('do not display revision or any of its ancestors'), _('REV')),
3250 _('do not display revision or any of its ancestors'), _('REV')),
3250 ] + logopts + walkopts,
3251 ] + logopts + walkopts,
3251 _('[OPTION]... [FILE]'),
3252 _('[OPTION]... [FILE]'),
3252 inferrepo=True)
3253 inferrepo=True, cmdtype=readonly)
3253 def log(ui, repo, *pats, **opts):
3254 def log(ui, repo, *pats, **opts):
3254 """show revision history of entire repository or files
3255 """show revision history of entire repository or files
3255
3256
@@ -3457,7 +3458,7 b' def log(ui, repo, *pats, **opts):'
3457 [('r', 'rev', '', _('revision to display'), _('REV')),
3458 [('r', 'rev', '', _('revision to display'), _('REV')),
3458 ('', 'all', False, _("list files from all revisions"))]
3459 ('', 'all', False, _("list files from all revisions"))]
3459 + formatteropts,
3460 + formatteropts,
3460 _('[-r REV]'))
3461 _('[-r REV]'), cmdtype=readonly)
3461 def manifest(ui, repo, node=None, rev=None, **opts):
3462 def manifest(ui, repo, node=None, rev=None, **opts):
3462 """output the current or given revision of the project manifest
3463 """output the current or given revision of the project manifest
3463
3464
@@ -3721,7 +3722,8 b' def parents(ui, repo, file_=None, **opts'
3721 displayer.show(repo[n])
3722 displayer.show(repo[n])
3722 displayer.close()
3723 displayer.close()
3723
3724
3724 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
3725 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True,
3726 cmdtype=readonly)
3725 def paths(ui, repo, search=None, **opts):
3727 def paths(ui, repo, search=None, **opts):
3726 """show aliases for remote repositories
3728 """show aliases for remote repositories
3727
3729
@@ -4648,7 +4650,7 b' def rollback(ui, repo, **opts):'
4648 return repo.rollback(dryrun=opts.get(r'dry_run'),
4650 return repo.rollback(dryrun=opts.get(r'dry_run'),
4649 force=opts.get(r'force'))
4651 force=opts.get(r'force'))
4650
4652
4651 @command('root', [])
4653 @command('root', [], cmdtype=readonly)
4652 def root(ui, repo):
4654 def root(ui, repo):
4653 """print the root (top) of the current working directory
4655 """print the root (top) of the current working directory
4654
4656
@@ -4742,7 +4744,7 b' def serve(ui, repo, **opts):'
4742 ('', 'change', '', _('list the changed files of a revision'), _('REV')),
4744 ('', 'change', '', _('list the changed files of a revision'), _('REV')),
4743 ] + walkopts + subrepoopts + formatteropts,
4745 ] + walkopts + subrepoopts + formatteropts,
4744 _('[OPTION]... [FILE]...'),
4746 _('[OPTION]... [FILE]...'),
4745 inferrepo=True)
4747 inferrepo=True, cmdtype=readonly)
4746 def status(ui, repo, *pats, **opts):
4748 def status(ui, repo, *pats, **opts):
4747 """show changed files in the working directory
4749 """show changed files in the working directory
4748
4750
@@ -4907,7 +4909,8 b' def status(ui, repo, *pats, **opts):'
4907 fm.end()
4909 fm.end()
4908
4910
4909 @command('^summary|sum',
4911 @command('^summary|sum',
4910 [('', 'remote', None, _('check for push and pull'))], '[--remote]')
4912 [('', 'remote', None, _('check for push and pull'))],
4913 '[--remote]', cmdtype=readonly)
4911 def summary(ui, repo, **opts):
4914 def summary(ui, repo, **opts):
4912 """summarize working directory state
4915 """summarize working directory state
4913
4916
@@ -5308,7 +5311,7 b' def tag(ui, repo, name1, *names, **opts)'
5308 finally:
5311 finally:
5309 release(lock, wlock)
5312 release(lock, wlock)
5310
5313
5311 @command('tags', formatteropts, '')
5314 @command('tags', formatteropts, '', cmdtype=readonly)
5312 def tags(ui, repo, **opts):
5315 def tags(ui, repo, **opts):
5313 """list repository tags
5316 """list repository tags
5314
5317
@@ -5531,7 +5534,7 b' def verify(ui, repo):'
5531 """
5534 """
5532 return hg.verify(repo)
5535 return hg.verify(repo)
5533
5536
5534 @command('version', [] + formatteropts, norepo=True)
5537 @command('version', [] + formatteropts, norepo=True, cmdtype=readonly)
5535 def version_(ui, **opts):
5538 def version_(ui, **opts):
5536 """output version and copyright information"""
5539 """output version and copyright information"""
5537 opts = pycompat.byteskwargs(opts)
5540 opts = pycompat.byteskwargs(opts)
General Comments 0
You need to be logged in to leave comments. Login now