##// END OF EJS Templates
commands: use a decorator to build table incrementally...
Adrian Buehlmann -
r14297:2daa5179 default
parent child Browse files
Show More
@@ -1251,3 +1251,18 b' def commitforceeditor(repo, ctx, subs):'
1251 raise util.Abort(_("empty commit message"))
1251 raise util.Abort(_("empty commit message"))
1252
1252
1253 return text
1253 return text
1254
1255 def command(table):
1256 '''returns a function object bound to table which can be used as
1257 a decorator for populating table as a command table'''
1258
1259 def cmd(name, options, synopsis=None):
1260 def decorator(func):
1261 if synopsis:
1262 table[name] = func, options, synopsis
1263 else:
1264 table[name] = func, options
1265 return func
1266 return decorator
1267
1268 return cmd
This diff has been collapsed as it changes many lines, (1202 lines changed) Show them Hide them
@@ -17,8 +17,122 b' import minirst, revset, templatefilters'
17 import dagparser, context, simplemerge
17 import dagparser, context, simplemerge
18 import random, setdiscovery, treediscovery, dagutil
18 import random, setdiscovery, treediscovery, dagutil
19
19
20 table = {}
21
22 command = cmdutil.command(table)
23
24 # common command options
25
26 globalopts = [
27 ('R', 'repository', '',
28 _('repository root directory or name of overlay bundle file'),
29 _('REPO')),
30 ('', 'cwd', '',
31 _('change working directory'), _('DIR')),
32 ('y', 'noninteractive', None,
33 _('do not prompt, assume \'yes\' for any required answers')),
34 ('q', 'quiet', None, _('suppress output')),
35 ('v', 'verbose', None, _('enable additional output')),
36 ('', 'config', [],
37 _('set/override config option (use \'section.name=value\')'),
38 _('CONFIG')),
39 ('', 'debug', None, _('enable debugging output')),
40 ('', 'debugger', None, _('start debugger')),
41 ('', 'encoding', encoding.encoding, _('set the charset encoding'),
42 _('ENCODE')),
43 ('', 'encodingmode', encoding.encodingmode,
44 _('set the charset encoding mode'), _('MODE')),
45 ('', 'traceback', None, _('always print a traceback on exception')),
46 ('', 'time', None, _('time how long the command takes')),
47 ('', 'profile', None, _('print command execution profile')),
48 ('', 'version', None, _('output version information and exit')),
49 ('h', 'help', None, _('display help and exit')),
50 ]
51
52 dryrunopts = [('n', 'dry-run', None,
53 _('do not perform actions, just print output'))]
54
55 remoteopts = [
56 ('e', 'ssh', '',
57 _('specify ssh command to use'), _('CMD')),
58 ('', 'remotecmd', '',
59 _('specify hg command to run on the remote side'), _('CMD')),
60 ('', 'insecure', None,
61 _('do not verify server certificate (ignoring web.cacerts config)')),
62 ]
63
64 walkopts = [
65 ('I', 'include', [],
66 _('include names matching the given patterns'), _('PATTERN')),
67 ('X', 'exclude', [],
68 _('exclude names matching the given patterns'), _('PATTERN')),
69 ]
70
71 commitopts = [
72 ('m', 'message', '',
73 _('use text as commit message'), _('TEXT')),
74 ('l', 'logfile', '',
75 _('read commit message from file'), _('FILE')),
76 ]
77
78 commitopts2 = [
79 ('d', 'date', '',
80 _('record the specified date as commit date'), _('DATE')),
81 ('u', 'user', '',
82 _('record the specified user as committer'), _('USER')),
83 ]
84
85 templateopts = [
86 ('', 'style', '',
87 _('display using template map file'), _('STYLE')),
88 ('', 'template', '',
89 _('display with template'), _('TEMPLATE')),
90 ]
91
92 logopts = [
93 ('p', 'patch', None, _('show patch')),
94 ('g', 'git', None, _('use git extended diff format')),
95 ('l', 'limit', '',
96 _('limit number of changes displayed'), _('NUM')),
97 ('M', 'no-merges', None, _('do not show merges')),
98 ('', 'stat', None, _('output diffstat-style summary of changes')),
99 ] + templateopts
100
101 diffopts = [
102 ('a', 'text', None, _('treat all files as text')),
103 ('g', 'git', None, _('use git extended diff format')),
104 ('', 'nodates', None, _('omit dates from diff headers'))
105 ]
106
107 diffopts2 = [
108 ('p', 'show-function', None, _('show which function each change is in')),
109 ('', 'reverse', None, _('produce a diff that undoes the changes')),
110 ('w', 'ignore-all-space', None,
111 _('ignore white space when comparing lines')),
112 ('b', 'ignore-space-change', None,
113 _('ignore changes in the amount of white space')),
114 ('B', 'ignore-blank-lines', None,
115 _('ignore changes whose lines are all blank')),
116 ('U', 'unified', '',
117 _('number of lines of context to show'), _('NUM')),
118 ('', 'stat', None, _('output diffstat-style summary of changes')),
119 ]
120
121 similarityopts = [
122 ('s', 'similarity', '',
123 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
124 ]
125
126 subrepoopts = [
127 ('S', 'subrepos', None,
128 _('recurse into subrepositories'))
129 ]
130
20 # Commands start here, listed alphabetically
131 # Commands start here, listed alphabetically
21
132
133 @command('^add',
134 walkopts + subrepoopts + dryrunopts,
135 _('[OPTION]... [FILE]...'))
22 def add(ui, repo, *pats, **opts):
136 def add(ui, repo, *pats, **opts):
23 """add the specified files on the next commit
137 """add the specified files on the next commit
24
138
@@ -52,6 +166,9 b' def add(ui, repo, *pats, **opts):'
52 opts.get('subrepos'), prefix="")
166 opts.get('subrepos'), prefix="")
53 return rejected and 1 or 0
167 return rejected and 1 or 0
54
168
169 @command('addremove',
170 similarityopts + walkopts + dryrunopts,
171 _('[OPTION]... [FILE]...'))
55 def addremove(ui, repo, *pats, **opts):
172 def addremove(ui, repo, *pats, **opts):
56 """add all new files, delete all missing files
173 """add all new files, delete all missing files
57
174
@@ -80,6 +197,20 b' def addremove(ui, repo, *pats, **opts):'
80 raise util.Abort(_('similarity must be between 0 and 100'))
197 raise util.Abort(_('similarity must be between 0 and 100'))
81 return cmdutil.addremove(repo, pats, opts, similarity=sim / 100.0)
198 return cmdutil.addremove(repo, pats, opts, similarity=sim / 100.0)
82
199
200 @command('^annotate|blame',
201 [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
202 ('', 'follow', None,
203 _('follow copies/renames and list the filename (DEPRECATED)')),
204 ('', 'no-follow', None, _("don't follow copies and renames")),
205 ('a', 'text', None, _('treat all files as text')),
206 ('u', 'user', None, _('list the author (long with -v)')),
207 ('f', 'file', None, _('list the filename')),
208 ('d', 'date', None, _('list the date (short with -q)')),
209 ('n', 'number', None, _('list the revision number (default)')),
210 ('c', 'changeset', None, _('list the changeset')),
211 ('l', 'line-number', None, _('show line number at the first appearance'))
212 ] + walkopts,
213 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'))
83 def annotate(ui, repo, *pats, **opts):
214 def annotate(ui, repo, *pats, **opts):
84 """show changeset information by line for each file
215 """show changeset information by line for each file
85
216
@@ -154,6 +285,14 b' def annotate(ui, repo, *pats, **opts):'
154 for p, l in zip(zip(*pieces), lines):
285 for p, l in zip(zip(*pieces), lines):
155 ui.write("%s: %s" % (" ".join(p), l[1]))
286 ui.write("%s: %s" % (" ".join(p), l[1]))
156
287
288 @command('archive',
289 [('', 'no-decode', None, _('do not pass files through decoders')),
290 ('p', 'prefix', '', _('directory prefix for files in archive'),
291 _('PREFIX')),
292 ('r', 'rev', '', _('revision to distribute'), _('REV')),
293 ('t', 'type', '', _('type of distribution to create'), _('TYPE')),
294 ] + subrepoopts + walkopts,
295 _('[OPTION]... DEST'))
157 def archive(ui, repo, dest, **opts):
296 def archive(ui, repo, dest, **opts):
158 '''create an unversioned archive of a repository revision
297 '''create an unversioned archive of a repository revision
159
298
@@ -206,6 +345,13 b' def archive(ui, repo, dest, **opts):'
206 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
345 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
207 matchfn, prefix, subrepos=opts.get('subrepos'))
346 matchfn, prefix, subrepos=opts.get('subrepos'))
208
347
348 @command('backout',
349 [('', 'merge', None, _('merge with old dirstate parent after backout')),
350 ('', 'parent', '', _('parent to choose when backing out merge'), _('REV')),
351 ('t', 'tool', '', _('specify merge tool')),
352 ('r', 'rev', '', _('revision to backout'), _('REV')),
353 ] + walkopts + commitopts + commitopts2,
354 _('[OPTION]... [-r] REV'))
209 def backout(ui, repo, node=None, rev=None, **opts):
355 def backout(ui, repo, node=None, rev=None, **opts):
210 '''reverse effect of earlier changeset
356 '''reverse effect of earlier changeset
211
357
@@ -307,6 +453,15 b' def backout(ui, repo, node=None, rev=Non'
307 ui.setconfig('ui', 'forcemerge', '')
453 ui.setconfig('ui', 'forcemerge', '')
308 return 0
454 return 0
309
455
456 @command('bisect',
457 [('r', 'reset', False, _('reset bisect state')),
458 ('g', 'good', False, _('mark changeset good')),
459 ('b', 'bad', False, _('mark changeset bad')),
460 ('s', 'skip', False, _('skip testing changeset')),
461 ('e', 'extend', False, _('extend the bisect range')),
462 ('c', 'command', '', _('use command to check changeset state'), _('CMD')),
463 ('U', 'noupdate', False, _('do not update to target'))],
464 _("[-gbsr] [-U] [-c CMD] [REV]"))
310 def bisect(ui, repo, rev=None, extra=None, command=None,
465 def bisect(ui, repo, rev=None, extra=None, command=None,
311 reset=None, good=None, bad=None, skip=None, extend=None,
466 reset=None, good=None, bad=None, skip=None, extend=None,
312 noupdate=None):
467 noupdate=None):
@@ -483,6 +638,13 b' def bisect(ui, repo, rev=None, extra=Non'
483 cmdutil.bailifchanged(repo)
638 cmdutil.bailifchanged(repo)
484 return hg.clean(repo, node)
639 return hg.clean(repo, node)
485
640
641 @command('bookmarks',
642 [('f', 'force', False, _('force')),
643 ('r', 'rev', '', _('revision'), _('REV')),
644 ('d', 'delete', False, _('delete a given bookmark')),
645 ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
646 ('i', 'inactive', False, _('do not mark a new bookmark active'))],
647 _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]'))
486 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False,
648 def bookmark(ui, repo, mark=None, rev=None, force=False, delete=False,
487 rename=None, inactive=False):
649 rename=None, inactive=False):
488 '''track a line of development with movable markers
650 '''track a line of development with movable markers
@@ -579,6 +741,11 b' def bookmark(ui, repo, mark=None, rev=No'
579 label=label)
741 label=label)
580 return
742 return
581
743
744 @command('branch',
745 [('f', 'force', None,
746 _('set branch name even if it shadows an existing branch')),
747 ('C', 'clean', None, _('reset branch name to parent branch name'))],
748 _('[-fC] [NAME]'))
582 def branch(ui, repo, label=None, **opts):
749 def branch(ui, repo, label=None, **opts):
583 """set or show the current branch name
750 """set or show the current branch name
584
751
@@ -616,6 +783,10 b' def branch(ui, repo, label=None, **opts)'
616 else:
783 else:
617 ui.write("%s\n" % repo.dirstate.branch())
784 ui.write("%s\n" % repo.dirstate.branch())
618
785
786 @command('branches',
787 [('a', 'active', False, _('show only branches that have unmerged heads')),
788 ('c', 'closed', False, _('show normal and closed branches'))],
789 _('[-ac]'))
619 def branches(ui, repo, active=False, closed=False):
790 def branches(ui, repo, active=False, closed=False):
620 """list repository named branches
791 """list repository named branches
621
792
@@ -665,6 +836,19 b' def branches(ui, repo, active=False, clo'
665 tag = ui.label(tag, label)
836 tag = ui.label(tag, label)
666 ui.write("%s %s%s\n" % (tag, rev, notice))
837 ui.write("%s %s%s\n" % (tag, rev, notice))
667
838
839 @command('bundle',
840 [('f', 'force', None, _('run even when the destination is unrelated')),
841 ('r', 'rev', [], _('a changeset intended to be added to the destination'),
842 _('REV')),
843 ('b', 'branch', [], _('a specific branch you would like to bundle'),
844 _('BRANCH')),
845 ('', 'base', [],
846 _('a base changeset assumed to be available at the destination'),
847 _('REV')),
848 ('a', 'all', None, _('bundle all changesets in the repository')),
849 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
850 ] + remoteopts,
851 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
668 def bundle(ui, repo, fname, dest=None, **opts):
852 def bundle(ui, repo, fname, dest=None, **opts):
669 """create a changegroup file
853 """create a changegroup file
670
854
@@ -727,6 +911,13 b' def bundle(ui, repo, fname, dest=None, *'
727
911
728 changegroup.writebundle(cg, fname, bundletype)
912 changegroup.writebundle(cg, fname, bundletype)
729
913
914 @command('cat',
915 [('o', 'output', '',
916 _('print output to file with formatted name'), _('FORMAT')),
917 ('r', 'rev', '', _('print the given revision'), _('REV')),
918 ('', 'decode', None, _('apply any matching decode filter')),
919 ] + walkopts,
920 _('[OPTION]... FILE...'))
730 def cat(ui, repo, file1, *pats, **opts):
921 def cat(ui, repo, file1, *pats, **opts):
731 """output the current or given revision of files
922 """output the current or given revision of files
732
923
@@ -758,6 +949,16 b' def cat(ui, repo, file1, *pats, **opts):'
758 err = 0
949 err = 0
759 return err
950 return err
760
951
952 @command('^clone',
953 [('U', 'noupdate', None,
954 _('the clone will include an empty working copy (only a repository)')),
955 ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')),
956 ('r', 'rev', [], _('include the specified changeset'), _('REV')),
957 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')),
958 ('', 'pull', None, _('use pull protocol to copy metadata')),
959 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
960 ] + remoteopts,
961 _('[OPTION]... SOURCE [DEST]'))
761 def clone(ui, source, dest=None, **opts):
962 def clone(ui, source, dest=None, **opts):
762 """make a copy of an existing repository
963 """make a copy of an existing repository
763
964
@@ -834,6 +1035,13 b' def clone(ui, source, dest=None, **opts)'
834
1035
835 return r is None
1036 return r is None
836
1037
1038 @command('^commit|ci',
1039 [('A', 'addremove', None,
1040 _('mark new/missing files as added/removed before committing')),
1041 ('', 'close-branch', None,
1042 _('mark a branch as closed, hiding it from the branch list')),
1043 ] + walkopts + commitopts + commitopts2,
1044 _('[OPTION]... [FILE]...'))
837 def commit(ui, repo, *pats, **opts):
1045 def commit(ui, repo, *pats, **opts):
838 """commit the specified files or all outstanding changes
1046 """commit the specified files or all outstanding changes
839
1047
@@ -929,6 +1137,11 b' def commit(ui, repo, *pats, **opts):'
929 elif ui.verbose:
1137 elif ui.verbose:
930 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
1138 ui.write(_('committed changeset %d:%s\n') % (int(ctx), ctx))
931
1139
1140 @command('copy|cp',
1141 [('A', 'after', None, _('record a copy that has already occurred')),
1142 ('f', 'force', None, _('forcibly copy over an existing managed file')),
1143 ] + walkopts + dryrunopts,
1144 _('[OPTION]... [SOURCE]... DEST'))
932 def copy(ui, repo, *pats, **opts):
1145 def copy(ui, repo, *pats, **opts):
933 """mark files as copied for the next commit
1146 """mark files as copied for the next commit
934
1147
@@ -951,6 +1164,7 b' def copy(ui, repo, *pats, **opts):'
951 finally:
1164 finally:
952 wlock.release()
1165 wlock.release()
953
1166
1167 @command('debugancestor', [], _('[INDEX] REV1 REV2'))
954 def debugancestor(ui, repo, *args):
1168 def debugancestor(ui, repo, *args):
955 """find the ancestor revision of two revisions in a given index"""
1169 """find the ancestor revision of two revisions in a given index"""
956 if len(args) == 3:
1170 if len(args) == 3:
@@ -969,6 +1183,11 b' def debugancestor(ui, repo, *args):'
969 a = r.ancestor(lookup(rev1), lookup(rev2))
1183 a = r.ancestor(lookup(rev1), lookup(rev2))
970 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
1184 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
971
1185
1186 @command('debugbuilddag',
1187 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
1188 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
1189 ('n', 'new-file', None, _('add new file at each rev'))],
1190 _('[OPTION]... [TEXT]'))
972 def debugbuilddag(ui, repo, text=None,
1191 def debugbuilddag(ui, repo, text=None,
973 mergeable_file=False,
1192 mergeable_file=False,
974 overwritten_file=False,
1193 overwritten_file=False,
@@ -1111,6 +1330,7 b' def debugbuilddag(ui, repo, text=None,'
1111 if tags:
1330 if tags:
1112 repo.opener.write("localtags", "".join(tags))
1331 repo.opener.write("localtags", "".join(tags))
1113
1332
1333 @command('debugcommands', [], _('[COMMAND]'))
1114 def debugcommands(ui, cmd='', *args):
1334 def debugcommands(ui, cmd='', *args):
1115 """list all available commands and options"""
1335 """list all available commands and options"""
1116 for cmd, vals in sorted(table.iteritems()):
1336 for cmd, vals in sorted(table.iteritems()):
@@ -1118,6 +1338,9 b" def debugcommands(ui, cmd='', *args):"
1118 opts = ', '.join([i[1] for i in vals[1]])
1338 opts = ', '.join([i[1] for i in vals[1]])
1119 ui.write('%s: %s\n' % (cmd, opts))
1339 ui.write('%s: %s\n' % (cmd, opts))
1120
1340
1341 @command('debugcomplete',
1342 [('o', 'options', None, _('show the command options'))],
1343 _('[-o] CMD'))
1121 def debugcomplete(ui, cmd='', **opts):
1344 def debugcomplete(ui, cmd='', **opts):
1122 """returns the completion list associated with the given command"""
1345 """returns the completion list associated with the given command"""
1123
1346
@@ -1142,6 +1365,7 b" def debugcomplete(ui, cmd='', **opts):"
1142 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
1365 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
1143 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
1366 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
1144
1367
1368 @command('debugfsinfo', [], _('[PATH]'))
1145 def debugfsinfo(ui, path = "."):
1369 def debugfsinfo(ui, path = "."):
1146 """show information detected about current filesystem"""
1370 """show information detected about current filesystem"""
1147 util.writefile('.debugfsinfo', '')
1371 util.writefile('.debugfsinfo', '')
@@ -1151,6 +1375,9 b' def debugfsinfo(ui, path = "."):'
1151 and 'yes' or 'no'))
1375 and 'yes' or 'no'))
1152 os.unlink('.debugfsinfo')
1376 os.unlink('.debugfsinfo')
1153
1377
1378 @command('debugrebuildstate',
1379 [('r', 'rev', '', _('revision to rebuild to'), _('REV'))],
1380 _('[-r REV] [REV]'))
1154 def debugrebuildstate(ui, repo, rev="tip"):
1381 def debugrebuildstate(ui, repo, rev="tip"):
1155 """rebuild the dirstate as it would look like for the given revision"""
1382 """rebuild the dirstate as it would look like for the given revision"""
1156 ctx = cmdutil.revsingle(repo, rev)
1383 ctx = cmdutil.revsingle(repo, rev)
@@ -1160,6 +1387,7 b' def debugrebuildstate(ui, repo, rev="tip'
1160 finally:
1387 finally:
1161 wlock.release()
1388 wlock.release()
1162
1389
1390 @command('debugcheckstate', [], '')
1163 def debugcheckstate(ui, repo):
1391 def debugcheckstate(ui, repo):
1164 """validate the correctness of the current dirstate"""
1392 """validate the correctness of the current dirstate"""
1165 parent1, parent2 = repo.dirstate.parents()
1393 parent1, parent2 = repo.dirstate.parents()
@@ -1187,6 +1415,9 b' def debugcheckstate(ui, repo):'
1187 error = _(".hg/dirstate inconsistent with current parent's manifest")
1415 error = _(".hg/dirstate inconsistent with current parent's manifest")
1188 raise util.Abort(error)
1416 raise util.Abort(error)
1189
1417
1418 @command('showconfig|debugconfig',
1419 [('u', 'untrusted', None, _('show untrusted configuration options'))],
1420 _('[-u] [NAME]...'))
1190 def showconfig(ui, repo, *values, **opts):
1421 def showconfig(ui, repo, *values, **opts):
1191 """show combined config settings from all hgrc files
1422 """show combined config settings from all hgrc files
1192
1423
@@ -1230,6 +1461,7 b' def showconfig(ui, repo, *values, **opts'
1230 ui.configsource(section, name, untrusted))
1461 ui.configsource(section, name, untrusted))
1231 ui.write('%s=%s\n' % (sectname, value))
1462 ui.write('%s=%s\n' % (sectname, value))
1232
1463
1464 @command('debugknown', [], _('REPO ID...'))
1233 def debugknown(ui, repopath, *ids, **opts):
1465 def debugknown(ui, repopath, *ids, **opts):
1234 """test whether node ids are known to a repo
1466 """test whether node ids are known to a repo
1235
1467
@@ -1242,6 +1474,7 b' def debugknown(ui, repopath, *ids, **opt'
1242 flags = repo.known([bin(s) for s in ids])
1474 flags = repo.known([bin(s) for s in ids])
1243 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1475 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1244
1476
1477 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
1245 def debugbundle(ui, bundlepath, all=None, **opts):
1478 def debugbundle(ui, bundlepath, all=None, **opts):
1246 """lists the contents of a bundle"""
1479 """lists the contents of a bundle"""
1247 f = url.open(ui, bundlepath)
1480 f = url.open(ui, bundlepath)
@@ -1291,6 +1524,11 b' def debugbundle(ui, bundlepath, all=None'
1291 finally:
1524 finally:
1292 f.close()
1525 f.close()
1293
1526
1527 @command('debuggetbundle',
1528 [('H', 'head', [], _('id of head node'), _('ID')),
1529 ('C', 'common', [], _('id of common node'), _('ID')),
1530 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
1531 _('REPO FILE [-H|-C ID]...'))
1294 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1532 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1295 """retrieves a bundle from a repo
1533 """retrieves a bundle from a repo
1296
1534
@@ -1314,6 +1552,7 b' def debuggetbundle(ui, repopath, bundlep'
1314 raise util.Abort(_('unknown bundle type specified with --type'))
1552 raise util.Abort(_('unknown bundle type specified with --type'))
1315 changegroup.writebundle(bundle, bundlepath, bundletype)
1553 changegroup.writebundle(bundle, bundlepath, bundletype)
1316
1554
1555 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
1317 def debugpushkey(ui, repopath, namespace, *keyinfo):
1556 def debugpushkey(ui, repopath, namespace, *keyinfo):
1318 '''access the pushkey key/value protocol
1557 '''access the pushkey key/value protocol
1319
1558
@@ -1334,6 +1573,7 b' def debugpushkey(ui, repopath, namespace'
1334 ui.write("%s\t%s\n" % (k.encode('string-escape'),
1573 ui.write("%s\t%s\n" % (k.encode('string-escape'),
1335 v.encode('string-escape')))
1574 v.encode('string-escape')))
1336
1575
1576 @command('debugrevspec', [], ('REVSPEC'))
1337 def debugrevspec(ui, repo, expr):
1577 def debugrevspec(ui, repo, expr):
1338 '''parse and apply a revision specification'''
1578 '''parse and apply a revision specification'''
1339 if ui.verbose:
1579 if ui.verbose:
@@ -1346,6 +1586,7 b' def debugrevspec(ui, repo, expr):'
1346 for c in func(repo, range(len(repo))):
1586 for c in func(repo, range(len(repo))):
1347 ui.write("%s\n" % c)
1587 ui.write("%s\n" % c)
1348
1588
1589 @command('debugsetparents', [], _('REV1 [REV2]'))
1349 def debugsetparents(ui, repo, rev1, rev2=None):
1590 def debugsetparents(ui, repo, rev1, rev2=None):
1350 """manually set the parents of the current working directory
1591 """manually set the parents of the current working directory
1351
1592
@@ -1364,6 +1605,10 b' def debugsetparents(ui, repo, rev1, rev2'
1364 finally:
1605 finally:
1365 wlock.release()
1606 wlock.release()
1366
1607
1608 @command('debugstate',
1609 [('', 'nodates', None, _('do not display the saved mtime')),
1610 ('', 'datesort', None, _('sort by saved mtime'))],
1611 _('[OPTION]...'))
1367 def debugstate(ui, repo, nodates=None, datesort=None):
1612 def debugstate(ui, repo, nodates=None, datesort=None):
1368 """show the contents of the current dirstate"""
1613 """show the contents of the current dirstate"""
1369 timestr = ""
1614 timestr = ""
@@ -1392,6 +1637,10 b' def debugstate(ui, repo, nodates=None, d'
1392 for f in repo.dirstate.copies():
1637 for f in repo.dirstate.copies():
1393 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
1638 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
1394
1639
1640 @command('debugsub',
1641 [('r', 'rev', '',
1642 _('revision to check'), _('REV'))],
1643 _('[-r REV] [REV]'))
1395 def debugsub(ui, repo, rev=None):
1644 def debugsub(ui, repo, rev=None):
1396 ctx = cmdutil.revsingle(repo, rev, None)
1645 ctx = cmdutil.revsingle(repo, rev, None)
1397 for k, v in sorted(ctx.substate.items()):
1646 for k, v in sorted(ctx.substate.items()):
@@ -1399,6 +1648,12 b' def debugsub(ui, repo, rev=None):'
1399 ui.write(' source %s\n' % v[0])
1648 ui.write(' source %s\n' % v[0])
1400 ui.write(' revision %s\n' % v[1])
1649 ui.write(' revision %s\n' % v[1])
1401
1650
1651 @command('debugdag',
1652 [('t', 'tags', None, _('use tags as labels')),
1653 ('b', 'branches', None, _('annotate with branch names')),
1654 ('', 'dots', None, _('use dots for runs')),
1655 ('s', 'spaces', None, _('separate elements by spaces'))],
1656 _('[OPTION]... [FILE [REV]...]'))
1402 def debugdag(ui, repo, file_=None, *revs, **opts):
1657 def debugdag(ui, repo, file_=None, *revs, **opts):
1403 """format the changelog or an index DAG as a concise textual description
1658 """format the changelog or an index DAG as a concise textual description
1404
1659
@@ -1452,6 +1707,7 b' def debugdag(ui, repo, file_=None, *revs'
1452 ui.write(line)
1707 ui.write(line)
1453 ui.write("\n")
1708 ui.write("\n")
1454
1709
1710 @command('debugdata', [], _('FILE REV'))
1455 def debugdata(ui, repo, file_, rev):
1711 def debugdata(ui, repo, file_, rev):
1456 """dump the contents of a data file revision"""
1712 """dump the contents of a data file revision"""
1457 r = None
1713 r = None
@@ -1467,6 +1723,9 b' def debugdata(ui, repo, file_, rev):'
1467 except KeyError:
1723 except KeyError:
1468 raise util.Abort(_('invalid revision identifier %s') % rev)
1724 raise util.Abort(_('invalid revision identifier %s') % rev)
1469
1725
1726 @command('debugdate',
1727 [('e', 'extended', None, _('try extended date formats'))],
1728 _('[-e] DATE [RANGE]'))
1470 def debugdate(ui, date, range=None, **opts):
1729 def debugdate(ui, date, range=None, **opts):
1471 """parse and display a date"""
1730 """parse and display a date"""
1472 if opts["extended"]:
1731 if opts["extended"]:
@@ -1479,6 +1738,7 b' def debugdate(ui, date, range=None, **op'
1479 m = util.matchdate(range)
1738 m = util.matchdate(range)
1480 ui.write("match: %s\n" % m(d[0]))
1739 ui.write("match: %s\n" % m(d[0]))
1481
1740
1741 @command('debugignore', [], '')
1482 def debugignore(ui, repo, *values, **opts):
1742 def debugignore(ui, repo, *values, **opts):
1483 """display the combined ignore pattern"""
1743 """display the combined ignore pattern"""
1484 ignore = repo.dirstate._ignore
1744 ignore = repo.dirstate._ignore
@@ -1487,6 +1747,12 b' def debugignore(ui, repo, *values, **opt'
1487 else:
1747 else:
1488 raise util.Abort(_("no ignore patterns found"))
1748 raise util.Abort(_("no ignore patterns found"))
1489
1749
1750 @command('debugdiscovery',
1751 [('', 'old', None, _('use old-style discovery')),
1752 ('', 'nonheads', None,
1753 _('use old-style discovery with non-heads included')),
1754 ] + remoteopts,
1755 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]'))
1490 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1756 def debugdiscovery(ui, repo, remoteurl="default", **opts):
1491 """runs the changeset discovery protocol in isolation"""
1757 """runs the changeset discovery protocol in isolation"""
1492 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
1758 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), opts.get('branch'))
@@ -1545,7 +1811,9 b' def debugdiscovery(ui, repo, remoteurl="'
1545 localrevs = opts.get('local_head')
1811 localrevs = opts.get('local_head')
1546 doit(localrevs, remoterevs)
1812 doit(localrevs, remoterevs)
1547
1813
1548
1814 @command('debugindex',
1815 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1816 _('FILE'))
1549 def debugindex(ui, repo, file_, **opts):
1817 def debugindex(ui, repo, file_, **opts):
1550 """dump the contents of an index file"""
1818 """dump the contents of an index file"""
1551 r = None
1819 r = None
@@ -1594,6 +1862,7 b' def debugindex(ui, repo, file_, **opts):'
1594 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1862 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i),
1595 base, r.linkrev(i), pr[0], pr[1], short(node)))
1863 base, r.linkrev(i), pr[0], pr[1], short(node)))
1596
1864
1865 @command('debugindexdot', [], _('FILE'))
1597 def debugindexdot(ui, repo, file_):
1866 def debugindexdot(ui, repo, file_):
1598 """dump an index DAG as a graphviz dot file"""
1867 """dump an index DAG as a graphviz dot file"""
1599 r = None
1868 r = None
@@ -1612,6 +1881,7 b' def debugindexdot(ui, repo, file_):'
1612 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1881 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
1613 ui.write("}\n")
1882 ui.write("}\n")
1614
1883
1884 @command('debuginstall', [], '')
1615 def debuginstall(ui):
1885 def debuginstall(ui):
1616 '''test Mercurial installation
1886 '''test Mercurial installation
1617
1887
@@ -1689,6 +1959,9 b' def debuginstall(ui):'
1689
1959
1690 return problems
1960 return problems
1691
1961
1962 @command('debugrename',
1963 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1964 _('[-r REV] FILE'))
1692 def debugrename(ui, repo, file1, *pats, **opts):
1965 def debugrename(ui, repo, file1, *pats, **opts):
1693 """dump rename information"""
1966 """dump rename information"""
1694
1967
@@ -1703,6 +1976,7 b' def debugrename(ui, repo, file1, *pats, '
1703 else:
1976 else:
1704 ui.write(_("%s not renamed\n") % rel)
1977 ui.write(_("%s not renamed\n") % rel)
1705
1978
1979 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
1706 def debugwalk(ui, repo, *pats, **opts):
1980 def debugwalk(ui, repo, *pats, **opts):
1707 """show how files match on given patterns"""
1981 """show how files match on given patterns"""
1708 m = cmdutil.match(repo, pats, opts)
1982 m = cmdutil.match(repo, pats, opts)
@@ -1716,6 +1990,12 b' def debugwalk(ui, repo, *pats, **opts):'
1716 line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
1990 line = fmt % (abs, m.rel(abs), m.exact(abs) and 'exact' or '')
1717 ui.write("%s\n" % line.rstrip())
1991 ui.write("%s\n" % line.rstrip())
1718
1992
1993 @command('debugwireargs',
1994 [('', 'three', '', 'three'),
1995 ('', 'four', '', 'four'),
1996 ('', 'five', '', 'five'),
1997 ] + remoteopts,
1998 _('REPO [OPTIONS]... [ONE [TWO]]'))
1719 def debugwireargs(ui, repopath, *vals, **opts):
1999 def debugwireargs(ui, repopath, *vals, **opts):
1720 repo = hg.repository(hg.remoteui(ui, opts), repopath)
2000 repo = hg.repository(hg.remoteui(ui, opts), repopath)
1721 for opt in remoteopts:
2001 for opt in remoteopts:
@@ -1731,6 +2011,11 b' def debugwireargs(ui, repopath, *vals, *'
1731 if res1 != res2:
2011 if res1 != res2:
1732 ui.warn("%s\n" % res2)
2012 ui.warn("%s\n" % res2)
1733
2013
2014 @command('^diff',
2015 [('r', 'rev', [], _('revision'), _('REV')),
2016 ('c', 'change', '', _('change made by revision'), _('REV'))
2017 ] + diffopts + diffopts2 + walkopts + subrepoopts,
2018 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'))
1734 def diff(ui, repo, *pats, **opts):
2019 def diff(ui, repo, *pats, **opts):
1735 """diff repository (or selected files)
2020 """diff repository (or selected files)
1736
2021
@@ -1784,6 +2069,13 b' def diff(ui, repo, *pats, **opts):'
1784 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
2069 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
1785 listsubrepos=opts.get('subrepos'))
2070 listsubrepos=opts.get('subrepos'))
1786
2071
2072 @command('^export',
2073 [('o', 'output', '',
2074 _('print output to file with formatted name'), _('FORMAT')),
2075 ('', 'switch-parent', None, _('diff against the second parent')),
2076 ('r', 'rev', [], _('revisions to export'), _('REV')),
2077 ] + diffopts,
2078 _('[OPTION]... [-o OUTFILESPEC] REV...'))
1787 def export(ui, repo, *changesets, **opts):
2079 def export(ui, repo, *changesets, **opts):
1788 """dump the header and diffs for one or more changesets
2080 """dump the header and diffs for one or more changesets
1789
2081
@@ -1834,6 +2126,7 b' def export(ui, repo, *changesets, **opts'
1834 switch_parent=opts.get('switch_parent'),
2126 switch_parent=opts.get('switch_parent'),
1835 opts=patch.diffopts(ui, opts))
2127 opts=patch.diffopts(ui, opts))
1836
2128
2129 @command('^forget', walkopts, _('[OPTION]... FILE...'))
1837 def forget(ui, repo, *pats, **opts):
2130 def forget(ui, repo, *pats, **opts):
1838 """forget the specified files on the next commit
2131 """forget the specified files on the next commit
1839
2132
@@ -1870,6 +2163,23 b' def forget(ui, repo, *pats, **opts):'
1870 repo[None].remove(forget, unlink=False)
2163 repo[None].remove(forget, unlink=False)
1871 return errs
2164 return errs
1872
2165
2166 @command('grep',
2167 [('0', 'print0', None, _('end fields with NUL')),
2168 ('', 'all', None, _('print all revisions that match')),
2169 ('a', 'text', None, _('treat all files as text')),
2170 ('f', 'follow', None,
2171 _('follow changeset history,'
2172 ' or file history across copies and renames')),
2173 ('i', 'ignore-case', None, _('ignore case when matching')),
2174 ('l', 'files-with-matches', None,
2175 _('print only filenames and revisions that match')),
2176 ('n', 'line-number', None, _('print matching line numbers')),
2177 ('r', 'rev', [],
2178 _('only search files changed within revision range'), _('REV')),
2179 ('u', 'user', None, _('list the author (long with -v)')),
2180 ('d', 'date', None, _('list the date (short with -q)')),
2181 ] + walkopts,
2182 _('[OPTION]... PATTERN [FILE]...'))
1873 def grep(ui, repo, pattern, *pats, **opts):
2183 def grep(ui, repo, pattern, *pats, **opts):
1874 """search for a pattern in specified files and revisions
2184 """search for a pattern in specified files and revisions
1875
2185
@@ -2062,6 +2372,14 b' def grep(ui, repo, pattern, *pats, **opt'
2062
2372
2063 return not found
2373 return not found
2064
2374
2375 @command('heads',
2376 [('r', 'rev', '',
2377 _('show only heads which are descendants of STARTREV'), _('STARTREV')),
2378 ('t', 'topo', False, _('show topological heads only')),
2379 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
2380 ('c', 'closed', False, _('show normal and closed branch heads')),
2381 ] + templateopts,
2382 _('[-ac] [-r STARTREV] [REV]...'))
2065 def heads(ui, repo, *branchrevs, **opts):
2383 def heads(ui, repo, *branchrevs, **opts):
2066 """show current repository heads or show branch heads
2384 """show current repository heads or show branch heads
2067
2385
@@ -2134,6 +2452,10 b' def heads(ui, repo, *branchrevs, **opts)'
2134 displayer.show(ctx)
2452 displayer.show(ctx)
2135 displayer.close()
2453 displayer.close()
2136
2454
2455 @command('help',
2456 [('e', 'extension', None, _('show only help for extensions')),
2457 ('c', 'command', None, _('show only help for commands'))],
2458 _('[-ec] [TOPIC]'))
2137 def help_(ui, name=None, with_version=False, unknowncmd=False, full=True, **opts):
2459 def help_(ui, name=None, with_version=False, unknowncmd=False, full=True, **opts):
2138 """show help for a given topic or a help overview
2460 """show help for a given topic or a help overview
2139
2461
@@ -2449,6 +2771,15 b' def help_(ui, name=None, with_version=Fa'
2449 else:
2771 else:
2450 ui.write("%s\n" % opt)
2772 ui.write("%s\n" % opt)
2451
2773
2774 @command('identify|id',
2775 [('r', 'rev', '',
2776 _('identify the specified revision'), _('REV')),
2777 ('n', 'num', None, _('show local revision number')),
2778 ('i', 'id', None, _('show global revision id')),
2779 ('b', 'branch', None, _('show branch')),
2780 ('t', 'tags', None, _('show tags')),
2781 ('B', 'bookmarks', None, _('show bookmarks'))],
2782 _('[-nibtB] [-r REV] [SOURCE]'))
2452 def identify(ui, repo, source=None, rev=None,
2783 def identify(ui, repo, source=None, rev=None,
2453 num=None, id=None, branch=None, tags=None, bookmarks=None):
2784 num=None, id=None, branch=None, tags=None, bookmarks=None):
2454 """identify the working copy or specified revision
2785 """identify the working copy or specified revision
@@ -2557,6 +2888,20 b' def identify(ui, repo, source=None, rev='
2557
2888
2558 ui.write("%s\n" % ' '.join(output))
2889 ui.write("%s\n" % ' '.join(output))
2559
2890
2891 @command('import|patch',
2892 [('p', 'strip', 1,
2893 _('directory strip option for patch. This has the same '
2894 'meaning as the corresponding patch option'), _('NUM')),
2895 ('b', 'base', '', _('base path'), _('PATH')),
2896 ('f', 'force', None, _('skip check for outstanding uncommitted changes')),
2897 ('', 'no-commit', None,
2898 _("don't commit, just update the working directory")),
2899 ('', 'exact', None,
2900 _('apply patch to the nodes from which it was generated')),
2901 ('', 'import-branch', None,
2902 _('use any branch information in patch (implied by --exact)'))] +
2903 commitopts + commitopts2 + similarityopts,
2904 _('[OPTION]... PATCH...'))
2560 def import_(ui, repo, patch1, *patches, **opts):
2905 def import_(ui, repo, patch1, *patches, **opts):
2561 """import an ordered set of patches
2906 """import an ordered set of patches
2562
2907
@@ -2717,6 +3062,18 b' def import_(ui, repo, patch1, *patches, '
2717 finally:
3062 finally:
2718 release(lock, wlock)
3063 release(lock, wlock)
2719
3064
3065 @command('incoming|in',
3066 [('f', 'force', None,
3067 _('run even if remote repository is unrelated')),
3068 ('n', 'newest-first', None, _('show newest record first')),
3069 ('', 'bundle', '',
3070 _('file to store the bundles into'), _('FILE')),
3071 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3072 ('B', 'bookmarks', False, _("compare bookmarks")),
3073 ('b', 'branch', [],
3074 _('a specific branch you would like to pull'), _('BRANCH')),
3075 ] + logopts + remoteopts + subrepoopts,
3076 _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
2720 def incoming(ui, repo, source="default", **opts):
3077 def incoming(ui, repo, source="default", **opts):
2721 """show new changesets found in source
3078 """show new changesets found in source
2722
3079
@@ -2747,6 +3104,7 b' def incoming(ui, repo, source="default",'
2747 ret = hg.incoming(ui, repo, source, opts)
3104 ret = hg.incoming(ui, repo, source, opts)
2748 return ret
3105 return ret
2749
3106
3107 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'))
2750 def init(ui, dest=".", **opts):
3108 def init(ui, dest=".", **opts):
2751 """create a new repository in the given directory
3109 """create a new repository in the given directory
2752
3110
@@ -2762,6 +3120,12 b' def init(ui, dest=".", **opts):'
2762 """
3120 """
2763 hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1)
3121 hg.repository(hg.remoteui(ui, opts), ui.expandpath(dest), create=1)
2764
3122
3123 @command('locate',
3124 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
3125 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
3126 ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
3127 ] + walkopts,
3128 _('[OPTION]... [PATTERN]...'))
2765 def locate(ui, repo, *pats, **opts):
3129 def locate(ui, repo, *pats, **opts):
2766 """locate files matching specific patterns
3130 """locate files matching specific patterns
2767
3131
@@ -2799,6 +3163,28 b' def locate(ui, repo, *pats, **opts):'
2799
3163
2800 return ret
3164 return ret
2801
3165
3166 @command('^log|history',
3167 [('f', 'follow', None,
3168 _('follow changeset history, or file history across copies and renames')),
3169 ('', 'follow-first', None,
3170 _('only follow the first parent of merge changesets')),
3171 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
3172 ('C', 'copies', None, _('show copied files')),
3173 ('k', 'keyword', [],
3174 _('do case-insensitive search for a given text'), _('TEXT')),
3175 ('r', 'rev', [], _('show the specified revision or range'), _('REV')),
3176 ('', 'removed', None, _('include revisions where files were removed')),
3177 ('m', 'only-merges', None, _('show only merges')),
3178 ('u', 'user', [], _('revisions committed by user'), _('USER')),
3179 ('', 'only-branch', [],
3180 _('show only changesets within the given named branch (DEPRECATED)'),
3181 _('BRANCH')),
3182 ('b', 'branch', [],
3183 _('show changesets within the given named branch'), _('BRANCH')),
3184 ('P', 'prune', [],
3185 _('do not display revision or any of its ancestors'), _('REV')),
3186 ] + logopts + walkopts,
3187 _('[OPTION]... [FILE]'))
2802 def log(ui, repo, *pats, **opts):
3188 def log(ui, repo, *pats, **opts):
2803 """show revision history of entire repository or files
3189 """show revision history of entire repository or files
2804
3190
@@ -2898,6 +3284,9 b' def log(ui, repo, *pats, **opts):'
2898 count += 1
3284 count += 1
2899 displayer.close()
3285 displayer.close()
2900
3286
3287 @command('manifest',
3288 [('r', 'rev', '', _('revision to display'), _('REV'))],
3289 _('[-r REV]'))
2901 def manifest(ui, repo, node=None, rev=None):
3290 def manifest(ui, repo, node=None, rev=None):
2902 """output the current or given revision of the project manifest
3291 """output the current or given revision of the project manifest
2903
3292
@@ -2926,6 +3315,13 b' def manifest(ui, repo, node=None, rev=No'
2926 ui.write(decor[ctx.flags(f)])
3315 ui.write(decor[ctx.flags(f)])
2927 ui.write("%s\n" % f)
3316 ui.write("%s\n" % f)
2928
3317
3318 @command('^merge',
3319 [('f', 'force', None, _('force a merge with outstanding changes')),
3320 ('t', 'tool', '', _('specify merge tool')),
3321 ('r', 'rev', '', _('revision to merge'), _('REV')),
3322 ('P', 'preview', None,
3323 _('review revisions to merge (no merge is performed)'))],
3324 _('[-P] [-f] [[-r] REV]'))
2929 def merge(ui, repo, node=None, **opts):
3325 def merge(ui, repo, node=None, **opts):
2930 """merge working directory with another revision
3326 """merge working directory with another revision
2931
3327
@@ -3008,6 +3404,16 b' def merge(ui, repo, node=None, **opts):'
3008 finally:
3404 finally:
3009 ui.setconfig('ui', 'forcemerge', '')
3405 ui.setconfig('ui', 'forcemerge', '')
3010
3406
3407 @command('outgoing|out',
3408 [('f', 'force', None, _('run even when the destination is unrelated')),
3409 ('r', 'rev', [],
3410 _('a changeset intended to be included in the destination'), _('REV')),
3411 ('n', 'newest-first', None, _('show newest record first')),
3412 ('B', 'bookmarks', False, _('compare bookmarks')),
3413 ('b', 'branch', [], _('a specific branch you would like to push'),
3414 _('BRANCH')),
3415 ] + logopts + remoteopts + subrepoopts,
3416 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
3011 def outgoing(ui, repo, dest=None, **opts):
3417 def outgoing(ui, repo, dest=None, **opts):
3012 """show changesets not found in the destination
3418 """show changesets not found in the destination
3013
3419
@@ -3033,6 +3439,10 b' def outgoing(ui, repo, dest=None, **opts'
3033 ret = hg.outgoing(ui, repo, dest, opts)
3439 ret = hg.outgoing(ui, repo, dest, opts)
3034 return ret
3440 return ret
3035
3441
3442 @command('parents',
3443 [('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
3444 ] + templateopts,
3445 _('[-r REV] [FILE]'))
3036 def parents(ui, repo, file_=None, **opts):
3446 def parents(ui, repo, file_=None, **opts):
3037 """show the parents of the working directory or revision
3447 """show the parents of the working directory or revision
3038
3448
@@ -3073,6 +3483,7 b' def parents(ui, repo, file_=None, **opts'
3073 displayer.show(repo[n])
3483 displayer.show(repo[n])
3074 displayer.close()
3484 displayer.close()
3075
3485
3486 @command('paths', [], _('[NAME]'))
3076 def paths(ui, repo, search=None):
3487 def paths(ui, repo, search=None):
3077 """show aliases for remote repositories
3488 """show aliases for remote repositories
3078
3489
@@ -3128,6 +3539,16 b' def postincoming(ui, repo, modheads, opt'
3128 else:
3539 else:
3129 ui.status(_("(run 'hg update' to get a working copy)\n"))
3540 ui.status(_("(run 'hg update' to get a working copy)\n"))
3130
3541
3542 @command('^pull',
3543 [('u', 'update', None,
3544 _('update to new branch head if changesets were pulled')),
3545 ('f', 'force', None, _('run even when remote repository is unrelated')),
3546 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
3547 ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
3548 ('b', 'branch', [], _('a specific branch you would like to pull'),
3549 _('BRANCH')),
3550 ] + remoteopts,
3551 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
3131 def pull(ui, repo, source="default", **opts):
3552 def pull(ui, repo, source="default", **opts):
3132 """pull changes from the specified source
3553 """pull changes from the specified source
3133
3554
@@ -3191,6 +3612,17 b' def pull(ui, repo, source="default", **o'
3191
3612
3192 return ret
3613 return ret
3193
3614
3615 @command('^push',
3616 [('f', 'force', None, _('force push')),
3617 ('r', 'rev', [],
3618 _('a changeset intended to be included in the destination'),
3619 _('REV')),
3620 ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
3621 ('b', 'branch', [],
3622 _('a specific branch you would like to push'), _('BRANCH')),
3623 ('', 'new-branch', False, _('allow pushing a new branch')),
3624 ] + remoteopts,
3625 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
3194 def push(ui, repo, dest=None, **opts):
3626 def push(ui, repo, dest=None, **opts):
3195 """push changes to the specified destination
3627 """push changes to the specified destination
3196
3628
@@ -3277,6 +3709,7 b' def push(ui, repo, dest=None, **opts):'
3277
3709
3278 return result
3710 return result
3279
3711
3712 @command('recover', [])
3280 def recover(ui, repo):
3713 def recover(ui, repo):
3281 """roll back an interrupted transaction
3714 """roll back an interrupted transaction
3282
3715
@@ -3292,6 +3725,12 b' def recover(ui, repo):'
3292 return hg.verify(repo)
3725 return hg.verify(repo)
3293 return 1
3726 return 1
3294
3727
3728 @command('^remove|rm',
3729 [('A', 'after', None, _('record delete for missing files')),
3730 ('f', 'force', None,
3731 _('remove (and delete) file even if added or modified')),
3732 ] + walkopts,
3733 _('[OPTION]... FILE...'))
3295 def remove(ui, repo, *pats, **opts):
3734 def remove(ui, repo, *pats, **opts):
3296 """remove the specified files on the next commit
3735 """remove the specified files on the next commit
3297
3736
@@ -3362,6 +3801,11 b' def remove(ui, repo, *pats, **opts):'
3362 repo[None].remove(remove, unlink=not after)
3801 repo[None].remove(remove, unlink=not after)
3363 return ret
3802 return ret
3364
3803
3804 @command('rename|move|mv',
3805 [('A', 'after', None, _('record a rename that has already occurred')),
3806 ('f', 'force', None, _('forcibly copy over an existing managed file')),
3807 ] + walkopts + dryrunopts,
3808 _('[OPTION]... SOURCE... DEST'))
3365 def rename(ui, repo, *pats, **opts):
3809 def rename(ui, repo, *pats, **opts):
3366 """rename files; equivalent of copy + remove
3810 """rename files; equivalent of copy + remove
3367
3811
@@ -3384,6 +3828,15 b' def rename(ui, repo, *pats, **opts):'
3384 finally:
3828 finally:
3385 wlock.release()
3829 wlock.release()
3386
3830
3831 @command('resolve',
3832 [('a', 'all', None, _('select all unresolved files')),
3833 ('l', 'list', None, _('list state of files needing merge')),
3834 ('m', 'mark', None, _('mark files as resolved')),
3835 ('u', 'unmark', None, _('mark files as unresolved')),
3836 ('t', 'tool', '', _('specify merge tool')),
3837 ('n', 'no-status', None, _('hide status prefix'))]
3838 + walkopts,
3839 _('[OPTION]... [FILE]...'))
3387 def resolve(ui, repo, *pats, **opts):
3840 def resolve(ui, repo, *pats, **opts):
3388 """redo merges or set/view the merge status of files
3841 """redo merges or set/view the merge status of files
3389
3842
@@ -3470,6 +3923,13 b' def resolve(ui, repo, *pats, **opts):'
3470 ms.commit()
3923 ms.commit()
3471 return ret
3924 return ret
3472
3925
3926 @command('revert',
3927 [('a', 'all', None, _('revert all changes when no arguments given')),
3928 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
3929 ('r', 'rev', '', _('revert to the specified revision'), _('REV')),
3930 ('', 'no-backup', None, _('do not save backup copies of files')),
3931 ] + walkopts + dryrunopts,
3932 _('[OPTION]... [-r REV] [NAME]...'))
3473 def revert(ui, repo, *pats, **opts):
3933 def revert(ui, repo, *pats, **opts):
3474 """restore individual files or directories to an earlier state
3934 """restore individual files or directories to an earlier state
3475
3935
@@ -3698,6 +4158,7 b' def revert(ui, repo, *pats, **opts):'
3698 finally:
4158 finally:
3699 wlock.release()
4159 wlock.release()
3700
4160
4161 @command('rollback', dryrunopts)
3701 def rollback(ui, repo, **opts):
4162 def rollback(ui, repo, **opts):
3702 """roll back the last transaction (dangerous)
4163 """roll back the last transaction (dangerous)
3703
4164
@@ -3729,6 +4190,7 b' def rollback(ui, repo, **opts):'
3729 """
4190 """
3730 return repo.rollback(opts.get('dry_run'))
4191 return repo.rollback(opts.get('dry_run'))
3731
4192
4193 @command('root', [])
3732 def root(ui, repo):
4194 def root(ui, repo):
3733 """print the root (top) of the current working directory
4195 """print the root (top) of the current working directory
3734
4196
@@ -3738,6 +4200,31 b' def root(ui, repo):'
3738 """
4200 """
3739 ui.write(repo.root + "\n")
4201 ui.write(repo.root + "\n")
3740
4202
4203 @command('^serve',
4204 [('A', 'accesslog', '', _('name of access log file to write to'),
4205 _('FILE')),
4206 ('d', 'daemon', None, _('run server in background')),
4207 ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')),
4208 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
4209 # use string type, then we can check if something was passed
4210 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
4211 ('a', 'address', '', _('address to listen on (default: all interfaces)'),
4212 _('ADDR')),
4213 ('', 'prefix', '', _('prefix path to serve from (default: server root)'),
4214 _('PREFIX')),
4215 ('n', 'name', '',
4216 _('name to show in web pages (default: working directory)'), _('NAME')),
4217 ('', 'web-conf', '',
4218 _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')),
4219 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'),
4220 _('FILE')),
4221 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')),
4222 ('', 'stdio', None, _('for remote clients')),
4223 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')),
4224 ('', 'style', '', _('template style to use'), _('STYLE')),
4225 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
4226 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))],
4227 _('[OPTION]...'))
3741 def serve(ui, repo, **opts):
4228 def serve(ui, repo, **opts):
3742 """start stand-alone webserver
4229 """start stand-alone webserver
3743
4230
@@ -3834,6 +4321,22 b' def serve(ui, repo, **opts):'
3834
4321
3835 cmdutil.service(opts, initfn=service.init, runfn=service.run)
4322 cmdutil.service(opts, initfn=service.init, runfn=service.run)
3836
4323
4324 @command('^status|st',
4325 [('A', 'all', None, _('show status of all files')),
4326 ('m', 'modified', None, _('show only modified files')),
4327 ('a', 'added', None, _('show only added files')),
4328 ('r', 'removed', None, _('show only removed files')),
4329 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
4330 ('c', 'clean', None, _('show only files without changes')),
4331 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
4332 ('i', 'ignored', None, _('show only ignored files')),
4333 ('n', 'no-status', None, _('hide status prefix')),
4334 ('C', 'copies', None, _('show source of copied files')),
4335 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
4336 ('', 'rev', [], _('show difference from revision'), _('REV')),
4337 ('', 'change', '', _('list the changed files of a revision'), _('REV')),
4338 ] + walkopts + subrepoopts,
4339 _('[OPTION]... [FILE]...'))
3837 def status(ui, repo, *pats, **opts):
4340 def status(ui, repo, *pats, **opts):
3838 """show changed files in the working directory
4341 """show changed files in the working directory
3839
4342
@@ -3926,6 +4429,8 b' def status(ui, repo, *pats, **opts):'
3926 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end),
4429 ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end),
3927 label='status.copied')
4430 label='status.copied')
3928
4431
4432 @command('^summary|sum',
4433 [('', 'remote', None, _('check for push and pull'))], '[--remote]')
3929 def summary(ui, repo, **opts):
4434 def summary(ui, repo, **opts):
3930 """summarize working directory state
4435 """summarize working directory state
3931
4436
@@ -4088,6 +4593,16 b' def summary(ui, repo, **opts):'
4088 else:
4593 else:
4089 ui.status(_('remote: (synced)\n'))
4594 ui.status(_('remote: (synced)\n'))
4090
4595
4596 @command('tag',
4597 [('f', 'force', None, _('force tag')),
4598 ('l', 'local', None, _('make the tag local')),
4599 ('r', 'rev', '', _('revision to tag'), _('REV')),
4600 ('', 'remove', None, _('remove a tag')),
4601 # -l/--local is already there, commitopts cannot be used
4602 ('e', 'edit', None, _('edit commit message')),
4603 ('m', 'message', '', _('use <text> as commit message'), _('TEXT')),
4604 ] + commitopts2,
4605 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
4091 def tag(ui, repo, name1, *names, **opts):
4606 def tag(ui, repo, name1, *names, **opts):
4092 """add one or more tags for the current or given revision
4607 """add one or more tags for the current or given revision
4093
4608
@@ -4177,6 +4692,7 b' def tag(ui, repo, name1, *names, **opts)'
4177
4692
4178 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
4693 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date)
4179
4694
4695 @command('tags', [], '')
4180 def tags(ui, repo):
4696 def tags(ui, repo):
4181 """list repository tags
4697 """list repository tags
4182
4698
@@ -4205,6 +4721,11 b' def tags(ui, repo):'
4205 tagtype = ""
4721 tagtype = ""
4206 ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
4722 ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype))
4207
4723
4724 @command('tip',
4725 [('p', 'patch', None, _('show patch')),
4726 ('g', 'git', None, _('use git extended diff format')),
4727 ] + templateopts,
4728 _('[-p] [-g]'))
4208 def tip(ui, repo, **opts):
4729 def tip(ui, repo, **opts):
4209 """show the tip revision
4730 """show the tip revision
4210
4731
@@ -4223,6 +4744,10 b' def tip(ui, repo, **opts):'
4223 displayer.show(repo[len(repo) - 1])
4744 displayer.show(repo[len(repo) - 1])
4224 displayer.close()
4745 displayer.close()
4225
4746
4747 @command('unbundle',
4748 [('u', 'update', None,
4749 _('update to new branch head if changesets were unbundled'))],
4750 _('[-u] FILE...'))
4226 def unbundle(ui, repo, fname1, *fnames, **opts):
4751 def unbundle(ui, repo, fname1, *fnames, **opts):
4227 """apply one or more changegroup files
4752 """apply one or more changegroup files
4228
4753
@@ -4246,6 +4771,13 b' def unbundle(ui, repo, fname1, *fnames, '
4246 lock.release()
4771 lock.release()
4247 return postincoming(ui, repo, modheads, opts.get('update'), None)
4772 return postincoming(ui, repo, modheads, opts.get('update'), None)
4248
4773
4774 @command('^update|up|checkout|co',
4775 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
4776 ('c', 'check', None,
4777 _('update across branches if no uncommitted changes')),
4778 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
4779 ('r', 'rev', '', _('revision'), _('REV'))],
4780 _('[-c] [-C] [-d DATE] [[-r] REV]'))
4249 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
4781 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False):
4250 """update working directory (or switch revisions)
4782 """update working directory (or switch revisions)
4251
4783
@@ -4321,6 +4853,7 b' def update(ui, repo, node=None, rev=None'
4321
4853
4322 return ret
4854 return ret
4323
4855
4856 @command('verify', [])
4324 def verify(ui, repo):
4857 def verify(ui, repo):
4325 """verify the integrity of the repository
4858 """verify the integrity of the repository
4326
4859
@@ -4335,6 +4868,7 b' def verify(ui, repo):'
4335 """
4868 """
4336 return hg.verify(repo)
4869 return hg.verify(repo)
4337
4870
4871 @command('version', [])
4338 def version_(ui):
4872 def version_(ui):
4339 """output version and copyright information"""
4873 """output version and copyright information"""
4340 ui.write(_("Mercurial Distributed SCM (version %s)\n")
4874 ui.write(_("Mercurial Distributed SCM (version %s)\n")
@@ -4347,672 +4881,6 b' def version_(ui):'
4347 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
4881 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
4348 ))
4882 ))
4349
4883
4350 # Command options and aliases are listed here, alphabetically
4351
4352 globalopts = [
4353 ('R', 'repository', '',
4354 _('repository root directory or name of overlay bundle file'),
4355 _('REPO')),
4356 ('', 'cwd', '',
4357 _('change working directory'), _('DIR')),
4358 ('y', 'noninteractive', None,
4359 _('do not prompt, assume \'yes\' for any required answers')),
4360 ('q', 'quiet', None, _('suppress output')),
4361 ('v', 'verbose', None, _('enable additional output')),
4362 ('', 'config', [],
4363 _('set/override config option (use \'section.name=value\')'),
4364 _('CONFIG')),
4365 ('', 'debug', None, _('enable debugging output')),
4366 ('', 'debugger', None, _('start debugger')),
4367 ('', 'encoding', encoding.encoding, _('set the charset encoding'),
4368 _('ENCODE')),
4369 ('', 'encodingmode', encoding.encodingmode,
4370 _('set the charset encoding mode'), _('MODE')),
4371 ('', 'traceback', None, _('always print a traceback on exception')),
4372 ('', 'time', None, _('time how long the command takes')),
4373 ('', 'profile', None, _('print command execution profile')),
4374 ('', 'version', None, _('output version information and exit')),
4375 ('h', 'help', None, _('display help and exit')),
4376 ]
4377
4378 dryrunopts = [('n', 'dry-run', None,
4379 _('do not perform actions, just print output'))]
4380
4381 remoteopts = [
4382 ('e', 'ssh', '',
4383 _('specify ssh command to use'), _('CMD')),
4384 ('', 'remotecmd', '',
4385 _('specify hg command to run on the remote side'), _('CMD')),
4386 ('', 'insecure', None,
4387 _('do not verify server certificate (ignoring web.cacerts config)')),
4388 ]
4389
4390 walkopts = [
4391 ('I', 'include', [],
4392 _('include names matching the given patterns'), _('PATTERN')),
4393 ('X', 'exclude', [],
4394 _('exclude names matching the given patterns'), _('PATTERN')),
4395 ]
4396
4397 commitopts = [
4398 ('m', 'message', '',
4399 _('use text as commit message'), _('TEXT')),
4400 ('l', 'logfile', '',
4401 _('read commit message from file'), _('FILE')),
4402 ]
4403
4404 commitopts2 = [
4405 ('d', 'date', '',
4406 _('record the specified date as commit date'), _('DATE')),
4407 ('u', 'user', '',
4408 _('record the specified user as committer'), _('USER')),
4409 ]
4410
4411 templateopts = [
4412 ('', 'style', '',
4413 _('display using template map file'), _('STYLE')),
4414 ('', 'template', '',
4415 _('display with template'), _('TEMPLATE')),
4416 ]
4417
4418 logopts = [
4419 ('p', 'patch', None, _('show patch')),
4420 ('g', 'git', None, _('use git extended diff format')),
4421 ('l', 'limit', '',
4422 _('limit number of changes displayed'), _('NUM')),
4423 ('M', 'no-merges', None, _('do not show merges')),
4424 ('', 'stat', None, _('output diffstat-style summary of changes')),
4425 ] + templateopts
4426
4427 diffopts = [
4428 ('a', 'text', None, _('treat all files as text')),
4429 ('g', 'git', None, _('use git extended diff format')),
4430 ('', 'nodates', None, _('omit dates from diff headers'))
4431 ]
4432
4433 diffopts2 = [
4434 ('p', 'show-function', None, _('show which function each change is in')),
4435 ('', 'reverse', None, _('produce a diff that undoes the changes')),
4436 ('w', 'ignore-all-space', None,
4437 _('ignore white space when comparing lines')),
4438 ('b', 'ignore-space-change', None,
4439 _('ignore changes in the amount of white space')),
4440 ('B', 'ignore-blank-lines', None,
4441 _('ignore changes whose lines are all blank')),
4442 ('U', 'unified', '',
4443 _('number of lines of context to show'), _('NUM')),
4444 ('', 'stat', None, _('output diffstat-style summary of changes')),
4445 ]
4446
4447 similarityopts = [
4448 ('s', 'similarity', '',
4449 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY'))
4450 ]
4451
4452 subrepoopts = [
4453 ('S', 'subrepos', None,
4454 _('recurse into subrepositories'))
4455 ]
4456
4457 table = {
4458 "^add": (add, walkopts + subrepoopts + dryrunopts,
4459 _('[OPTION]... [FILE]...')),
4460 "addremove":
4461 (addremove, similarityopts + walkopts + dryrunopts,
4462 _('[OPTION]... [FILE]...')),
4463 "^annotate|blame":
4464 (annotate,
4465 [('r', 'rev', '',
4466 _('annotate the specified revision'), _('REV')),
4467 ('', 'follow', None,
4468 _('follow copies/renames and list the filename (DEPRECATED)')),
4469 ('', 'no-follow', None, _("don't follow copies and renames")),
4470 ('a', 'text', None, _('treat all files as text')),
4471 ('u', 'user', None, _('list the author (long with -v)')),
4472 ('f', 'file', None, _('list the filename')),
4473 ('d', 'date', None, _('list the date (short with -q)')),
4474 ('n', 'number', None, _('list the revision number (default)')),
4475 ('c', 'changeset', None, _('list the changeset')),
4476 ('l', 'line-number', None,
4477 _('show line number at the first appearance'))
4478 ] + walkopts,
4479 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')),
4480 "archive":
4481 (archive,
4482 [('', 'no-decode', None, _('do not pass files through decoders')),
4483 ('p', 'prefix', '',
4484 _('directory prefix for files in archive'), _('PREFIX')),
4485 ('r', 'rev', '',
4486 _('revision to distribute'), _('REV')),
4487 ('t', 'type', '',
4488 _('type of distribution to create'), _('TYPE')),
4489 ] + subrepoopts + walkopts,
4490 _('[OPTION]... DEST')),
4491 "backout":
4492 (backout,
4493 [('', 'merge', None,
4494 _('merge with old dirstate parent after backout')),
4495 ('', 'parent', '',
4496 _('parent to choose when backing out merge'), _('REV')),
4497 ('t', 'tool', '',
4498 _('specify merge tool')),
4499 ('r', 'rev', '',
4500 _('revision to backout'), _('REV')),
4501 ] + walkopts + commitopts + commitopts2,
4502 _('[OPTION]... [-r] REV')),
4503 "bisect":
4504 (bisect,
4505 [('r', 'reset', False, _('reset bisect state')),
4506 ('g', 'good', False, _('mark changeset good')),
4507 ('b', 'bad', False, _('mark changeset bad')),
4508 ('s', 'skip', False, _('skip testing changeset')),
4509 ('e', 'extend', False, _('extend the bisect range')),
4510 ('c', 'command', '',
4511 _('use command to check changeset state'), _('CMD')),
4512 ('U', 'noupdate', False, _('do not update to target'))],
4513 _("[-gbsr] [-U] [-c CMD] [REV]")),
4514 "bookmarks":
4515 (bookmark,
4516 [('f', 'force', False, _('force')),
4517 ('r', 'rev', '', _('revision'), _('REV')),
4518 ('d', 'delete', False, _('delete a given bookmark')),
4519 ('m', 'rename', '', _('rename a given bookmark'), _('NAME')),
4520 ('i', 'inactive', False, _('do not mark a new bookmark active'))],
4521 _('hg bookmarks [-f] [-d] [-i] [-m NAME] [-r REV] [NAME]')),
4522 "branch":
4523 (branch,
4524 [('f', 'force', None,
4525 _('set branch name even if it shadows an existing branch')),
4526 ('C', 'clean', None, _('reset branch name to parent branch name'))],
4527 _('[-fC] [NAME]')),
4528 "branches":
4529 (branches,
4530 [('a', 'active', False,
4531 _('show only branches that have unmerged heads')),
4532 ('c', 'closed', False,
4533 _('show normal and closed branches'))],
4534 _('[-ac]')),
4535 "bundle":
4536 (bundle,
4537 [('f', 'force', None,
4538 _('run even when the destination is unrelated')),
4539 ('r', 'rev', [],
4540 _('a changeset intended to be added to the destination'),
4541 _('REV')),
4542 ('b', 'branch', [],
4543 _('a specific branch you would like to bundle'),
4544 _('BRANCH')),
4545 ('', 'base', [],
4546 _('a base changeset assumed to be available at the destination'),
4547 _('REV')),
4548 ('a', 'all', None, _('bundle all changesets in the repository')),
4549 ('t', 'type', 'bzip2',
4550 _('bundle compression type to use'), _('TYPE')),
4551 ] + remoteopts,
4552 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
4553 "cat":
4554 (cat,
4555 [('o', 'output', '',
4556 _('print output to file with formatted name'), _('FORMAT')),
4557 ('r', 'rev', '',
4558 _('print the given revision'), _('REV')),
4559 ('', 'decode', None, _('apply any matching decode filter')),
4560 ] + walkopts,
4561 _('[OPTION]... FILE...')),
4562 "^clone":
4563 (clone,
4564 [('U', 'noupdate', None,
4565 _('the clone will include an empty working copy (only a repository)')),
4566 ('u', 'updaterev', '',
4567 _('revision, tag or branch to check out'), _('REV')),
4568 ('r', 'rev', [],
4569 _('include the specified changeset'), _('REV')),
4570 ('b', 'branch', [],
4571 _('clone only the specified branch'), _('BRANCH')),
4572 ('', 'pull', None, _('use pull protocol to copy metadata')),
4573 ('', 'uncompressed', None,
4574 _('use uncompressed transfer (fast over LAN)')),
4575 ] + remoteopts,
4576 _('[OPTION]... SOURCE [DEST]')),
4577 "^commit|ci":
4578 (commit,
4579 [('A', 'addremove', None,
4580 _('mark new/missing files as added/removed before committing')),
4581 ('', 'close-branch', None,
4582 _('mark a branch as closed, hiding it from the branch list')),
4583 ] + walkopts + commitopts + commitopts2,
4584 _('[OPTION]... [FILE]...')),
4585 "copy|cp":
4586 (copy,
4587 [('A', 'after', None, _('record a copy that has already occurred')),
4588 ('f', 'force', None,
4589 _('forcibly copy over an existing managed file')),
4590 ] + walkopts + dryrunopts,
4591 _('[OPTION]... [SOURCE]... DEST')),
4592 "debugancestor": (debugancestor, [], _('[INDEX] REV1 REV2')),
4593 "debugbuilddag":
4594 (debugbuilddag,
4595 [('m', 'mergeable-file', None, _('add single file mergeable changes')),
4596 ('o', 'overwritten-file', None, _('add single file all revs overwrite')),
4597 ('n', 'new-file', None, _('add new file at each rev')),
4598 ],
4599 _('[OPTION]... [TEXT]')),
4600 "debugbundle":
4601 (debugbundle,
4602 [('a', 'all', None, _('show all details')),
4603 ],
4604 _('FILE')),
4605 "debugcheckstate": (debugcheckstate, [], ''),
4606 "debugcommands": (debugcommands, [], _('[COMMAND]')),
4607 "debugcomplete":
4608 (debugcomplete,
4609 [('o', 'options', None, _('show the command options'))],
4610 _('[-o] CMD')),
4611 "debugdag":
4612 (debugdag,
4613 [('t', 'tags', None, _('use tags as labels')),
4614 ('b', 'branches', None, _('annotate with branch names')),
4615 ('', 'dots', None, _('use dots for runs')),
4616 ('s', 'spaces', None, _('separate elements by spaces')),
4617 ],
4618 _('[OPTION]... [FILE [REV]...]')),
4619 "debugdate":
4620 (debugdate,
4621 [('e', 'extended', None, _('try extended date formats'))],
4622 _('[-e] DATE [RANGE]')),
4623 "debugdata": (debugdata, [], _('FILE REV')),
4624 "debugdiscovery": (debugdiscovery,
4625 [('', 'old', None,
4626 _('use old-style discovery')),
4627 ('', 'nonheads', None,
4628 _('use old-style discovery with non-heads included')),
4629 ] + remoteopts,
4630 _('[-l REV] [-r REV] [-b BRANCH]...'
4631 ' [OTHER]')),
4632 "debugfsinfo": (debugfsinfo, [], _('[PATH]')),
4633 "debuggetbundle":
4634 (debuggetbundle,
4635 [('H', 'head', [], _('id of head node'), _('ID')),
4636 ('C', 'common', [], _('id of common node'), _('ID')),
4637 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
4638 ],
4639 _('REPO FILE [-H|-C ID]...')),
4640 "debugignore": (debugignore, [], ''),
4641 "debugindex": (debugindex,
4642 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
4643 _('FILE')),
4644 "debugindexdot": (debugindexdot, [], _('FILE')),
4645 "debuginstall": (debuginstall, [], ''),
4646 "debugknown": (debugknown, [], _('REPO ID...')),
4647 "debugpushkey": (debugpushkey, [], _('REPO NAMESPACE [KEY OLD NEW]')),
4648 "debugrebuildstate":
4649 (debugrebuildstate,
4650 [('r', 'rev', '',
4651 _('revision to rebuild to'), _('REV'))],
4652 _('[-r REV] [REV]')),
4653 "debugrename":
4654 (debugrename,
4655 [('r', 'rev', '',
4656 _('revision to debug'), _('REV'))],
4657 _('[-r REV] FILE')),
4658 "debugrevspec":
4659 (debugrevspec, [], ('REVSPEC')),
4660 "debugsetparents":
4661 (debugsetparents, [], _('REV1 [REV2]')),
4662 "debugstate":
4663 (debugstate,
4664 [('', 'nodates', None, _('do not display the saved mtime')),
4665 ('', 'datesort', None, _('sort by saved mtime'))],
4666 _('[OPTION]...')),
4667 "debugsub":
4668 (debugsub,
4669 [('r', 'rev', '',
4670 _('revision to check'), _('REV'))],
4671 _('[-r REV] [REV]')),
4672 "debugwalk": (debugwalk, walkopts, _('[OPTION]... [FILE]...')),
4673 "debugwireargs":
4674 (debugwireargs,
4675 [('', 'three', '', 'three'),
4676 ('', 'four', '', 'four'),
4677 ('', 'five', '', 'five'),
4678 ] + remoteopts,
4679 _('REPO [OPTIONS]... [ONE [TWO]]')),
4680 "^diff":
4681 (diff,
4682 [('r', 'rev', [],
4683 _('revision'), _('REV')),
4684 ('c', 'change', '',
4685 _('change made by revision'), _('REV'))
4686 ] + diffopts + diffopts2 + walkopts + subrepoopts,
4687 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...')),
4688 "^export":
4689 (export,
4690 [('o', 'output', '',
4691 _('print output to file with formatted name'), _('FORMAT')),
4692 ('', 'switch-parent', None, _('diff against the second parent')),
4693 ('r', 'rev', [],
4694 _('revisions to export'), _('REV')),
4695 ] + diffopts,
4696 _('[OPTION]... [-o OUTFILESPEC] REV...')),
4697 "^forget":
4698 (forget,
4699 [] + walkopts,
4700 _('[OPTION]... FILE...')),
4701 "grep":
4702 (grep,
4703 [('0', 'print0', None, _('end fields with NUL')),
4704 ('', 'all', None, _('print all revisions that match')),
4705 ('a', 'text', None, _('treat all files as text')),
4706 ('f', 'follow', None,
4707 _('follow changeset history,'
4708 ' or file history across copies and renames')),
4709 ('i', 'ignore-case', None, _('ignore case when matching')),
4710 ('l', 'files-with-matches', None,
4711 _('print only filenames and revisions that match')),
4712 ('n', 'line-number', None, _('print matching line numbers')),
4713 ('r', 'rev', [],
4714 _('only search files changed within revision range'), _('REV')),
4715 ('u', 'user', None, _('list the author (long with -v)')),
4716 ('d', 'date', None, _('list the date (short with -q)')),
4717 ] + walkopts,
4718 _('[OPTION]... PATTERN [FILE]...')),
4719 "heads":
4720 (heads,
4721 [('r', 'rev', '',
4722 _('show only heads which are descendants of STARTREV'),
4723 _('STARTREV')),
4724 ('t', 'topo', False, _('show topological heads only')),
4725 ('a', 'active', False,
4726 _('show active branchheads only (DEPRECATED)')),
4727 ('c', 'closed', False,
4728 _('show normal and closed branch heads')),
4729 ] + templateopts,
4730 _('[-ac] [-r STARTREV] [REV]...')),
4731 "help": (help_,
4732 [('e', 'extension', None, _('show only help for extensions')),
4733 ('c', 'command', None, _('show only help for commands'))],
4734 _('[-ec] [TOPIC]')),
4735 "identify|id":
4736 (identify,
4737 [('r', 'rev', '',
4738 _('identify the specified revision'), _('REV')),
4739 ('n', 'num', None, _('show local revision number')),
4740 ('i', 'id', None, _('show global revision id')),
4741 ('b', 'branch', None, _('show branch')),
4742 ('t', 'tags', None, _('show tags')),
4743 ('B', 'bookmarks', None, _('show bookmarks'))],
4744 _('[-nibtB] [-r REV] [SOURCE]')),
4745 "import|patch":
4746 (import_,
4747 [('p', 'strip', 1,
4748 _('directory strip option for patch. This has the same '
4749 'meaning as the corresponding patch option'),
4750 _('NUM')),
4751 ('b', 'base', '',
4752 _('base path'), _('PATH')),
4753 ('f', 'force', None,
4754 _('skip check for outstanding uncommitted changes')),
4755 ('', 'no-commit', None,
4756 _("don't commit, just update the working directory")),
4757 ('', 'exact', None,
4758 _('apply patch to the nodes from which it was generated')),
4759 ('', 'import-branch', None,
4760 _('use any branch information in patch (implied by --exact)'))] +
4761 commitopts + commitopts2 + similarityopts,
4762 _('[OPTION]... PATCH...')),
4763 "incoming|in":
4764 (incoming,
4765 [('f', 'force', None,
4766 _('run even if remote repository is unrelated')),
4767 ('n', 'newest-first', None, _('show newest record first')),
4768 ('', 'bundle', '',
4769 _('file to store the bundles into'), _('FILE')),
4770 ('r', 'rev', [],
4771 _('a remote changeset intended to be added'), _('REV')),
4772 ('B', 'bookmarks', False, _("compare bookmarks")),
4773 ('b', 'branch', [],
4774 _('a specific branch you would like to pull'), _('BRANCH')),
4775 ] + logopts + remoteopts + subrepoopts,
4776 _('[-p] [-n] [-M] [-f] [-r REV]...'
4777 ' [--bundle FILENAME] [SOURCE]')),
4778 "^init":
4779 (init,
4780 remoteopts,
4781 _('[-e CMD] [--remotecmd CMD] [DEST]')),
4782 "locate":
4783 (locate,
4784 [('r', 'rev', '',
4785 _('search the repository as it is in REV'), _('REV')),
4786 ('0', 'print0', None,
4787 _('end filenames with NUL, for use with xargs')),
4788 ('f', 'fullpath', None,
4789 _('print complete paths from the filesystem root')),
4790 ] + walkopts,
4791 _('[OPTION]... [PATTERN]...')),
4792 "^log|history":
4793 (log,
4794 [('f', 'follow', None,
4795 _('follow changeset history,'
4796 ' or file history across copies and renames')),
4797 ('', 'follow-first', None,
4798 _('only follow the first parent of merge changesets')),
4799 ('d', 'date', '',
4800 _('show revisions matching date spec'), _('DATE')),
4801 ('C', 'copies', None, _('show copied files')),
4802 ('k', 'keyword', [],
4803 _('do case-insensitive search for a given text'), _('TEXT')),
4804 ('r', 'rev', [],
4805 _('show the specified revision or range'), _('REV')),
4806 ('', 'removed', None, _('include revisions where files were removed')),
4807 ('m', 'only-merges', None, _('show only merges')),
4808 ('u', 'user', [],
4809 _('revisions committed by user'), _('USER')),
4810 ('', 'only-branch', [],
4811 _('show only changesets within the given named branch (DEPRECATED)'),
4812 _('BRANCH')),
4813 ('b', 'branch', [],
4814 _('show changesets within the given named branch'), _('BRANCH')),
4815 ('P', 'prune', [],
4816 _('do not display revision or any of its ancestors'), _('REV')),
4817 ] + logopts + walkopts,
4818 _('[OPTION]... [FILE]')),
4819 "manifest":
4820 (manifest,
4821 [('r', 'rev', '',
4822 _('revision to display'), _('REV'))],
4823 _('[-r REV]')),
4824 "^merge":
4825 (merge,
4826 [('f', 'force', None, _('force a merge with outstanding changes')),
4827 ('t', 'tool', '', _('specify merge tool')),
4828 ('r', 'rev', '',
4829 _('revision to merge'), _('REV')),
4830 ('P', 'preview', None,
4831 _('review revisions to merge (no merge is performed)'))],
4832 _('[-P] [-f] [[-r] REV]')),
4833 "outgoing|out":
4834 (outgoing,
4835 [('f', 'force', None,
4836 _('run even when the destination is unrelated')),
4837 ('r', 'rev', [],
4838 _('a changeset intended to be included in the destination'),
4839 _('REV')),
4840 ('n', 'newest-first', None, _('show newest record first')),
4841 ('B', 'bookmarks', False, _("compare bookmarks")),
4842 ('b', 'branch', [],
4843 _('a specific branch you would like to push'), _('BRANCH')),
4844 ] + logopts + remoteopts + subrepoopts,
4845 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')),
4846 "parents":
4847 (parents,
4848 [('r', 'rev', '',
4849 _('show parents of the specified revision'), _('REV')),
4850 ] + templateopts,
4851 _('[-r REV] [FILE]')),
4852 "paths": (paths, [], _('[NAME]')),
4853 "^pull":
4854 (pull,
4855 [('u', 'update', None,
4856 _('update to new branch head if changesets were pulled')),
4857 ('f', 'force', None,
4858 _('run even when remote repository is unrelated')),
4859 ('r', 'rev', [],
4860 _('a remote changeset intended to be added'), _('REV')),
4861 ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
4862 ('b', 'branch', [],
4863 _('a specific branch you would like to pull'), _('BRANCH')),
4864 ] + remoteopts,
4865 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')),
4866 "^push":
4867 (push,
4868 [('f', 'force', None, _('force push')),
4869 ('r', 'rev', [],
4870 _('a changeset intended to be included in the destination'),
4871 _('REV')),
4872 ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
4873 ('b', 'branch', [],
4874 _('a specific branch you would like to push'), _('BRANCH')),
4875 ('', 'new-branch', False, _('allow pushing a new branch')),
4876 ] + remoteopts,
4877 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')),
4878 "recover": (recover, []),
4879 "^remove|rm":
4880 (remove,
4881 [('A', 'after', None, _('record delete for missing files')),
4882 ('f', 'force', None,
4883 _('remove (and delete) file even if added or modified')),
4884 ] + walkopts,
4885 _('[OPTION]... FILE...')),
4886 "rename|move|mv":
4887 (rename,
4888 [('A', 'after', None, _('record a rename that has already occurred')),
4889 ('f', 'force', None,
4890 _('forcibly copy over an existing managed file')),
4891 ] + walkopts + dryrunopts,
4892 _('[OPTION]... SOURCE... DEST')),
4893 "resolve":
4894 (resolve,
4895 [('a', 'all', None, _('select all unresolved files')),
4896 ('l', 'list', None, _('list state of files needing merge')),
4897 ('m', 'mark', None, _('mark files as resolved')),
4898 ('u', 'unmark', None, _('mark files as unresolved')),
4899 ('t', 'tool', '', _('specify merge tool')),
4900 ('n', 'no-status', None, _('hide status prefix'))]
4901 + walkopts,
4902 _('[OPTION]... [FILE]...')),
4903 "revert":
4904 (revert,
4905 [('a', 'all', None, _('revert all changes when no arguments given')),
4906 ('d', 'date', '',
4907 _('tipmost revision matching date'), _('DATE')),
4908 ('r', 'rev', '',
4909 _('revert to the specified revision'), _('REV')),
4910 ('', 'no-backup', None, _('do not save backup copies of files')),
4911 ] + walkopts + dryrunopts,
4912 _('[OPTION]... [-r REV] [NAME]...')),
4913 "rollback": (rollback, dryrunopts),
4914 "root": (root, []),
4915 "^serve":
4916 (serve,
4917 [('A', 'accesslog', '',
4918 _('name of access log file to write to'), _('FILE')),
4919 ('d', 'daemon', None, _('run server in background')),
4920 ('', 'daemon-pipefds', '',
4921 _('used internally by daemon mode'), _('NUM')),
4922 ('E', 'errorlog', '',
4923 _('name of error log file to write to'), _('FILE')),
4924 # use string type, then we can check if something was passed
4925 ('p', 'port', '',
4926 _('port to listen on (default: 8000)'), _('PORT')),
4927 ('a', 'address', '',
4928 _('address to listen on (default: all interfaces)'), _('ADDR')),
4929 ('', 'prefix', '',
4930 _('prefix path to serve from (default: server root)'), _('PREFIX')),
4931 ('n', 'name', '',
4932 _('name to show in web pages (default: working directory)'),
4933 _('NAME')),
4934 ('', 'web-conf', '',
4935 _('name of the hgweb config file (see "hg help hgweb")'),
4936 _('FILE')),
4937 ('', 'webdir-conf', '',
4938 _('name of the hgweb config file (DEPRECATED)'), _('FILE')),
4939 ('', 'pid-file', '',
4940 _('name of file to write process ID to'), _('FILE')),
4941 ('', 'stdio', None, _('for remote clients')),
4942 ('t', 'templates', '',
4943 _('web templates to use'), _('TEMPLATE')),
4944 ('', 'style', '',
4945 _('template style to use'), _('STYLE')),
4946 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
4947 ('', 'certificate', '',
4948 _('SSL certificate file'), _('FILE'))],
4949 _('[OPTION]...')),
4950 "showconfig|debugconfig":
4951 (showconfig,
4952 [('u', 'untrusted', None, _('show untrusted configuration options'))],
4953 _('[-u] [NAME]...')),
4954 "^summary|sum":
4955 (summary,
4956 [('', 'remote', None, _('check for push and pull'))], '[--remote]'),
4957 "^status|st":
4958 (status,
4959 [('A', 'all', None, _('show status of all files')),
4960 ('m', 'modified', None, _('show only modified files')),
4961 ('a', 'added', None, _('show only added files')),
4962 ('r', 'removed', None, _('show only removed files')),
4963 ('d', 'deleted', None, _('show only deleted (but tracked) files')),
4964 ('c', 'clean', None, _('show only files without changes')),
4965 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
4966 ('i', 'ignored', None, _('show only ignored files')),
4967 ('n', 'no-status', None, _('hide status prefix')),
4968 ('C', 'copies', None, _('show source of copied files')),
4969 ('0', 'print0', None,
4970 _('end filenames with NUL, for use with xargs')),
4971 ('', 'rev', [],
4972 _('show difference from revision'), _('REV')),
4973 ('', 'change', '',
4974 _('list the changed files of a revision'), _('REV')),
4975 ] + walkopts + subrepoopts,
4976 _('[OPTION]... [FILE]...')),
4977 "tag":
4978 (tag,
4979 [('f', 'force', None, _('force tag')),
4980 ('l', 'local', None, _('make the tag local')),
4981 ('r', 'rev', '',
4982 _('revision to tag'), _('REV')),
4983 ('', 'remove', None, _('remove a tag')),
4984 # -l/--local is already there, commitopts cannot be used
4985 ('e', 'edit', None, _('edit commit message')),
4986 ('m', 'message', '',
4987 _('use <text> as commit message'), _('TEXT')),
4988 ] + commitopts2,
4989 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')),
4990 "tags": (tags, [], ''),
4991 "tip":
4992 (tip,
4993 [('p', 'patch', None, _('show patch')),
4994 ('g', 'git', None, _('use git extended diff format')),
4995 ] + templateopts,
4996 _('[-p] [-g]')),
4997 "unbundle":
4998 (unbundle,
4999 [('u', 'update', None,
5000 _('update to new branch head if changesets were unbundled'))],
5001 _('[-u] FILE...')),
5002 "^update|up|checkout|co":
5003 (update,
5004 [('C', 'clean', None, _('discard uncommitted changes (no backup)')),
5005 ('c', 'check', None,
5006 _('update across branches if no uncommitted changes')),
5007 ('d', 'date', '',
5008 _('tipmost revision matching date'), _('DATE')),
5009 ('r', 'rev', '',
5010 _('revision'), _('REV'))],
5011 _('[-c] [-C] [-d DATE] [[-r] REV]')),
5012 "verify": (verify, []),
5013 "version": (version_, []),
5014 }
5015
5016 norepo = ("clone init version help debugcommands debugcomplete"
4884 norepo = ("clone init version help debugcommands debugcomplete"
5017 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
4885 " debugdate debuginstall debugfsinfo debugpushkey debugwireargs"
5018 " debugknown debuggetbundle debugbundle")
4886 " debugknown debuggetbundle debugbundle")
General Comments 0
You need to be logged in to leave comments. Login now