##// END OF EJS Templates
commands: move templates of common command options to cmdutil (API)...
Yuya Nishihara -
r32375:04baab18 default
parent child Browse files
Show More
@@ -85,18 +85,20 b' else:'
85 # available, because commands.formatteropts has been available since
85 # available, because commands.formatteropts has been available since
86 # 3.2 (or 7a7eed5176a4), even though formatting itself has been
86 # 3.2 (or 7a7eed5176a4), even though formatting itself has been
87 # available since 2.2 (or ae5f92e154d3)
87 # available since 2.2 (or ae5f92e154d3)
88 formatteropts = getattr(commands, "formatteropts", [])
88 formatteropts = getattr(cmdutil, "formatteropts",
89 getattr(commands, "formatteropts", []))
89
90
90 # for "historical portability":
91 # for "historical portability":
91 # use locally defined option list, if debugrevlogopts isn't available,
92 # use locally defined option list, if debugrevlogopts isn't available,
92 # because commands.debugrevlogopts has been available since 3.7 (or
93 # because commands.debugrevlogopts has been available since 3.7 (or
93 # 5606f7d0d063), even though cmdutil.openrevlog() has been available
94 # 5606f7d0d063), even though cmdutil.openrevlog() has been available
94 # since 1.9 (or a79fea6b3e77).
95 # since 1.9 (or a79fea6b3e77).
95 revlogopts = getattr(commands, "debugrevlogopts", [
96 revlogopts = getattr(cmdutil, "debugrevlogopts",
97 getattr(commands, "debugrevlogopts", [
96 ('c', 'changelog', False, ('open changelog')),
98 ('c', 'changelog', False, ('open changelog')),
97 ('m', 'manifest', False, ('open manifest')),
99 ('m', 'manifest', False, ('open manifest')),
98 ('', 'dir', False, ('open directory manifest')),
100 ('', 'dir', False, ('open directory manifest')),
99 ])
101 ]))
100
102
101 cmdtable = {}
103 cmdtable = {}
102
104
@@ -19,11 +19,10 b' from __future__ import absolute_import'
19 from mercurial.i18n import _
19 from mercurial.i18n import _
20 from mercurial import (
20 from mercurial import (
21 cmdutil,
21 cmdutil,
22 commands,
23 registrar,
22 registrar,
24 )
23 )
25
24
26 templateopts = commands.templateopts
25 templateopts = cmdutil.templateopts
27
26
28 cmdtable = {}
27 cmdtable = {}
29 command = registrar.command(cmdtable)
28 command = registrar.command(cmdtable)
@@ -17,7 +17,6 b' import time'
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 from mercurial import (
18 from mercurial import (
19 cmdutil,
19 cmdutil,
20 commands,
21 encoding,
20 encoding,
22 patch,
21 patch,
23 registrar,
22 registrar,
@@ -115,7 +114,7 b' def countrate(ui, repo, amap, *pats, **o'
115 ('s', 'sort', False, _('sort by key (default: sort by count)')),
114 ('s', 'sort', False, _('sort by key (default: sort by count)')),
116 ('', 'diffstat', False, _('display added/removed lines separately')),
115 ('', 'diffstat', False, _('display added/removed lines separately')),
117 ('', 'aliases', '', _('file with email aliases'), _('FILE')),
116 ('', 'aliases', '', _('file with email aliases'), _('FILE')),
118 ] + commands.walkopts,
117 ] + cmdutil.walkopts,
119 _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]"),
118 _("hg churn [-d DATE] [-r REV] [--aliases FILE] [FILE]"),
120 inferrepo=True)
119 inferrepo=True)
121 def churn(ui, repo, *pats, **opts):
120 def churn(ui, repo, *pats, **opts):
@@ -74,7 +74,6 b' from mercurial.node import ('
74 from mercurial import (
74 from mercurial import (
75 archival,
75 archival,
76 cmdutil,
76 cmdutil,
77 commands,
78 error,
77 error,
79 filemerge,
78 filemerge,
80 pycompat,
79 pycompat,
@@ -301,7 +300,7 b' extdiffopts = ['
301 ('r', 'rev', [], _('revision'), _('REV')),
300 ('r', 'rev', [], _('revision'), _('REV')),
302 ('c', 'change', '', _('change made by revision'), _('REV')),
301 ('c', 'change', '', _('change made by revision'), _('REV')),
303 ('', 'patch', None, _('compare patches for two revisions'))
302 ('', 'patch', None, _('compare patches for two revisions'))
304 ] + commands.walkopts + commands.subrepoopts
303 ] + cmdutil.walkopts + cmdutil.subrepoopts
305
304
306 @command('extdiff',
305 @command('extdiff',
307 [('p', 'program', '', _('comparison program to run'), _('CMD')),
306 [('p', 'program', '', _('comparison program to run'), _('CMD')),
@@ -15,7 +15,6 b' from mercurial.node import ('
15 )
15 )
16 from mercurial import (
16 from mercurial import (
17 cmdutil,
17 cmdutil,
18 commands,
19 error,
18 error,
20 exchange,
19 exchange,
21 hg,
20 hg,
@@ -39,7 +38,7 b" testedwith = 'ships-with-hg-core'"
39 ('e', 'edit', None, _('invoke editor on commit messages')),
38 ('e', 'edit', None, _('invoke editor on commit messages')),
40 ('', 'force-editor', None, _('edit commit message (DEPRECATED)')),
39 ('', 'force-editor', None, _('edit commit message (DEPRECATED)')),
41 ('', 'switch-parent', None, _('switch parents when merging')),
40 ('', 'switch-parent', None, _('switch parents when merging')),
42 ] + commands.commitopts + commands.commitopts2 + commands.remoteopts,
41 ] + cmdutil.commitopts + cmdutil.commitopts2 + cmdutil.remoteopts,
43 _('hg fetch [SOURCE]'))
42 _('hg fetch [SOURCE]'))
44 def fetch(ui, repo, source='default', **opts):
43 def fetch(ui, repo, source='default', **opts):
45 '''pull changes from a remote repository, merge new changes if needed.
44 '''pull changes from a remote repository, merge new changes if needed.
@@ -14,7 +14,6 b' import tempfile'
14 from mercurial.i18n import _
14 from mercurial.i18n import _
15 from mercurial import (
15 from mercurial import (
16 cmdutil,
16 cmdutil,
17 commands,
18 error,
17 error,
19 match,
18 match,
20 node as hgnode,
19 node as hgnode,
@@ -222,7 +221,7 b' def keystr(ui, key):'
222 ('m', 'message', '',
221 ('m', 'message', '',
223 _('use text as commit message'), _('TEXT')),
222 _('use text as commit message'), _('TEXT')),
224 ('e', 'edit', False, _('invoke editor on commit messages')),
223 ('e', 'edit', False, _('invoke editor on commit messages')),
225 ] + commands.commitopts2,
224 ] + cmdutil.commitopts2,
226 _('hg sign [OPTION]... [REV]...'))
225 _('hg sign [OPTION]... [REV]...'))
227 def sign(ui, repo, *revs, **opts):
226 def sign(ui, repo, *revs, **opts):
228 """add a signature for the current or given revision
227 """add a signature for the current or given revision
@@ -19,6 +19,7 b' from __future__ import absolute_import'
19
19
20 from mercurial.i18n import _
20 from mercurial.i18n import _
21 from mercurial import (
21 from mercurial import (
22 cmdutil,
22 commands,
23 commands,
23 registrar,
24 registrar,
24 )
25 )
@@ -51,7 +52,7 b" testedwith = 'ships-with-hg-core'"
51 _('show changesets within the given named branch'), _('BRANCH')),
52 _('show changesets within the given named branch'), _('BRANCH')),
52 ('P', 'prune', [],
53 ('P', 'prune', [],
53 _('do not display revision or any of its ancestors'), _('REV')),
54 _('do not display revision or any of its ancestors'), _('REV')),
54 ] + commands.logopts + commands.walkopts,
55 ] + cmdutil.logopts + cmdutil.walkopts,
55 _('[OPTION]... [FILE]'),
56 _('[OPTION]... [FILE]'),
56 inferrepo=True)
57 inferrepo=True)
57 def glog(ui, repo, *pats, **opts):
58 def glog(ui, repo, *pats, **opts):
@@ -23,7 +23,6 b' from mercurial.i18n import _'
23 from mercurial import (
23 from mercurial import (
24 bookmarks,
24 bookmarks,
25 cmdutil,
25 cmdutil,
26 commands,
27 dispatch,
26 dispatch,
28 error,
27 error,
29 extensions,
28 extensions,
@@ -421,7 +420,7 b' class journalstorage(object):'
421 'journal', [
420 'journal', [
422 ('', 'all', None, 'show history for all names'),
421 ('', 'all', None, 'show history for all names'),
423 ('c', 'commits', None, 'show commit metadata'),
422 ('c', 'commits', None, 'show commit metadata'),
424 ] + [opt for opt in commands.logopts if opt[1] not in _ignoreopts],
423 ] + [opt for opt in cmdutil.logopts if opt[1] not in _ignoreopts],
425 '[OPTION]... [BOOKMARKNAME]')
424 '[OPTION]... [BOOKMARKNAME]')
426 def journal(ui, repo, *args, **opts):
425 def journal(ui, repo, *args, **opts):
427 """show the previous position of bookmarks and the working copy
426 """show the previous position of bookmarks and the working copy
@@ -94,7 +94,6 b' from mercurial.hgweb import webcommands'
94
94
95 from mercurial import (
95 from mercurial import (
96 cmdutil,
96 cmdutil,
97 commands,
98 context,
97 context,
99 dispatch,
98 dispatch,
100 error,
99 error,
@@ -481,7 +480,7 b' def demo(ui, repo, *args, **opts):'
481 repo.wvfs.rmtree(repo.root)
480 repo.wvfs.rmtree(repo.root)
482
481
483 @command('kwexpand',
482 @command('kwexpand',
484 commands.walkopts,
483 cmdutil.walkopts,
485 _('hg kwexpand [OPTION]... [FILE]...'),
484 _('hg kwexpand [OPTION]... [FILE]...'),
486 inferrepo=True)
485 inferrepo=True)
487 def expand(ui, repo, *pats, **opts):
486 def expand(ui, repo, *pats, **opts):
@@ -498,7 +497,7 b' def expand(ui, repo, *pats, **opts):'
498 [('A', 'all', None, _('show keyword status flags of all files')),
497 [('A', 'all', None, _('show keyword status flags of all files')),
499 ('i', 'ignore', None, _('show files excluded from expansion')),
498 ('i', 'ignore', None, _('show files excluded from expansion')),
500 ('u', 'unknown', None, _('only show unknown (not tracked) files')),
499 ('u', 'unknown', None, _('only show unknown (not tracked) files')),
501 ] + commands.walkopts,
500 ] + cmdutil.walkopts,
502 _('hg kwfiles [OPTION]... [FILE]...'),
501 _('hg kwfiles [OPTION]... [FILE]...'),
503 inferrepo=True)
502 inferrepo=True)
504 def files(ui, repo, *pats, **opts):
503 def files(ui, repo, *pats, **opts):
@@ -557,7 +556,7 b' def files(ui, repo, *pats, **opts):'
557 fm.end()
556 fm.end()
558
557
559 @command('kwshrink',
558 @command('kwshrink',
560 commands.walkopts,
559 cmdutil.walkopts,
561 _('hg kwshrink [OPTION]... [FILE]...'),
560 _('hg kwshrink [OPTION]... [FILE]...'),
562 inferrepo=True)
561 inferrepo=True)
563 def shrink(ui, repo, *pats, **opts):
562 def shrink(ui, repo, *pats, **opts):
@@ -18,7 +18,6 b' from mercurial.i18n import _'
18
18
19 from mercurial import (
19 from mercurial import (
20 cmdutil,
20 cmdutil,
21 commands,
22 context,
21 context,
23 error,
22 error,
24 hg,
23 hg,
@@ -542,7 +541,7 b' def updatelfiles(ui, repo, filelist=None'
542
541
543 @command('lfpull',
542 @command('lfpull',
544 [('r', 'rev', [], _('pull largefiles for these revisions'))
543 [('r', 'rev', [], _('pull largefiles for these revisions'))
545 ] + commands.remoteopts,
544 ] + cmdutil.remoteopts,
546 _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]'))
545 _('-r REV... [-e CMD] [--remotecmd CMD] [SOURCE]'))
547 def lfpull(ui, repo, source="default", **opts):
546 def lfpull(ui, repo, source="default", **opts):
548 """pull largefiles for the specified revisions from the specified source
547 """pull largefiles for the specified revisions from the specified source
@@ -2407,7 +2407,7 b' def init(ui, repo, **opts):'
2407 _('use uncompressed transfer (fast over LAN)')),
2407 _('use uncompressed transfer (fast over LAN)')),
2408 ('p', 'patches', '',
2408 ('p', 'patches', '',
2409 _('location of source patch repository'), _('REPO')),
2409 _('location of source patch repository'), _('REPO')),
2410 ] + commands.remoteopts,
2410 ] + cmdutil.remoteopts,
2411 _('hg qclone [OPTION]... SOURCE [DEST]'),
2411 _('hg qclone [OPTION]... SOURCE [DEST]'),
2412 norepo=True)
2412 norepo=True)
2413 def clone(ui, source, dest=None, **opts):
2413 def clone(ui, source, dest=None, **opts):
@@ -2575,7 +2575,7 b' def setupheaderopts(ui, opts):'
2575 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
2575 ('D', 'currentdate', None, _('add "Date: <current date>" to patch')),
2576 ('d', 'date', '',
2576 ('d', 'date', '',
2577 _('add "Date: <DATE>" to patch'), _('DATE'))
2577 _('add "Date: <DATE>" to patch'), _('DATE'))
2578 ] + commands.walkopts + commands.commitopts,
2578 ] + cmdutil.walkopts + cmdutil.commitopts,
2579 _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'),
2579 _('hg qnew [-e] [-m TEXT] [-l FILE] PATCH [FILE]...'),
2580 inferrepo=True)
2580 inferrepo=True)
2581 def new(ui, repo, patch, *args, **opts):
2581 def new(ui, repo, patch, *args, **opts):
@@ -2624,7 +2624,7 b' def new(ui, repo, patch, *args, **opts):'
2624 _('add/update date field in patch with current date')),
2624 _('add/update date field in patch with current date')),
2625 ('d', 'date', '',
2625 ('d', 'date', '',
2626 _('add/update date field in patch with given date'), _('DATE'))
2626 _('add/update date field in patch with given date'), _('DATE'))
2627 ] + commands.walkopts + commands.commitopts,
2627 ] + cmdutil.walkopts + cmdutil.commitopts,
2628 _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'),
2628 _('hg qrefresh [-I] [-X] [-e] [-m TEXT] [-l FILE] [-s] [FILE]...'),
2629 inferrepo=True)
2629 inferrepo=True)
2630 def refresh(ui, repo, *pats, **opts):
2630 def refresh(ui, repo, *pats, **opts):
@@ -2657,7 +2657,7 b' def refresh(ui, repo, *pats, **opts):'
2657 return ret
2657 return ret
2658
2658
2659 @command("^qdiff",
2659 @command("^qdiff",
2660 commands.diffopts + commands.diffopts2 + commands.walkopts,
2660 cmdutil.diffopts + cmdutil.diffopts2 + cmdutil.walkopts,
2661 _('hg qdiff [OPTION]... [FILE]...'),
2661 _('hg qdiff [OPTION]... [FILE]...'),
2662 inferrepo=True)
2662 inferrepo=True)
2663 def diff(ui, repo, *pats, **opts):
2663 def diff(ui, repo, *pats, **opts):
@@ -2682,7 +2682,7 b' def diff(ui, repo, *pats, **opts):'
2682 @command('qfold',
2682 @command('qfold',
2683 [('e', 'edit', None, _('invoke editor on commit messages')),
2683 [('e', 'edit', None, _('invoke editor on commit messages')),
2684 ('k', 'keep', None, _('keep folded patch files')),
2684 ('k', 'keep', None, _('keep folded patch files')),
2685 ] + commands.commitopts,
2685 ] + cmdutil.commitopts,
2686 _('hg qfold [-e] [-k] [-m TEXT] [-l FILE] PATCH...'))
2686 _('hg qfold [-e] [-k] [-m TEXT] [-l FILE] PATCH...'))
2687 def fold(ui, repo, *files, **opts):
2687 def fold(ui, repo, *files, **opts):
2688 """fold the named patches into the current patch
2688 """fold the named patches into the current patch
@@ -3044,7 +3044,7 b' def restore(ui, repo, rev, **opts):'
3044 ('n', 'name', '',
3044 ('n', 'name', '',
3045 _('copy directory name'), _('NAME')),
3045 _('copy directory name'), _('NAME')),
3046 ('e', 'empty', None, _('clear queue status file')),
3046 ('e', 'empty', None, _('clear queue status file')),
3047 ('f', 'force', None, _('force copy'))] + commands.commitopts,
3047 ('f', 'force', None, _('force copy'))] + cmdutil.commitopts,
3048 _('hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]'))
3048 _('hg qsave [-m TEXT] [-l FILE] [-c] [-n NAME] [-e] [-f]'))
3049 def save(ui, repo, **opts):
3049 def save(ui, repo, **opts):
3050 """save current queue state (DEPRECATED)
3050 """save current queue state (DEPRECATED)
@@ -450,7 +450,7 b' emailopts = ['
450 ('', 'base', [], _('a base changeset to specify instead of a destination '
450 ('', 'base', [], _('a base changeset to specify instead of a destination '
451 '(with -b/--bundle)'), _('REV')),
451 '(with -b/--bundle)'), _('REV')),
452 ('', 'intro', None, _('send an introduction email for a single patch')),
452 ('', 'intro', None, _('send an introduction email for a single patch')),
453 ] + emailopts + commands.remoteopts,
453 ] + emailopts + cmdutil.remoteopts,
454 _('hg email [OPTION]... [DEST]...'))
454 _('hg email [OPTION]... [DEST]...'))
455 def email(ui, repo, *revs, **opts):
455 def email(ui, repo, *revs, **opts):
456 '''send changesets by email
456 '''send changesets by email
@@ -29,7 +29,7 b' import os'
29
29
30 from mercurial.i18n import _
30 from mercurial.i18n import _
31 from mercurial import (
31 from mercurial import (
32 commands,
32 cmdutil,
33 error,
33 error,
34 registrar,
34 registrar,
35 scmutil,
35 scmutil,
@@ -52,7 +52,7 b" testedwith = 'ships-with-hg-core'"
52 ('p', 'print', None, _('print filenames instead of deleting them')),
52 ('p', 'print', None, _('print filenames instead of deleting them')),
53 ('0', 'print0', None, _('end filenames with NUL, for use with xargs'
53 ('0', 'print0', None, _('end filenames with NUL, for use with xargs'
54 ' (implies -p/--print)')),
54 ' (implies -p/--print)')),
55 ] + commands.walkopts,
55 ] + cmdutil.walkopts,
56 _('hg purge [OPTION]... [DIR]...'))
56 _('hg purge [OPTION]... [DIR]...'))
57 def purge(ui, repo, *dirs, **opts):
57 def purge(ui, repo, *dirs, **opts):
58 '''removes files not tracked by Mercurial
58 '''removes files not tracked by Mercurial
@@ -52,7 +52,7 b' from mercurial import ('
52 )
52 )
53
53
54 release = lock.release
54 release = lock.release
55 templateopts = commands.templateopts
55 templateopts = cmdutil.templateopts
56
56
57 # The following constants are used throughout the rebase module. The ordering of
57 # The following constants are used throughout the rebase module. The ordering of
58 # their values must be maintained.
58 # their values must be maintained.
@@ -33,7 +33,7 b" testedwith = 'ships-with-hg-core'"
33 @command("record",
33 @command("record",
34 # same options as commit + white space diff options
34 # same options as commit + white space diff options
35 [c for c in commands.table['^commit|ci'][1][:]
35 [c for c in commands.table['^commit|ci'][1][:]
36 if c[1] != "interactive"] + commands.diffwsopts,
36 if c[1] != "interactive"] + cmdutil.diffwsopts,
37 _('hg record [OPTION]... [FILE]...'))
37 _('hg record [OPTION]... [FILE]...'))
38 def record(ui, repo, *pats, **opts):
38 def record(ui, repo, *pats, **opts):
39 '''interactively select changes to commit
39 '''interactively select changes to commit
@@ -136,7 +136,7 b' def uisetup(ui):'
136 (qrecord,
136 (qrecord,
137 # same options as qnew, but copy them so we don't get
137 # same options as qnew, but copy them so we don't get
138 # -i/--interactive for qrecord and add white space diff options
138 # -i/--interactive for qrecord and add white space diff options
139 mq.cmdtable['^qnew'][1][:] + commands.diffwsopts,
139 mq.cmdtable['^qnew'][1][:] + cmdutil.diffwsopts,
140 _('hg qrecord [OPTION]... PATCH [FILE]...'))
140 _('hg qrecord [OPTION]... PATCH [FILE]...'))
141
141
142 _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
142 _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch"))
@@ -33,7 +33,6 b' from mercurial import ('
33 bundlerepo,
33 bundlerepo,
34 changegroup,
34 changegroup,
35 cmdutil,
35 cmdutil,
36 commands,
37 error,
36 error,
38 exchange,
37 exchange,
39 hg,
38 hg,
@@ -971,7 +970,7 b' def _dounshelve(ui, repo, *shelved, **op'
971 ('i', 'interactive', None,
970 ('i', 'interactive', None,
972 _('interactive mode, only works while creating a shelve')),
971 _('interactive mode, only works while creating a shelve')),
973 ('', 'stat', None,
972 ('', 'stat', None,
974 _('output diffstat-style summary of changes'))] + commands.walkopts,
973 _('output diffstat-style summary of changes'))] + cmdutil.walkopts,
975 _('hg shelve [OPTION]... [FILE]...'))
974 _('hg shelve [OPTION]... [FILE]...'))
976 def shelvecmd(ui, repo, *pats, **opts):
975 def shelvecmd(ui, repo, *pats, **opts):
977 '''save and set aside changes from the working directory
976 '''save and set aside changes from the working directory
@@ -58,7 +58,7 b' class showcmdfunc(registrar._funcregistr'
58 showview = showcmdfunc()
58 showview = showcmdfunc()
59
59
60 @command('show', [
60 @command('show', [
61 # TODO: Switch this template flag to use commands.formatteropts if
61 # TODO: Switch this template flag to use cmdutil.formatteropts if
62 # 'hg show' becomes stable before --template/-T is stable. For now,
62 # 'hg show' becomes stable before --template/-T is stable. For now,
63 # we are putting it here without the '(EXPERIMENTAL)' flag because it
63 # we are putting it here without the '(EXPERIMENTAL)' flag because it
64 # is an important part of the 'hg show' user experience and the entire
64 # is an important part of the 'hg show' user experience and the entire
@@ -51,6 +51,113 b' from . import ('
51 )
51 )
52 stringio = util.stringio
52 stringio = util.stringio
53
53
54 # templates of common command options
55
56 dryrunopts = [
57 ('n', 'dry-run', None,
58 _('do not perform actions, just print output')),
59 ]
60
61 remoteopts = [
62 ('e', 'ssh', '',
63 _('specify ssh command to use'), _('CMD')),
64 ('', 'remotecmd', '',
65 _('specify hg command to run on the remote side'), _('CMD')),
66 ('', 'insecure', None,
67 _('do not verify server certificate (ignoring web.cacerts config)')),
68 ]
69
70 walkopts = [
71 ('I', 'include', [],
72 _('include names matching the given patterns'), _('PATTERN')),
73 ('X', 'exclude', [],
74 _('exclude names matching the given patterns'), _('PATTERN')),
75 ]
76
77 commitopts = [
78 ('m', 'message', '',
79 _('use text as commit message'), _('TEXT')),
80 ('l', 'logfile', '',
81 _('read commit message from file'), _('FILE')),
82 ]
83
84 commitopts2 = [
85 ('d', 'date', '',
86 _('record the specified date as commit date'), _('DATE')),
87 ('u', 'user', '',
88 _('record the specified user as committer'), _('USER')),
89 ]
90
91 # hidden for now
92 formatteropts = [
93 ('T', 'template', '',
94 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
95 ]
96
97 templateopts = [
98 ('', 'style', '',
99 _('display using template map file (DEPRECATED)'), _('STYLE')),
100 ('T', 'template', '',
101 _('display with template'), _('TEMPLATE')),
102 ]
103
104 logopts = [
105 ('p', 'patch', None, _('show patch')),
106 ('g', 'git', None, _('use git extended diff format')),
107 ('l', 'limit', '',
108 _('limit number of changes displayed'), _('NUM')),
109 ('M', 'no-merges', None, _('do not show merges')),
110 ('', 'stat', None, _('output diffstat-style summary of changes')),
111 ('G', 'graph', None, _("show the revision DAG")),
112 ] + templateopts
113
114 diffopts = [
115 ('a', 'text', None, _('treat all files as text')),
116 ('g', 'git', None, _('use git extended diff format')),
117 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
118 ('', 'nodates', None, _('omit dates from diff headers'))
119 ]
120
121 diffwsopts = [
122 ('w', 'ignore-all-space', None,
123 _('ignore white space when comparing lines')),
124 ('b', 'ignore-space-change', None,
125 _('ignore changes in the amount of white space')),
126 ('B', 'ignore-blank-lines', None,
127 _('ignore changes whose lines are all blank')),
128 ]
129
130 diffopts2 = [
131 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
132 ('p', 'show-function', None, _('show which function each change is in')),
133 ('', 'reverse', None, _('produce a diff that undoes the changes')),
134 ] + diffwsopts + [
135 ('U', 'unified', '',
136 _('number of lines of context to show'), _('NUM')),
137 ('', 'stat', None, _('output diffstat-style summary of changes')),
138 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
139 ]
140
141 mergetoolopts = [
142 ('t', 'tool', '', _('specify merge tool')),
143 ]
144
145 similarityopts = [
146 ('s', 'similarity', '',
147 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
148 ]
149
150 subrepoopts = [
151 ('S', 'subrepos', None,
152 _('recurse into subrepositories'))
153 ]
154
155 debugrevlogopts = [
156 ('c', 'changelog', False, _('open changelog')),
157 ('m', 'manifest', False, _('open manifest')),
158 ('', 'dir', '', _('open directory manifest')),
159 ]
160
54 # special string such that everything below this line will be ingored in the
161 # special string such that everything below this line will be ingored in the
55 # editor text
162 # editor text
56 _linebelow = "^HG: ------------------------ >8 ------------------------$"
163 _linebelow = "^HG: ------------------------ >8 ------------------------$"
@@ -104,108 +104,21 b' globalopts = ['
104 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
104 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
105 ]
105 ]
106
106
107 dryrunopts = [('n', 'dry-run', None,
107 dryrunopts = cmdutil.dryrunopts
108 _('do not perform actions, just print output'))]
108 remoteopts = cmdutil.remoteopts
109
109 walkopts = cmdutil.walkopts
110 remoteopts = [
110 commitopts = cmdutil.commitopts
111 ('e', 'ssh', '',
111 commitopts2 = cmdutil.commitopts2
112 _('specify ssh command to use'), _('CMD')),
112 formatteropts = cmdutil.formatteropts
113 ('', 'remotecmd', '',
113 templateopts = cmdutil.templateopts
114 _('specify hg command to run on the remote side'), _('CMD')),
114 logopts = cmdutil.logopts
115 ('', 'insecure', None,
115 diffopts = cmdutil.diffopts
116 _('do not verify server certificate (ignoring web.cacerts config)')),
116 diffwsopts = cmdutil.diffwsopts
117 ]
117 diffopts2 = cmdutil.diffopts2
118
118 mergetoolopts = cmdutil.mergetoolopts
119 walkopts = [
119 similarityopts = cmdutil.similarityopts
120 ('I', 'include', [],
120 subrepoopts = cmdutil.subrepoopts
121 _('include names matching the given patterns'), _('PATTERN')),
121 debugrevlogopts = cmdutil.debugrevlogopts
122 ('X', 'exclude', [],
123 _('exclude names matching the given patterns'), _('PATTERN')),
124 ]
125
126 commitopts = [
127 ('m', 'message', '',
128 _('use text as commit message'), _('TEXT')),
129 ('l', 'logfile', '',
130 _('read commit message from file'), _('FILE')),
131 ]
132
133 commitopts2 = [
134 ('d', 'date', '',
135 _('record the specified date as commit date'), _('DATE')),
136 ('u', 'user', '',
137 _('record the specified user as committer'), _('USER')),
138 ]
139
140 # hidden for now
141 formatteropts = [
142 ('T', 'template', '',
143 _('display with template (EXPERIMENTAL)'), _('TEMPLATE')),
144 ]
145
146 templateopts = [
147 ('', 'style', '',
148 _('display using template map file (DEPRECATED)'), _('STYLE')),
149 ('T', 'template', '',
150 _('display with template'), _('TEMPLATE')),
151 ]
152
153 logopts = [
154 ('p', 'patch', None, _('show patch')),
155 ('g', 'git', None, _('use git extended diff format')),
156 ('l', 'limit', '',
157 _('limit number of changes displayed'), _('NUM')),
158 ('M', 'no-merges', None, _('do not show merges')),
159 ('', 'stat', None, _('output diffstat-style summary of changes')),
160 ('G', 'graph', None, _("show the revision DAG")),
161 ] + templateopts
162
163 diffopts = [
164 ('a', 'text', None, _('treat all files as text')),
165 ('g', 'git', None, _('use git extended diff format')),
166 ('', 'binary', None, _('generate binary diffs in git mode (default)')),
167 ('', 'nodates', None, _('omit dates from diff headers'))
168 ]
169
170 diffwsopts = [
171 ('w', 'ignore-all-space', None,
172 _('ignore white space when comparing lines')),
173 ('b', 'ignore-space-change', None,
174 _('ignore changes in the amount of white space')),
175 ('B', 'ignore-blank-lines', None,
176 _('ignore changes whose lines are all blank')),
177 ]
178
179 diffopts2 = [
180 ('', 'noprefix', None, _('omit a/ and b/ prefixes from filenames')),
181 ('p', 'show-function', None, _('show which function each change is in')),
182 ('', 'reverse', None, _('produce a diff that undoes the changes')),
183 ] + diffwsopts + [
184 ('U', 'unified', '',
185 _('number of lines of context to show'), _('NUM')),
186 ('', 'stat', None, _('output diffstat-style summary of changes')),
187 ('', 'root', '', _('produce diffs relative to subdirectory'), _('DIR')),
188 ]
189
190 mergetoolopts = [
191 ('t', 'tool', '', _('specify merge tool')),
192 ]
193
194 similarityopts = [
195 ('s', 'similarity', '',
196 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
197 ]
198
199 subrepoopts = [
200 ('S', 'subrepos', None,
201 _('recurse into subrepositories'))
202 ]
203
204 debugrevlogopts = [
205 ('c', 'changelog', False, _('open changelog')),
206 ('m', 'manifest', False, _('open manifest')),
207 ('', 'dir', '', _('open directory manifest')),
208 ]
209
122
210 # Commands start here, listed alphabetically
123 # Commands start here, listed alphabetically
211
124
@@ -501,7 +501,7 b' def debugdag(ui, repo, file_=None, *revs'
501 ui.write(line)
501 ui.write(line)
502 ui.write("\n")
502 ui.write("\n")
503
503
504 @command('debugdata', commands.debugrevlogopts, _('-c|-m|FILE REV'))
504 @command('debugdata', cmdutil.debugrevlogopts, _('-c|-m|FILE REV'))
505 def debugdata(ui, repo, file_, rev=None, **opts):
505 def debugdata(ui, repo, file_, rev=None, **opts):
506 """dump the contents of a data file revision"""
506 """dump the contents of a data file revision"""
507 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
507 if opts.get('changelog') or opts.get('manifest') or opts.get('dir'):
@@ -533,7 +533,7 b' def debugdate(ui, date, range=None, **op'
533 ui.write(("match: %s\n") % m(d[0]))
533 ui.write(("match: %s\n") % m(d[0]))
534
534
535 @command('debugdeltachain',
535 @command('debugdeltachain',
536 commands.debugrevlogopts + commands.formatteropts,
536 cmdutil.debugrevlogopts + cmdutil.formatteropts,
537 _('-c|-m|FILE'),
537 _('-c|-m|FILE'),
538 optionalrepo=True)
538 optionalrepo=True)
539 def debugdeltachain(ui, repo, file_=None, **opts):
539 def debugdeltachain(ui, repo, file_=None, **opts):
@@ -668,7 +668,7 b' def debugstate(ui, repo, **opts):'
668 [('', 'old', None, _('use old-style discovery')),
668 [('', 'old', None, _('use old-style discovery')),
669 ('', 'nonheads', None,
669 ('', 'nonheads', None,
670 _('use old-style discovery with non-heads included')),
670 _('use old-style discovery with non-heads included')),
671 ] + commands.remoteopts,
671 ] + cmdutil.remoteopts,
672 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
672 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
673 def debugdiscovery(ui, repo, remoteurl="default", **opts):
673 def debugdiscovery(ui, repo, remoteurl="default", **opts):
674 """runs the changeset discovery protocol in isolation"""
674 """runs the changeset discovery protocol in isolation"""
@@ -730,7 +730,7 b' def debugdiscovery(ui, repo, remoteurl="'
730 localrevs = opts.get('local_head')
730 localrevs = opts.get('local_head')
731 doit(localrevs, remoterevs)
731 doit(localrevs, remoterevs)
732
732
733 @command('debugextensions', commands.formatteropts, [], norepo=True)
733 @command('debugextensions', cmdutil.formatteropts, [], norepo=True)
734 def debugextensions(ui, **opts):
734 def debugextensions(ui, **opts):
735 '''show information about active extensions'''
735 '''show information about active extensions'''
736 exts = extensions.extensions(ui)
736 exts = extensions.extensions(ui)
@@ -882,7 +882,7 b' def debugignore(ui, repo, *files, **opts'
882 else:
882 else:
883 ui.write(_("%s is not ignored\n") % f)
883 ui.write(_("%s is not ignored\n") % f)
884
884
885 @command('debugindex', commands.debugrevlogopts +
885 @command('debugindex', cmdutil.debugrevlogopts +
886 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
886 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
887 _('[-f FORMAT] -c|-m|FILE'),
887 _('[-f FORMAT] -c|-m|FILE'),
888 optionalrepo=True)
888 optionalrepo=True)
@@ -938,7 +938,7 b' def debugindex(ui, repo, file_=None, **o'
938 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
938 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
939 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
939 base, r.linkrev(i), pr[0], pr[1], shortfn(node)))
940
940
941 @command('debugindexdot', commands.debugrevlogopts,
941 @command('debugindexdot', cmdutil.debugrevlogopts,
942 _('-c|-m|FILE'), optionalrepo=True)
942 _('-c|-m|FILE'), optionalrepo=True)
943 def debugindexdot(ui, repo, file_=None, **opts):
943 def debugindexdot(ui, repo, file_=None, **opts):
944 """dump an index DAG as a graphviz dot file"""
944 """dump an index DAG as a graphviz dot file"""
@@ -952,7 +952,7 b' def debugindexdot(ui, repo, file_=None, '
952 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
952 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
953 ui.write("}\n")
953 ui.write("}\n")
954
954
955 @command('debuginstall', [] + commands.formatteropts, '', norepo=True)
955 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
956 def debuginstall(ui, **opts):
956 def debuginstall(ui, **opts):
957 '''test Mercurial installation
957 '''test Mercurial installation
958
958
@@ -1335,7 +1335,7 b' def debugnamecomplete(ui, repo, *args):'
1335 ('r', 'rev', [], _('display markers relevant to REV')),
1335 ('r', 'rev', [], _('display markers relevant to REV')),
1336 ('', 'index', False, _('display index of the marker')),
1336 ('', 'index', False, _('display index of the marker')),
1337 ('', 'delete', [], _('delete markers specified by indices')),
1337 ('', 'delete', [], _('delete markers specified by indices')),
1338 ] + commands.commitopts2 + commands.formatteropts,
1338 ] + cmdutil.commitopts2 + cmdutil.formatteropts,
1339 _('[OBSOLETED [REPLACEMENT ...]]'))
1339 _('[OBSOLETED [REPLACEMENT ...]]'))
1340 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1340 def debugobsolete(ui, repo, precursor=None, *successors, **opts):
1341 """create arbitrary obsolete marker
1341 """create arbitrary obsolete marker
@@ -1507,7 +1507,7 b' def debugpathcomplete(ui, repo, *specs, '
1507 @command('debugpickmergetool',
1507 @command('debugpickmergetool',
1508 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1508 [('r', 'rev', '', _('check for files in this revision'), _('REV')),
1509 ('', 'changedelete', None, _('emulate merging change and delete')),
1509 ('', 'changedelete', None, _('emulate merging change and delete')),
1510 ] + commands.walkopts + commands.mergetoolopts,
1510 ] + cmdutil.walkopts + cmdutil.mergetoolopts,
1511 _('[PATTERN]...'),
1511 _('[PATTERN]...'),
1512 inferrepo=True)
1512 inferrepo=True)
1513 def debugpickmergetool(ui, repo, *pats, **opts):
1513 def debugpickmergetool(ui, repo, *pats, **opts):
@@ -1684,7 +1684,7 b' def debugrename(ui, repo, file1, *pats, '
1684 else:
1684 else:
1685 ui.write(_("%s not renamed\n") % rel)
1685 ui.write(_("%s not renamed\n") % rel)
1686
1686
1687 @command('debugrevlog', commands.debugrevlogopts +
1687 @command('debugrevlog', cmdutil.debugrevlogopts +
1688 [('d', 'dump', False, _('dump index data'))],
1688 [('d', 'dump', False, _('dump index data'))],
1689 _('-c|-m|FILE'),
1689 _('-c|-m|FILE'),
1690 optionalrepo=True)
1690 optionalrepo=True)
@@ -2163,7 +2163,7 b' def debugupgraderepo(ui, repo, run=False'
2163 """
2163 """
2164 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2164 return upgrade.upgraderepo(ui, repo, run=run, optimize=optimize)
2165
2165
2166 @command('debugwalk', commands.walkopts, _('[OPTION]... [FILE]...'),
2166 @command('debugwalk', cmdutil.walkopts, _('[OPTION]... [FILE]...'),
2167 inferrepo=True)
2167 inferrepo=True)
2168 def debugwalk(ui, repo, *pats, **opts):
2168 def debugwalk(ui, repo, *pats, **opts):
2169 """show how files match on given patterns"""
2169 """show how files match on given patterns"""
@@ -2185,12 +2185,12 b' def debugwalk(ui, repo, *pats, **opts):'
2185 [('', 'three', '', 'three'),
2185 [('', 'three', '', 'three'),
2186 ('', 'four', '', 'four'),
2186 ('', 'four', '', 'four'),
2187 ('', 'five', '', 'five'),
2187 ('', 'five', '', 'five'),
2188 ] + commands.remoteopts,
2188 ] + cmdutil.remoteopts,
2189 _('REPO [OPTIONS]... [ONE [TWO]]'),
2189 _('REPO [OPTIONS]... [ONE [TWO]]'),
2190 norepo=True)
2190 norepo=True)
2191 def debugwireargs(ui, repopath, *vals, **opts):
2191 def debugwireargs(ui, repopath, *vals, **opts):
2192 repo = hg.peer(ui, opts, repopath)
2192 repo = hg.peer(ui, opts, repopath)
2193 for opt in commands.remoteopts:
2193 for opt in cmdutil.remoteopts:
2194 del opts[opt[1]]
2194 del opts[opt[1]]
2195 args = {}
2195 args = {}
2196 for k, v in opts.iteritems():
2196 for k, v in opts.iteritems():
General Comments 0
You need to be logged in to leave comments. Login now