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