comparison mercurial/commands.py @ 1602:fb4149eebdd4

strictly adher to 80 chars per line
author Muli Ben-Yehuda <mulix@mulix.org>
date Wed, 28 Dec 2005 00:27:05 -0600
parents a1b25fb2e764
children d72d27ee72b9
comparison
equal deleted inserted replaced
1601:a1b25fb2e764 1602:fb4149eebdd4
461 opt_output.append(("\n%s:\n" % title, None)) 461 opt_output.append(("\n%s:\n" % title, None))
462 for shortopt, longopt, default, desc in options: 462 for shortopt, longopt, default, desc in options:
463 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, 463 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
464 longopt and " --%s" % longopt), 464 longopt and " --%s" % longopt),
465 "%s%s" % (desc, 465 "%s%s" % (desc,
466 default and _(" (default: %s)") % default 466 default
467 and _(" (default: %s)") % default
467 or ""))) 468 or "")))
468 469
469 if opt_output: 470 if opt_output:
470 opts_len = max([len(line[0]) for line in opt_output if line[1]]) 471 opts_len = max([len(line[0]) for line in opt_output if line[1]])
471 for first, second in opt_output: 472 for first, second in opt_output:
728 729
729 else: 730 else:
730 revs = None 731 revs = None
731 if opts['rev']: 732 if opts['rev']:
732 if not other.local(): 733 if not other.local():
733 raise util.Abort("clone -r not supported yet for remote repositories.") 734 error = "clone -r not supported yet for remote repositories."
735 raise util.Abort(error)
734 else: 736 else:
735 revs = [other.lookup(rev) for rev in opts['rev']] 737 revs = [other.lookup(rev) for rev in opts['rev']]
736 repo = hg.repository(ui, dest, create=1) 738 repo = hg.repository(ui, dest, create=1)
737 repo.pull(other, heads = revs) 739 repo.pull(other, heads = revs)
738 740
983 state = repo.dirstate.state(f) 985 state = repo.dirstate.state(f)
984 if state not in "nrm": 986 if state not in "nrm":
985 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) 987 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
986 errors += 1 988 errors += 1
987 if errors: 989 if errors:
988 raise util.Abort(_(".hg/dirstate inconsistent with current parent's manifest")) 990 error = _(".hg/dirstate inconsistent with current parent's manifest")
991 raise util.Abort(error)
989 992
990 def debugconfig(ui): 993 def debugconfig(ui):
991 """show combined config settings from all hgrc files""" 994 """show combined config settings from all hgrc files"""
992 try: 995 try:
993 repo = hg.repository(ui) 996 repo = hg.repository(ui)
1174 raise util.Abort(_("export requires at least one changeset")) 1177 raise util.Abort(_("export requires at least one changeset"))
1175 seqno = 0 1178 seqno = 0
1176 revs = list(revrange(ui, repo, changesets)) 1179 revs = list(revrange(ui, repo, changesets))
1177 total = len(revs) 1180 total = len(revs)
1178 revwidth = max(map(len, revs)) 1181 revwidth = max(map(len, revs))
1179 ui.note(len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n")) 1182 msg = len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n")
1183 ui.note(msg)
1180 for cset in revs: 1184 for cset in revs:
1181 seqno += 1 1185 seqno += 1
1182 doexport(ui, repo, cset, seqno, total, revwidth, opts) 1186 doexport(ui, repo, cset, seqno, total, revwidth, opts)
1183 1187
1184 def forget(ui, repo, *pats, **opts): 1188 def forget(ui, repo, *pats, **opts):
2225 "^clone": 2229 "^clone":
2226 (clone, 2230 (clone,
2227 [('U', 'noupdate', None, _('do not update the new working directory')), 2231 [('U', 'noupdate', None, _('do not update the new working directory')),
2228 ('e', 'ssh', "", _('specify ssh command to use')), 2232 ('e', 'ssh', "", _('specify ssh command to use')),
2229 ('', 'pull', None, _('use pull protocol to copy metadata')), 2233 ('', 'pull', None, _('use pull protocol to copy metadata')),
2230 ('r', 'rev', [], _('a changeset you would like to have after cloning')), 2234 ('r', 'rev', [],
2231 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], 2235 _('a changeset you would like to have after cloning')),
2236 ('', 'remotecmd', "",
2237 _('specify hg command to run on the remote side'))],
2232 _('hg clone [OPTION]... SOURCE [DEST]')), 2238 _('hg clone [OPTION]... SOURCE [DEST]')),
2233 "^commit|ci": 2239 "^commit|ci":
2234 (commit, 2240 (commit,
2235 [('A', 'addremove', None, _('run addremove during commit')), 2241 [('A', 'addremove', None, _('run addremove during commit')),
2236 ('I', 'include', [], _('include names matching the given patterns')), 2242 ('I', 'include', [], _('include names matching the given patterns')),
2239 ('l', 'logfile', "", _('read the commit message from <file>')), 2245 ('l', 'logfile', "", _('read the commit message from <file>')),
2240 ('d', 'date', "", _('record datecode as commit date')), 2246 ('d', 'date', "", _('record datecode as commit date')),
2241 ('u', 'user', "", _('record user as commiter'))], 2247 ('u', 'user', "", _('record user as commiter'))],
2242 _('hg commit [OPTION]... [FILE]...')), 2248 _('hg commit [OPTION]... [FILE]...')),
2243 "copy|cp": (copy, 2249 "copy|cp": (copy,
2244 [('I', 'include', [], _('include names matching the given patterns')), 2250 [('I', 'include', [],
2245 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2251 _('include names matching the given patterns')),
2246 ('A', 'after', None, _('record a copy that has already occurred')), 2252 ('X', 'exclude', [],
2247 ('f', 'force', None, _('forcibly copy over an existing managed file'))], 2253 _('exclude names matching the given patterns')),
2254 ('A', 'after', None,
2255 _('record a copy that has already occurred')),
2256 ('f', 'force', None,
2257 _('forcibly copy over an existing managed file'))],
2248 _('hg copy [OPTION]... [SOURCE]... DEST')), 2258 _('hg copy [OPTION]... [SOURCE]... DEST')),
2249 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), 2259 "debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
2250 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), 2260 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
2251 "debugconfig": (debugconfig, [], _('debugconfig')), 2261 "debugconfig": (debugconfig, [], _('debugconfig')),
2252 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), 2262 "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')),
2283 [('0', 'print0', None, _('end fields with NUL')), 2293 [('0', 'print0', None, _('end fields with NUL')),
2284 ('I', 'include', [], _('include names matching the given patterns')), 2294 ('I', 'include', [], _('include names matching the given patterns')),
2285 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2295 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2286 ('', 'all', None, _('print all revisions that match')), 2296 ('', 'all', None, _('print all revisions that match')),
2287 ('i', 'ignore-case', None, _('ignore case when matching')), 2297 ('i', 'ignore-case', None, _('ignore case when matching')),
2288 ('l', 'files-with-matches', None, _('print only filenames and revs that match')), 2298 ('l', 'files-with-matches', None,
2299 _('print only filenames and revs that match')),
2289 ('n', 'line-number', None, _('print matching line numbers')), 2300 ('n', 'line-number', None, _('print matching line numbers')),
2290 ('r', 'rev', [], _('search in given revision range')), 2301 ('r', 'rev', [], _('search in given revision range')),
2291 ('u', 'user', None, _('print user who committed change'))], 2302 ('u', 'user', None, _('print user who committed change'))],
2292 "hg grep [OPTION]... PATTERN [FILE]..."), 2303 "hg grep [OPTION]... PATTERN [FILE]..."),
2293 "heads": 2304 "heads":
2297 _('hg heads [-b] [-r <rev>]')), 2308 _('hg heads [-b] [-r <rev>]')),
2298 "help": (help_, [], _('hg help [COMMAND]')), 2309 "help": (help_, [], _('hg help [COMMAND]')),
2299 "identify|id": (identify, [], _('hg identify')), 2310 "identify|id": (identify, [], _('hg identify')),
2300 "import|patch": 2311 "import|patch":
2301 (import_, 2312 (import_,
2302 [('p', 'strip', 1, _('directory strip option for patch. This has the same\n') + 2313 [('p', 'strip', 1,
2303 _('meaning as the corresponding patch option')), 2314 _('directory strip option for patch. This has the same\n') +
2304 ('f', 'force', None, _('skip check for outstanding uncommitted changes')), 2315 _('meaning as the corresponding patch option')),
2316 ('f', 'force', None,
2317 _('skip check for outstanding uncommitted changes')),
2305 ('b', 'base', "", _('base path'))], 2318 ('b', 'base', "", _('base path'))],
2306 "hg import [-f] [-p NUM] [-b BASE] PATCH..."), 2319 "hg import [-f] [-p NUM] [-b BASE] PATCH..."),
2307 "incoming|in": (incoming, 2320 "incoming|in": (incoming,
2308 [('M', 'no-merges', None, _("do not show merges")), 2321 [('M', 'no-merges', None, _("do not show merges")),
2309 ('p', 'patch', None, _('show patch')), 2322 ('p', 'patch', None, _('show patch')),
2311 _('hg incoming [-p] [-n] [-M] [SOURCE]')), 2324 _('hg incoming [-p] [-n] [-M] [SOURCE]')),
2312 "^init": (init, [], _('hg init [DEST]')), 2325 "^init": (init, [], _('hg init [DEST]')),
2313 "locate": 2326 "locate":
2314 (locate, 2327 (locate,
2315 [('r', 'rev', '', _('search the repository as it stood at rev')), 2328 [('r', 'rev', '', _('search the repository as it stood at rev')),
2316 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), 2329 ('0', 'print0', None,
2317 ('f', 'fullpath', None, _('print complete paths from the filesystem root')), 2330 _('end filenames with NUL, for use with xargs')),
2331 ('f', 'fullpath', None,
2332 _('print complete paths from the filesystem root')),
2318 ('I', 'include', [], _('include names matching the given patterns')), 2333 ('I', 'include', [], _('include names matching the given patterns')),
2319 ('X', 'exclude', [], _('exclude names matching the given patterns'))], 2334 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2320 _('hg locate [OPTION]... [PATTERN]...')), 2335 _('hg locate [OPTION]... [PATTERN]...')),
2321 "^log|history": 2336 "^log|history":
2322 (log, 2337 (log,
2337 _('hg outgoing [-p] [-n] [-M] [DEST]')), 2352 _('hg outgoing [-p] [-n] [-M] [DEST]')),
2338 "^parents": (parents, [], _('hg parents [REV]')), 2353 "^parents": (parents, [], _('hg parents [REV]')),
2339 "paths": (paths, [], _('hg paths [NAME]')), 2354 "paths": (paths, [], _('hg paths [NAME]')),
2340 "^pull": 2355 "^pull":
2341 (pull, 2356 (pull,
2342 [('u', 'update', None, _('update the working directory to tip after pull')), 2357 [('u', 'update', None,
2358 _('update the working directory to tip after pull')),
2343 ('e', 'ssh', "", _('specify ssh command to use')), 2359 ('e', 'ssh', "", _('specify ssh command to use')),
2344 ('r', 'rev', [], _('a specific revision you would like to pull')), 2360 ('r', 'rev', [], _('a specific revision you would like to pull')),
2345 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], 2361 ('', 'remotecmd', "",
2362 _('specify hg command to run on the remote side'))],
2346 _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')), 2363 _('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')),
2347 "^push": 2364 "^push":
2348 (push, 2365 (push,
2349 [('f', 'force', None, _('force push')), 2366 [('f', 'force', None, _('force push')),
2350 ('e', 'ssh', "", _('specify ssh command to use')), 2367 ('e', 'ssh', "", _('specify ssh command to use')),
2351 ('', 'remotecmd', "", _('specify hg command to run on the remote side'))], 2368 ('', 'remotecmd', "",
2369 _('specify hg command to run on the remote side'))],
2352 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')), 2370 _('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
2353 "rawcommit": 2371 "rawcommit":
2354 (rawcommit, 2372 (rawcommit,
2355 [('p', 'parent', [], _('parent')), 2373 [('p', 'parent', [], _('parent')),
2356 ('d', 'date', "", _('date code')), 2374 ('d', 'date', "", _('date code')),
2359 ('m', 'message', "", _('commit message')), 2377 ('m', 'message', "", _('commit message')),
2360 ('l', 'logfile', "", _('commit message file'))], 2378 ('l', 'logfile', "", _('commit message file'))],
2361 _('hg rawcommit [OPTION]... [FILE]...')), 2379 _('hg rawcommit [OPTION]... [FILE]...')),
2362 "recover": (recover, [], _("hg recover")), 2380 "recover": (recover, [], _("hg recover")),
2363 "^remove|rm": (remove, 2381 "^remove|rm": (remove,
2364 [('I', 'include', [], _('include names matching the given patterns')), 2382 [('I', 'include', [],
2365 ('X', 'exclude', [], _('exclude names matching the given patterns'))], 2383 _('include names matching the given patterns')),
2384 ('X', 'exclude', [],
2385 _('exclude names matching the given patterns'))],
2366 _("hg remove [OPTION]... FILE...")), 2386 _("hg remove [OPTION]... FILE...")),
2367 "rename|mv": (rename, 2387 "rename|mv": (rename,
2368 [('I', 'include', [], _('include names matching the given patterns')), 2388 [('I', 'include', [],
2369 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2389 _('include names matching the given patterns')),
2370 ('A', 'after', None, _('record a rename that has already occurred')), 2390 ('X', 'exclude', [],
2371 ('f', 'force', None, _('forcibly copy over an existing managed file'))], 2391 _('exclude names matching the given patterns')),
2392 ('A', 'after', None,
2393 _('record a rename that has already occurred')),
2394 ('f', 'force', None,
2395 _('forcibly copy over an existing managed file'))],
2372 _('hg rename [OPTION]... [SOURCE]... DEST')), 2396 _('hg rename [OPTION]... [SOURCE]... DEST')),
2373 "^revert": 2397 "^revert":
2374 (revert, 2398 (revert,
2375 [('I', 'include', [], _('include names matching the given patterns')), 2399 [('I', 'include', [], _('include names matching the given patterns')),
2376 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2400 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2381 (serve, 2405 (serve,
2382 [('A', 'accesslog', '', _('name of access log file to write to')), 2406 [('A', 'accesslog', '', _('name of access log file to write to')),
2383 ('E', 'errorlog', '', _('name of error log file to write to')), 2407 ('E', 'errorlog', '', _('name of error log file to write to')),
2384 ('p', 'port', 0, _('port to use (default: 8000)')), 2408 ('p', 'port', 0, _('port to use (default: 8000)')),
2385 ('a', 'address', '', _('address to use')), 2409 ('a', 'address', '', _('address to use')),
2386 ('n', 'name', "", _('name to show in web pages (default: working dir)')), 2410 ('n', 'name', "",
2411 _('name to show in web pages (default: working dir)')),
2387 ('', 'stdio', None, _('for remote clients')), 2412 ('', 'stdio', None, _('for remote clients')),
2388 ('t', 'templates', "", _('web templates to use')), 2413 ('t', 'templates', "", _('web templates to use')),
2389 ('', 'style', "", _('template style to use')), 2414 ('', 'style', "", _('template style to use')),
2390 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], 2415 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))],
2391 _("hg serve [OPTION]...")), 2416 _("hg serve [OPTION]...")),
2394 [('m', 'modified', None, _('show only modified files')), 2419 [('m', 'modified', None, _('show only modified files')),
2395 ('a', 'added', None, _('show only added files')), 2420 ('a', 'added', None, _('show only added files')),
2396 ('r', 'removed', None, _('show only removed files')), 2421 ('r', 'removed', None, _('show only removed files')),
2397 ('u', 'unknown', None, _('show only unknown (not tracked) files')), 2422 ('u', 'unknown', None, _('show only unknown (not tracked) files')),
2398 ('n', 'no-status', None, _('hide status prefix')), 2423 ('n', 'no-status', None, _('hide status prefix')),
2399 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), 2424 ('0', 'print0', None,
2425 _('end filenames with NUL, for use with xargs')),
2400 ('I', 'include', [], _('include names matching the given patterns')), 2426 ('I', 'include', [], _('include names matching the given patterns')),
2401 ('X', 'exclude', [], _('exclude names matching the given patterns'))], 2427 ('X', 'exclude', [], _('exclude names matching the given patterns'))],
2402 _("hg status [OPTION]... [FILE]...")), 2428 _("hg status [OPTION]... [FILE]...")),
2403 "tag": 2429 "tag":
2404 (tag, 2430 (tag,
2428 } 2454 }
2429 2455
2430 globalopts = [ 2456 globalopts = [
2431 ('R', 'repository', "", _("repository root directory")), 2457 ('R', 'repository', "", _("repository root directory")),
2432 ('', 'cwd', '', _("change working directory")), 2458 ('', 'cwd', '', _("change working directory")),
2433 ('y', 'noninteractive', None, _("do not prompt, assume 'yes' for any required answers")), 2459 ('y', 'noninteractive', None,
2460 _("do not prompt, assume 'yes' for any required answers")),
2434 ('q', 'quiet', None, _("suppress output")), 2461 ('q', 'quiet', None, _("suppress output")),
2435 ('v', 'verbose', None, _("enable additional output")), 2462 ('v', 'verbose', None, _("enable additional output")),
2436 ('', 'debug', None, _("enable debugging output")), 2463 ('', 'debug', None, _("enable debugging output")),
2437 ('', 'debugger', None, _("start debugger")), 2464 ('', 'debugger', None, _("start debugger")),
2438 ('', 'traceback', None, _("print traceback on exception")), 2465 ('', 'traceback', None, _("print traceback on exception")),