##// END OF EJS Templates
commands: initial audit of exit codes...
Matt Mackall -
r11177:6a648132 default
parent child Browse files
Show More
@@ -548,7 +548,7 b' def copy(ui, repo, pats, opts, rename=Fa'
548 if errors:
548 if errors:
549 ui.warn(_('(consider using --after)\n'))
549 ui.warn(_('(consider using --after)\n'))
550
550
551 return errors
551 return errors != 0
552
552
553 def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
553 def service(opts, parentfn=None, initfn=None, runfn=None, logfile=None,
554 runargs=None, appendpid=False):
554 runargs=None, appendpid=False):
@@ -75,6 +75,8 b' def addremove(ui, repo, *pats, **opts):'
75 option takes a percentage between 0 (disabled) and 100 (files must
75 option takes a percentage between 0 (disabled) and 100 (files must
76 be identical) as its parameter. Detecting renamed files this way
76 be identical) as its parameter. Detecting renamed files this way
77 can be expensive.
77 can be expensive.
78
79 Returns 0 if all files are successfully added.
78 """
80 """
79 try:
81 try:
80 sim = float(opts.get('similarity') or 0)
82 sim = float(opts.get('similarity') or 0)
@@ -97,6 +99,8 b' def annotate(ui, repo, *pats, **opts):'
97 it detects as binary. With -a, annotate will annotate the file
99 it detects as binary. With -a, annotate will annotate the file
98 anyway, although the results will probably be neither useful
100 anyway, although the results will probably be neither useful
99 nor desirable.
101 nor desirable.
102
103 Returns 0 on success.
100 """
104 """
101 if opts.get('follow'):
105 if opts.get('follow'):
102 # --follow is deprecated and now just an alias for -f/--file
106 # --follow is deprecated and now just an alias for -f/--file
@@ -176,6 +180,8 b' def archive(ui, repo, dest, **opts):'
176 prepended. Use -p/--prefix to specify a format string for the
180 prepended. Use -p/--prefix to specify a format string for the
177 prefix. The default is the basename of the archive, with suffixes
181 prefix. The default is the basename of the archive, with suffixes
178 removed.
182 removed.
183
184 Returns 0 on success.
179 '''
185 '''
180
186
181 ctx = repo[opts.get('rev')]
187 ctx = repo[opts.get('rev')]
@@ -230,6 +236,8 b' def backout(ui, repo, node=None, rev=Non'
230 The result of this merge is not committed, as with a normal merge.
236 The result of this merge is not committed, as with a normal merge.
231
237
232 See :hg:`help dates` for a list of formats valid for -d/--date.
238 See :hg:`help dates` for a list of formats valid for -d/--date.
239
240 Returns 0 on success.
233 '''
241 '''
234 if rev and node:
242 if rev and node:
235 raise util.Abort(_("please specify just one revision"))
243 raise util.Abort(_("please specify just one revision"))
@@ -323,6 +331,8 b' def bisect(ui, repo, rev=None, extra=Non'
323 status 0 means good, 125 means to skip the revision, 127
331 status 0 means good, 125 means to skip the revision, 127
324 (command not found) will abort the bisection, and any other
332 (command not found) will abort the bisection, and any other
325 non-zero exit status means the revision is bad.
333 non-zero exit status means the revision is bad.
334
335 Returns 0 on success.
326 """
336 """
327 def print_result(nodes, good):
337 def print_result(nodes, good):
328 displayer = cmdutil.show_changeset(ui, repo, {})
338 displayer = cmdutil.show_changeset(ui, repo, {})
@@ -404,7 +414,8 b' def bisect(ui, repo, rev=None, extra=Non'
404 hg.clean(repo, nodes[0], show_stats=False)
414 hg.clean(repo, nodes[0], show_stats=False)
405 finally:
415 finally:
406 hbisect.save_state(repo, state)
416 hbisect.save_state(repo, state)
407 return print_result(nodes, good)
417 print_result(nodes, good)
418 return
408
419
409 # update state
420 # update state
410 node = repo.lookup(rev or '.')
421 node = repo.lookup(rev or '.')
@@ -457,6 +468,8 b' def branch(ui, repo, label=None, **opts)'
457
468
458 Use the command :hg:`update` to switch to an existing branch. Use
469 Use the command :hg:`update` to switch to an existing branch. Use
459 :hg:`commit --close-branch` to mark this branch as closed.
470 :hg:`commit --close-branch` to mark this branch as closed.
471
472 Returns 0 on success.
460 """
473 """
461
474
462 if opts.get('clean'):
475 if opts.get('clean'):
@@ -485,6 +498,8 b' def branches(ui, repo, active=False, clo'
485 is considered active if it contains repository heads.
498 is considered active if it contains repository heads.
486
499
487 Use the command :hg:`update` to switch to an existing branch.
500 Use the command :hg:`update` to switch to an existing branch.
501
502 Returns 0.
488 """
503 """
489
504
490 hexfunc = ui.debugflag and hex or short
505 hexfunc = ui.debugflag and hex or short
@@ -538,6 +553,8 b' def bundle(ui, repo, fname, dest=None, *'
538
553
539 Applying bundles preserves all changeset contents including
554 Applying bundles preserves all changeset contents including
540 permissions, copy/rename information, and revision history.
555 permissions, copy/rename information, and revision history.
556
557 Returns 0 on success, 1 if no changes found.
541 """
558 """
542 revs = opts.get('rev') or None
559 revs = opts.get('rev') or None
543 if revs:
560 if revs:
@@ -583,7 +600,7 b' def bundle(ui, repo, fname, dest=None, *'
583
600
584 if not o:
601 if not o:
585 ui.status(_("no changes found\n"))
602 ui.status(_("no changes found\n"))
586 return
603 return 1
587
604
588 if revs:
605 if revs:
589 cg = repo.changegroupsubset(o, revs, 'bundle')
606 cg = repo.changegroupsubset(o, revs, 'bundle')
@@ -612,6 +629,8 b' def cat(ui, repo, file1, *pats, **opts):'
612 :``%s``: basename of file being printed
629 :``%s``: basename of file being printed
613 :``%d``: dirname of file being printed, or '.' if in repository root
630 :``%d``: dirname of file being printed, or '.' if in repository root
614 :``%p``: root-relative path name of file being printed
631 :``%p``: root-relative path name of file being printed
632
633 Returns 0 on success.
615 """
634 """
616 ctx = repo[opts.get('rev')]
635 ctx = repo[opts.get('rev')]
617 err = 1
636 err = 1
@@ -686,17 +705,21 b' def clone(ui, source, dest=None, **opts)'
686 f) the tipmost head specified with the url#branch source syntax
705 f) the tipmost head specified with the url#branch source syntax
687 g) the tipmost head of the default branch
706 g) the tipmost head of the default branch
688 h) tip
707 h) tip
708
709 Returns 0 on success.
689 """
710 """
690 if opts.get('noupdate') and opts.get('updaterev'):
711 if opts.get('noupdate') and opts.get('updaterev'):
691 raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
712 raise util.Abort(_("cannot specify both --noupdate and --updaterev"))
692
713
693 hg.clone(cmdutil.remoteui(ui, opts), source, dest,
714 r = hg.clone(cmdutil.remoteui(ui, opts), source, dest,
694 pull=opts.get('pull'),
715 pull=opts.get('pull'),
695 stream=opts.get('uncompressed'),
716 stream=opts.get('uncompressed'),
696 rev=opts.get('rev'),
717 rev=opts.get('rev'),
697 update=opts.get('updaterev') or not opts.get('noupdate'),
718 update=opts.get('updaterev') or not opts.get('noupdate'),
698 branch=opts.get('branch'))
719 branch=opts.get('branch'))
699
720
721 return r is None
722
700 def commit(ui, repo, *pats, **opts):
723 def commit(ui, repo, *pats, **opts):
701 """commit the specified files or all outstanding changes
724 """commit the specified files or all outstanding changes
702
725
@@ -714,6 +737,8 b' def commit(ui, repo, *pats, **opts):'
714 started to prompt you for a message.
737 started to prompt you for a message.
715
738
716 See :hg:`help dates` for a list of formats valid for -d/--date.
739 See :hg:`help dates` for a list of formats valid for -d/--date.
740
741 Returns 0 on success, 1 if nothing changed.
717 """
742 """
718 extra = {}
743 extra = {}
719 if opts.get('close_branch'):
744 if opts.get('close_branch'):
@@ -736,7 +761,7 b' def commit(ui, repo, *pats, **opts):'
736 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
761 node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
737 if not node:
762 if not node:
738 ui.status(_("nothing changed\n"))
763 ui.status(_("nothing changed\n"))
739 return
764 return 1
740
765
741 ctx = repo[node]
766 ctx = repo[node]
742 parents = ctx.parents()
767 parents = ctx.parents()
@@ -767,6 +792,8 b' def copy(ui, repo, *pats, **opts):'
767
792
768 This command takes effect with the next commit. To undo a copy
793 This command takes effect with the next commit. To undo a copy
769 before that, see hg revert.
794 before that, see hg revert.
795
796 Returns 0 on success, 1 if errors are encountered.
770 """
797 """
771 wlock = repo.wlock(False)
798 wlock = repo.wlock(False)
772 try:
799 try:
@@ -793,6 +820,7 b' def debugancestor(ui, repo, *args):'
793 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
820 ui.write("%d:%s\n" % (r.rev(a), hex(a)))
794
821
795 def debugcommands(ui, cmd='', *args):
822 def debugcommands(ui, cmd='', *args):
823 """list all available commands and options"""
796 for cmd, vals in sorted(table.iteritems()):
824 for cmd, vals in sorted(table.iteritems()):
797 cmd = cmd.split('|')[0].strip('^')
825 cmd = cmd.split('|')[0].strip('^')
798 opts = ', '.join([i[1] for i in vals[1]])
826 opts = ', '.join([i[1] for i in vals[1]])
@@ -823,6 +851,7 b" def debugcomplete(ui, cmd='', **opts):"
823 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
851 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
824
852
825 def debugfsinfo(ui, path = "."):
853 def debugfsinfo(ui, path = "."):
854 """show information detected about current filesystem"""
826 open('.debugfsinfo', 'w').write('')
855 open('.debugfsinfo', 'w').write('')
827 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
856 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
828 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
857 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
@@ -879,6 +908,8 b' def showconfig(ui, repo, *values, **opts'
879
908
880 With --debug, the source (filename and line number) is printed
909 With --debug, the source (filename and line number) is printed
881 for each config item.
910 for each config item.
911
912 Returns 0 on success.
882 """
913 """
883
914
884 for f in util.rcpath():
915 for f in util.rcpath():
@@ -909,6 +940,8 b' def debugsetparents(ui, repo, rev1, rev2'
909
940
910 This is useful for writing repository conversion tools, but should
941 This is useful for writing repository conversion tools, but should
911 be used with care.
942 be used with care.
943
944 Returns 0 on success.
912 """
945 """
913
946
914 if not rev2:
947 if not rev2:
@@ -1000,7 +1033,10 b' def debugindexdot(ui, file_):'
1000 ui.write("}\n")
1033 ui.write("}\n")
1001
1034
1002 def debuginstall(ui):
1035 def debuginstall(ui):
1003 '''test Mercurial installation'''
1036 '''test Mercurial installation
1037
1038 Returns 0 on success.
1039 '''
1004
1040
1005 def writetemp(contents):
1041 def writetemp(contents):
1006 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1042 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
@@ -1161,6 +1197,8 b' def diff(ui, repo, *pats, **opts):'
1161
1197
1162 Use the -g/--git option to generate diffs in the git extended diff
1198 Use the -g/--git option to generate diffs in the git extended diff
1163 format. For more information, read :hg:`help diffs`.
1199 format. For more information, read :hg:`help diffs`.
1200
1201 Returns 0 on success.
1164 """
1202 """
1165
1203
1166 revs = opts.get('rev')
1204 revs = opts.get('rev')
@@ -1218,6 +1256,8 b' def export(ui, repo, *changesets, **opts'
1218
1256
1219 With the --switch-parent option, the diff will be against the
1257 With the --switch-parent option, the diff will be against the
1220 second parent. It can be useful to review a merge.
1258 second parent. It can be useful to review a merge.
1259
1260 Returns 0 on success.
1221 """
1261 """
1222 changesets += tuple(opts.get('rev', []))
1262 changesets += tuple(opts.get('rev', []))
1223 if not changesets:
1263 if not changesets:
@@ -1242,6 +1282,8 b' def forget(ui, repo, *pats, **opts):'
1242 working directory.
1282 working directory.
1243
1283
1244 To undo a forget before the next commit, see hg add.
1284 To undo a forget before the next commit, see hg add.
1285
1286 Returns 0 on success.
1245 """
1287 """
1246
1288
1247 if not pats:
1289 if not pats:
@@ -1250,17 +1292,20 b' def forget(ui, repo, *pats, **opts):'
1250 m = cmdutil.match(repo, pats, opts)
1292 m = cmdutil.match(repo, pats, opts)
1251 s = repo.status(match=m, clean=True)
1293 s = repo.status(match=m, clean=True)
1252 forget = sorted(s[0] + s[1] + s[3] + s[6])
1294 forget = sorted(s[0] + s[1] + s[3] + s[6])
1295 errs = 0
1253
1296
1254 for f in m.files():
1297 for f in m.files():
1255 if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
1298 if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
1256 ui.warn(_('not removing %s: file is already untracked\n')
1299 ui.warn(_('not removing %s: file is already untracked\n')
1257 % m.rel(f))
1300 % m.rel(f))
1301 errs = 1
1258
1302
1259 for f in forget:
1303 for f in forget:
1260 if ui.verbose or not m.exact(f):
1304 if ui.verbose or not m.exact(f):
1261 ui.status(_('removing %s\n') % m.rel(f))
1305 ui.status(_('removing %s\n') % m.rel(f))
1262
1306
1263 repo.remove(forget, unlink=False)
1307 repo.remove(forget, unlink=False)
1308 return errs
1264
1309
1265 def grep(ui, repo, pattern, *pats, **opts):
1310 def grep(ui, repo, pattern, *pats, **opts):
1266 """search for a pattern in specified files and revisions
1311 """search for a pattern in specified files and revisions
@@ -1277,6 +1322,8 b' def grep(ui, repo, pattern, *pats, **opt'
1277 that contains a change in match status ("-" for a match that
1322 that contains a change in match status ("-" for a match that
1278 becomes a non-match, or "+" for a non-match that becomes a match),
1323 becomes a non-match, or "+" for a non-match that becomes a match),
1279 use the --all flag.
1324 use the --all flag.
1325
1326 Returns 0 if a match is found, 1 otherwise.
1280 """
1327 """
1281 reflags = 0
1328 reflags = 0
1282 if opts.get('ignore_case'):
1329 if opts.get('ignore_case'):
@@ -1285,7 +1332,7 b' def grep(ui, repo, pattern, *pats, **opt'
1285 regexp = re.compile(pattern, reflags)
1332 regexp = re.compile(pattern, reflags)
1286 except Exception, inst:
1333 except Exception, inst:
1287 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
1334 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
1288 return None
1335 return 1
1289 sep, eol = ':', '\n'
1336 sep, eol = ':', '\n'
1290 if opts.get('print0'):
1337 if opts.get('print0'):
1291 sep = eol = '\0'
1338 sep = eol = '\0'
@@ -1443,6 +1490,8 b' def grep(ui, repo, pattern, *pats, **opt'
1443 del matches[rev]
1490 del matches[rev]
1444 del revfiles[rev]
1491 del revfiles[rev]
1445
1492
1493 return not found
1494
1446 def heads(ui, repo, *branchrevs, **opts):
1495 def heads(ui, repo, *branchrevs, **opts):
1447 """show current repository heads or show branch heads
1496 """show current repository heads or show branch heads
1448
1497
@@ -1464,6 +1513,8 b' def heads(ui, repo, *branchrevs, **opts)'
1464
1513
1465 If -t/--topo is specified, named branch mechanics will be ignored and only
1514 If -t/--topo is specified, named branch mechanics will be ignored and only
1466 changesets without children will be shown.
1515 changesets without children will be shown.
1516
1517 Returns 0 if matching heads are found, 1 if not.
1467 """
1518 """
1468
1519
1469 if opts.get('rev'):
1520 if opts.get('rev'):
@@ -1521,7 +1572,10 b' def help_(ui, name=None, with_version=Fa'
1521 With no arguments, print a list of commands with short help messages.
1572 With no arguments, print a list of commands with short help messages.
1522
1573
1523 Given a topic, extension, or command name, print help for that
1574 Given a topic, extension, or command name, print help for that
1524 topic."""
1575 topic.
1576
1577 Returns 0 if successful.
1578 """
1525 option_lists = []
1579 option_lists = []
1526 textwidth = util.termwidth() - 2
1580 textwidth = util.termwidth() - 2
1527
1581
@@ -1779,6 +1833,8 b' def identify(ui, repo, source=None,'
1779 parent hash identifiers, followed by a "+" if there are
1833 parent hash identifiers, followed by a "+" if there are
1780 uncommitted changes in the working directory, a list of tags for
1834 uncommitted changes in the working directory, a list of tags for
1781 this revision and a branch name for non-default branches.
1835 this revision and a branch name for non-default branches.
1836
1837 Returns 0 if successful.
1782 """
1838 """
1783
1839
1784 if not repo and not source:
1840 if not repo and not source:
@@ -1874,6 +1930,8 b' def import_(ui, repo, patch1, *patches, '
1874 To read a patch from standard input, use "-" as the patch name. If
1930 To read a patch from standard input, use "-" as the patch name. If
1875 a URL is specified, the patch will be downloaded from it.
1931 a URL is specified, the patch will be downloaded from it.
1876 See :hg:`help dates` for a list of formats valid for -d/--date.
1932 See :hg:`help dates` for a list of formats valid for -d/--date.
1933
1934 Returns 0 on success.
1877 """
1935 """
1878 patches = (patch1,) + patches
1936 patches = (patch1,) + patches
1879
1937
@@ -2007,6 +2065,8 b' def incoming(ui, repo, source="default",'
2007 changesets twice if the incoming is followed by a pull.
2065 changesets twice if the incoming is followed by a pull.
2008
2066
2009 See pull for valid source format details.
2067 See pull for valid source format details.
2068
2069 Returns 0 if there are incoming changes, 1 otherwise.
2010 """
2070 """
2011 limit = cmdutil.loglimit(opts)
2071 limit = cmdutil.loglimit(opts)
2012 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
2072 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
@@ -2077,6 +2137,8 b' def init(ui, dest=".", **opts):'
2077
2137
2078 It is possible to specify an ``ssh://`` URL as the destination.
2138 It is possible to specify an ``ssh://`` URL as the destination.
2079 See :hg:`help urls` for more information.
2139 See :hg:`help urls` for more information.
2140
2141 Returns 0 on success.
2080 """
2142 """
2081 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1)
2143 hg.repository(cmdutil.remoteui(ui, opts), dest, create=1)
2082
2144
@@ -2097,6 +2159,8 b' def locate(ui, repo, *pats, **opts):'
2097 command, use the -0 option to both this command and "xargs". This
2159 command, use the -0 option to both this command and "xargs". This
2098 will avoid the problem of "xargs" treating single filenames that
2160 will avoid the problem of "xargs" treating single filenames that
2099 contain whitespace as multiple filenames.
2161 contain whitespace as multiple filenames.
2162
2163 Returns 0 if a match is found, 1 otherwise.
2100 """
2164 """
2101 end = opts.get('print0') and '\0' or '\n'
2165 end = opts.get('print0') and '\0' or '\n'
2102 rev = opts.get('rev') or None
2166 rev = opts.get('rev') or None
@@ -2142,6 +2206,8 b' def log(ui, repo, *pats, **opts):'
2142 changesets, as it will only compare the merge changeset against
2206 changesets, as it will only compare the merge changeset against
2143 its first parent. Also, only files different from BOTH parents
2207 its first parent. Also, only files different from BOTH parents
2144 will appear in files:.
2208 will appear in files:.
2209
2210 Returns 0 on success.
2145 """
2211 """
2146
2212
2147 matchfn = cmdutil.match(repo, pats, opts)
2213 matchfn = cmdutil.match(repo, pats, opts)
@@ -2210,6 +2276,8 b' def manifest(ui, repo, node=None, rev=No'
2210
2276
2211 With -v, print file permissions, symlink and executable bits.
2277 With -v, print file permissions, symlink and executable bits.
2212 With --debug, print file revision hashes.
2278 With --debug, print file revision hashes.
2279
2280 Returns 0 on success.
2213 """
2281 """
2214
2282
2215 if rev and node:
2283 if rev and node:
@@ -2242,6 +2310,8 b' def merge(ui, repo, node=None, **opts):'
2242 head revision, and the current branch contains exactly one other
2310 head revision, and the current branch contains exactly one other
2243 head, the other head is merged with by default. Otherwise, an
2311 head, the other head is merged with by default. Otherwise, an
2244 explicit revision with which to merge with must be provided.
2312 explicit revision with which to merge with must be provided.
2313
2314 Returns 0 on success, 1 if there are unresolved files.
2245 """
2315 """
2246
2316
2247 if opts.get('rev') and node:
2317 if opts.get('rev') and node:
@@ -2298,6 +2368,8 b' def outgoing(ui, repo, dest=None, **opts'
2298 be pushed if a push was requested.
2368 be pushed if a push was requested.
2299
2369
2300 See pull for details of valid destination formats.
2370 See pull for details of valid destination formats.
2371
2372 Returns 0 if there are outgoing changes, 1 otherwise.
2301 """
2373 """
2302 limit = cmdutil.loglimit(opts)
2374 limit = cmdutil.loglimit(opts)
2303 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2375 dest = ui.expandpath(dest or 'default-push', dest or 'default')
@@ -2335,6 +2407,8 b' def parents(ui, repo, file_=None, **opts'
2335 If a file argument is given, the revision in which the file was
2407 If a file argument is given, the revision in which the file was
2336 last changed (before the working directory revision or the
2408 last changed (before the working directory revision or the
2337 argument to --rev if given) is printed.
2409 argument to --rev if given) is printed.
2410
2411 Returns 0 on success.
2338 """
2412 """
2339 rev = opts.get('rev')
2413 rev = opts.get('rev')
2340 if rev:
2414 if rev:
@@ -2432,6 +2506,8 b' def pull(ui, repo, source="default", **o'
2432
2506
2433 If SOURCE is omitted, the 'default' path will be used.
2507 If SOURCE is omitted, the 'default' path will be used.
2434 See :hg:`help urls` for more information.
2508 See :hg:`help urls` for more information.
2509
2510 Returns 0 on success, 1 if an update had unresolved files.
2435 """
2511 """
2436 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
2512 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
2437 other = hg.repository(cmdutil.remoteui(repo, opts), source)
2513 other = hg.repository(cmdutil.remoteui(repo, opts), source)
@@ -2469,6 +2545,8 b' def push(ui, repo, dest=None, **opts):'
2469
2545
2470 Please see :hg:`help urls` for important details about ``ssh://``
2546 Please see :hg:`help urls` for important details about ``ssh://``
2471 URLs. If DESTINATION is omitted, a default path will be used.
2547 URLs. If DESTINATION is omitted, a default path will be used.
2548
2549 Returns 0 if push was successful, 1 if nothing to push.
2472 """
2550 """
2473 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2551 dest = ui.expandpath(dest or 'default-push', dest or 'default')
2474 dest, branches = hg.parseurl(dest, opts.get('branch'))
2552 dest, branches = hg.parseurl(dest, opts.get('branch'))
@@ -2496,6 +2574,8 b' def recover(ui, repo):'
2496 This command tries to fix the repository status after an
2574 This command tries to fix the repository status after an
2497 interrupted operation. It should only be necessary when Mercurial
2575 interrupted operation. It should only be necessary when Mercurial
2498 suggests it.
2576 suggests it.
2577
2578 Returns 0 if successful, 1 if nothing to recover or verify fails.
2499 """
2579 """
2500 if repo.recover():
2580 if repo.recover():
2501 return hg.verify(repo)
2581 return hg.verify(repo)
@@ -2526,8 +2606,11 b' def remove(ui, repo, *pats, **opts):'
2526
2606
2527 This command schedules the files to be removed at the next commit.
2607 This command schedules the files to be removed at the next commit.
2528 To undo a remove before that, see hg revert.
2608 To undo a remove before that, see hg revert.
2609
2610 Returns 0 on success, 1 if any warnings encountered.
2529 """
2611 """
2530
2612
2613 ret = 0
2531 after, force = opts.get('after'), opts.get('force')
2614 after, force = opts.get('after'), opts.get('force')
2532 if not pats and not after:
2615 if not pats and not after:
2533 raise util.Abort(_('no files specified'))
2616 raise util.Abort(_('no files specified'))
@@ -2539,11 +2622,13 b' def remove(ui, repo, *pats, **opts):'
2539 for f in m.files():
2622 for f in m.files():
2540 if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
2623 if f not in repo.dirstate and not os.path.isdir(m.rel(f)):
2541 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
2624 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f))
2625 ret = 1
2542
2626
2543 def warn(files, reason):
2627 def warn(files, reason):
2544 for f in files:
2628 for f in files:
2545 ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
2629 ui.warn(_('not removing %s: file %s (use -f to force removal)\n')
2546 % (m.rel(f), reason))
2630 % (m.rel(f), reason))
2631 ret = 1
2547
2632
2548 if force:
2633 if force:
2549 remove, forget = modified + deleted + clean, added
2634 remove, forget = modified + deleted + clean, added
@@ -2561,6 +2646,7 b' def remove(ui, repo, *pats, **opts):'
2561
2646
2562 repo.forget(forget)
2647 repo.forget(forget)
2563 repo.remove(remove, unlink=not after)
2648 repo.remove(remove, unlink=not after)
2649 return ret
2564
2650
2565 def rename(ui, repo, *pats, **opts):
2651 def rename(ui, repo, *pats, **opts):
2566 """rename files; equivalent of copy + remove
2652 """rename files; equivalent of copy + remove
@@ -2575,6 +2661,8 b' def rename(ui, repo, *pats, **opts):'
2575
2661
2576 This command takes effect at the next commit. To undo a rename
2662 This command takes effect at the next commit. To undo a rename
2577 before that, see hg revert.
2663 before that, see hg revert.
2664
2665 Returns 0 on success, 1 if errors are encountered.
2578 """
2666 """
2579 wlock = repo.wlock(False)
2667 wlock = repo.wlock(False)
2580 try:
2668 try:
@@ -2608,6 +2696,8 b' def resolve(ui, repo, *pats, **opts):'
2608 Note that Mercurial will not let you commit files with unresolved merge
2696 Note that Mercurial will not let you commit files with unresolved merge
2609 conflicts. You must use ``hg resolve -m ...`` before you can commit
2697 conflicts. You must use ``hg resolve -m ...`` before you can commit
2610 after a conflicting merge.
2698 after a conflicting merge.
2699
2700 Returns 0 on success, 1 if any files fail a resolve attempt.
2611 """
2701 """
2612
2702
2613 all, mark, unmark, show, nostatus = \
2703 all, mark, unmark, show, nostatus = \
@@ -2623,6 +2713,7 b' def resolve(ui, repo, *pats, **opts):'
2623
2713
2624 ms = mergemod.mergestate(repo)
2714 ms = mergemod.mergestate(repo)
2625 m = cmdutil.match(repo, pats, opts)
2715 m = cmdutil.match(repo, pats, opts)
2716 ret = 0
2626
2717
2627 for f in ms:
2718 for f in ms:
2628 if m(f):
2719 if m(f):
@@ -2646,10 +2737,12 b' def resolve(ui, repo, *pats, **opts):'
2646 util.copyfile(a, a + ".resolve")
2737 util.copyfile(a, a + ".resolve")
2647
2738
2648 # resolve file
2739 # resolve file
2649 ms.resolve(f, wctx, mctx)
2740 if ms.resolve(f, wctx, mctx):
2741 ret = 1
2650
2742
2651 # replace filemerge's .orig file with our resolve file
2743 # replace filemerge's .orig file with our resolve file
2652 util.rename(a + ".resolve", a + ".orig")
2744 util.rename(a + ".resolve", a + ".orig")
2745 return ret
2653
2746
2654 def revert(ui, repo, *pats, **opts):
2747 def revert(ui, repo, *pats, **opts):
2655 """restore individual files or directories to an earlier state
2748 """restore individual files or directories to an earlier state
@@ -2683,6 +2776,8 b' def revert(ui, repo, *pats, **opts):'
2683
2776
2684 Modified files are saved with a .orig suffix before reverting.
2777 Modified files are saved with a .orig suffix before reverting.
2685 To disable these backups, use --no-backup.
2778 To disable these backups, use --no-backup.
2779
2780 Returns 0 on success.
2686 """
2781 """
2687
2782
2688 if opts["date"]:
2783 if opts["date"]:
@@ -2895,13 +2990,17 b' def rollback(ui, repo, **opts):'
2895 the changes). Furthermore, a race is possible with readers of the
2990 the changes). Furthermore, a race is possible with readers of the
2896 repository; for example an in-progress pull from the repository
2991 repository; for example an in-progress pull from the repository
2897 may fail if a rollback is performed.
2992 may fail if a rollback is performed.
2993
2994 Returns 0 on success, 1 if no rollback data is available.
2898 """
2995 """
2899 repo.rollback(opts.get('dry_run'))
2996 return repo.rollback(opts.get('dry_run'))
2900
2997
2901 def root(ui, repo):
2998 def root(ui, repo):
2902 """print the root (top) of the current working directory
2999 """print the root (top) of the current working directory
2903
3000
2904 Print the root directory of the current repository.
3001 Print the root directory of the current repository.
3002
3003 Returns 0 on success.
2905 """
3004 """
2906 ui.write(repo.root + "\n")
3005 ui.write(repo.root + "\n")
2907
3006
@@ -2926,6 +3025,8 b' def serve(ui, repo, **opts):'
2926 To have the server choose a free port number to listen on, specify
3025 To have the server choose a free port number to listen on, specify
2927 a port number of 0; in this case, the server will print the port
3026 a port number of 0; in this case, the server will print the port
2928 number it uses.
3027 number it uses.
3028
3029 Returns 0 on success.
2929 """
3030 """
2930
3031
2931 if opts["stdio"]:
3032 if opts["stdio"]:
@@ -3032,6 +3133,8 b' def status(ui, repo, *pats, **opts):'
3032 ? = not tracked
3133 ? = not tracked
3033 I = ignored
3134 I = ignored
3034 = origin of the previous file listed as A (added)
3135 = origin of the previous file listed as A (added)
3136
3137 Returns 0 on success.
3035 """
3138 """
3036
3139
3037 revs = opts.get('rev')
3140 revs = opts.get('rev')
@@ -3095,6 +3198,8 b' def summary(ui, repo, **opts):'
3095
3198
3096 With the --remote option, this will check the default paths for
3199 With the --remote option, this will check the default paths for
3097 incoming and outgoing changes. This can be time-consuming.
3200 incoming and outgoing changes. This can be time-consuming.
3201
3202 Returns 0 on success.
3098 """
3203 """
3099
3204
3100 ctx = repo[None]
3205 ctx = repo[None]
@@ -3239,6 +3344,8 b' def tag(ui, repo, name1, *names, **opts)'
3239
3344
3240 Since tag names have priority over branch names during revision
3345 Since tag names have priority over branch names during revision
3241 lookup, using an existing branch name as a tag name is discouraged.
3346 lookup, using an existing branch name as a tag name is discouraged.
3347
3348 Returns 0 on success.
3242 """
3349 """
3243
3350
3244 rev_ = "."
3351 rev_ = "."
@@ -3293,6 +3400,8 b' def tags(ui, repo):'
3293
3400
3294 This lists both regular and local tags. When the -v/--verbose
3401 This lists both regular and local tags. When the -v/--verbose
3295 switch is used, a third column "local" is printed for local tags.
3402 switch is used, a third column "local" is printed for local tags.
3403
3404 Returns 0 on success.
3296 """
3405 """
3297
3406
3298 hexfunc = ui.debugflag and hex or short
3407 hexfunc = ui.debugflag and hex or short
@@ -3328,6 +3437,8 b' def tip(ui, repo, **opts):'
3328 you have just pulled changes from another repository, the tip of
3437 you have just pulled changes from another repository, the tip of
3329 that repository becomes the current tip. The "tip" tag is special
3438 that repository becomes the current tip. The "tip" tag is special
3330 and cannot be renamed or assigned to a different changeset.
3439 and cannot be renamed or assigned to a different changeset.
3440
3441 Returns 0 on success.
3331 """
3442 """
3332 displayer = cmdutil.show_changeset(ui, repo, opts)
3443 displayer = cmdutil.show_changeset(ui, repo, opts)
3333 displayer.show(repo[len(repo) - 1])
3444 displayer.show(repo[len(repo) - 1])
@@ -3338,6 +3449,8 b' def unbundle(ui, repo, fname1, *fnames, '
3338
3449
3339 Apply one or more compressed changegroup files generated by the
3450 Apply one or more compressed changegroup files generated by the
3340 bundle command.
3451 bundle command.
3452
3453 Returns 0 on success, 1 if an update has unresolved files.
3341 """
3454 """
3342 fnames = (fname1,) + fnames
3455 fnames = (fname1,) + fnames
3343
3456
@@ -3386,6 +3499,8 b' def update(ui, repo, node=None, rev=None'
3386 If you want to update just one file to an older changeset, use :hg:`revert`.
3499 If you want to update just one file to an older changeset, use :hg:`revert`.
3387
3500
3388 See :hg:`help dates` for a list of formats valid for -d/--date.
3501 See :hg:`help dates` for a list of formats valid for -d/--date.
3502
3503 Returns 0 on success, 1 if there are unresolved files.
3389 """
3504 """
3390 if rev and node:
3505 if rev and node:
3391 raise util.Abort(_("please specify just one revision"))
3506 raise util.Abort(_("please specify just one revision"))
@@ -3421,6 +3536,8 b' def verify(ui, repo):'
3421 integrity, validating the hashes and checksums of each entry in
3536 integrity, validating the hashes and checksums of each entry in
3422 the changelog, manifest, and tracked files, as well as the
3537 the changelog, manifest, and tracked files, as well as the
3423 integrity of their crosslinks and indices.
3538 integrity of their crosslinks and indices.
3539
3540 Returns 0 on success, 1 if errors are encountered.
3424 """
3541 """
3425 return hg.verify(repo)
3542 return hg.verify(repo)
3426
3543
@@ -647,6 +647,7 b' class localrepository(repo.repository):'
647 self.destroyed()
647 self.destroyed()
648 else:
648 else:
649 self.ui.warn(_("no rollback information available\n"))
649 self.ui.warn(_("no rollback information available\n"))
650 return 1
650 finally:
651 finally:
651 release(lock, wlock)
652 release(lock, wlock)
652
653
@@ -17,6 +17,8 b' output the current or given revision of '
17 "%d" dirname of file being printed, or '.' if in repository root
17 "%d" dirname of file being printed, or '.' if in repository root
18 "%p" root-relative path name of file being printed
18 "%p" root-relative path name of file being printed
19
19
20 Returns 0 on success.
21
20 options:
22 options:
21
23
22 -o --output print output to file with formatted name
24 -o --output print output to file with formatted name
@@ -367,6 +367,8 b' verify the integrity of the repository'
367 manifest, and tracked files, as well as the integrity of their crosslinks
367 manifest, and tracked files, as well as the integrity of their crosslinks
368 and indices.
368 and indices.
369
369
370 Returns 0 on success, 1 if errors are encountered.
371
370 use "hg -v help verify" to show global options
372 use "hg -v help verify" to show global options
371 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
373 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
372
374
@@ -395,6 +397,8 b' diff repository (or selected files)'
395 Use the -g/--git option to generate diffs in the git extended diff format.
397 Use the -g/--git option to generate diffs in the git extended diff format.
396 For more information, read "hg help diffs".
398 For more information, read "hg help diffs".
397
399
400 Returns 0 on success.
401
398 options:
402 options:
399
403
400 -r --rev revision
404 -r --rev revision
@@ -449,6 +453,8 b' show changed files in the working direct'
449 I = ignored
453 I = ignored
450 = origin of the previous file listed as A (added)
454 = origin of the previous file listed as A (added)
451
455
456 Returns 0 on success.
457
452 options:
458 options:
453
459
454 -A --all show status of all files
460 -A --all show status of all files
@@ -8,3 +8,4 b' touch b'
8 hg add b
8 hg add b
9 rm b
9 rm b
10 hg commit -A -m"comment #1" -d "1000000 0"
10 hg commit -A -m"comment #1" -d "1000000 0"
11 exit 0
General Comments 0
You need to be logged in to leave comments. Login now