##// END OF EJS Templates
Commands cleanup...
mpm@selenic.com -
r437:5b38a5af default
parent child Browse files
Show More
@@ -178,7 +178,7 b' def help(ui, cmd=None):'
178 178 d = ""
179 179 if f.__doc__:
180 180 d = f.__doc__.splitlines(0)[0].rstrip()
181 h[f.__name__] = d
181 h[f.__name__.rstrip("_")] = d
182 182
183 183 fns = h.keys()
184 184 fns.sort()
@@ -275,15 +275,6 b' def copy(ui, repo, source, dest):'
275 275 """mark a file as copied or renamed for the next commit"""
276 276 return repo.copy(*relpath(repo, (source, dest)))
277 277
278 def debugaddchangegroup(ui, repo):
279 data = sys.stdin.read()
280 repo.addchangegroup(data)
281
282 def debugchangegroup(ui, repo, roots):
283 newer = repo.newer(map(repo.lookup, roots))
284 for chunk in repo.changegroup(newer):
285 sys.stdout.write(chunk)
286
287 278 def debugindex(ui, file):
288 279 r = hg.revlog(hg.opener(""), file, "")
289 280 print " rev offset length base linkrev"+\
@@ -373,6 +364,46 b' def identify(ui, repo):'
373 364
374 365 ui.write("%s\n" % ' '.join(output))
375 366
367 def import_(ui, repo, patch1, *patches, **opts):
368 """import an ordered set of patches"""
369 try:
370 import psyco
371 psyco.full()
372 except:
373 pass
374
375 patches = (patch1,) + patches
376
377 d = opts["base"]
378 strip = opts["strip"]
379 quiet = ui.quiet and "> /dev/null" or ""
380
381 for patch in patches:
382 ui.status("applying %s\n" % patch)
383 pf = os.path.join(d, patch)
384
385 text = ""
386 for l in file(pf):
387 if l[:4] == "--- ": break
388 text += l
389
390 # make sure text isn't empty
391 if not text: text = "imported patch %s\n" % patch
392
393 f = os.popen("patch -p%d < %s" % (strip, pf))
394 files = []
395 for l in f.read().splitlines():
396 l.rstrip('\r\n');
397 if not quiet:
398 print l
399 if l[:14] == 'patching file ':
400 files.append(l[14:])
401 f.close()
402
403 if len(files) > 0:
404 addremove(ui, repo, *files)
405 repo.commit(files, text)
406
376 407 def init(ui, source=None, **opts):
377 408 """create a new repository or copy an existing one"""
378 409
@@ -445,46 +476,6 b' def parents(ui, repo, node = None):'
445 476 if n != hg.nullid:
446 477 show_changeset(ui, repo, changenode=n)
447 478
448 def patch(ui, repo, patch1, *patches, **opts):
449 """import an ordered set of patches"""
450 try:
451 import psyco
452 psyco.full()
453 except:
454 pass
455
456 patches = (patch1,) + patches
457
458 d = opts["base"]
459 strip = opts["strip"]
460 quiet = opts["quiet"] and "> /dev/null" or ""
461
462 for patch in patches:
463 ui.status("applying %s\n" % patch)
464 pf = os.path.join(d, patch)
465
466 text = ""
467 for l in file(pf):
468 if l[:4] == "--- ": break
469 text += l
470
471 # make sure text isn't empty
472 if not text: text = "imported patch %s\n" % patch
473
474 f = os.popen("patch -p%d < %s" % (strip, pf))
475 files = []
476 for l in f.read().splitlines():
477 l.rstrip('\r\n');
478 if not quiet:
479 print l
480 if l[:14] == 'patching file ':
481 files.append(l[14:])
482 f.close()
483
484 if len(files) > 0:
485 addremove(ui, repo, *files)
486 repo.commit(files, text)
487
488 479 def pull(ui, repo, source="default", **opts):
489 480 """pull changes from the specified source"""
490 481 paths = {}
@@ -664,13 +655,13 b' def verify(ui, repo):'
664 655 table = {
665 656 "add": (add, [], "hg add [files]"),
666 657 "addremove": (addremove, [], "hg addremove [files]"),
667 "ann|annotate": (annotate,
658 "annotate": (annotate,
668 659 [('r', 'revision', '', 'revision'),
669 660 ('u', 'user', None, 'show user'),
670 661 ('n', 'number', None, 'show revision number'),
671 662 ('c', 'changeset', None, 'show changeset')],
672 663 'hg annotate [-u] [-c] [-n] [-r id] [files]'),
673 "cat|dump": (cat, [], 'hg cat <file> [rev]'),
664 "cat": (cat, [], 'hg cat <file> [rev]'),
674 665 "commit|ci": (commit,
675 666 [('t', 'text', "", 'commit text'),
676 667 ('A', 'addremove', None, 'run add/remove during commit'),
@@ -679,8 +670,6 b' table = {'
679 670 ('u', 'user', "", 'user')],
680 671 'hg commit [files]'),
681 672 "copy": (copy, [], 'hg copy <source> <dest>'),
682 "debugaddchangegroup": (debugaddchangegroup, [], 'debugaddchangegroup'),
683 "debugchangegroup": (debugchangegroup, [], 'debugchangegroup [roots]'),
684 673 "debugindex": (debugindex, [], 'debugindex <file>'),
685 674 "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'),
686 675 "diff": (diff, [('r', 'rev', [], 'revision')],
@@ -691,17 +680,16 b' table = {'
691 680 "history": (history, [], 'hg history'),
692 681 "help": (help, [], 'hg help [command]'),
693 682 "identify|id": (identify, [], 'hg identify'),
683 "import|patch": (import_,
684 [('p', 'strip', 1, 'path strip'),
685 ('b', 'base', "", 'base path')],
686 "hg import [options] <patches>"),
694 687 "init": (init, [('u', 'update', None, 'update after init')],
695 688 'hg init [options] [url]'),
696 689 "log": (log, [], 'hg log <file>'),
697 "manifest|dumpmanifest": (manifest, [], 'hg manifest [rev]'),
690 "manifest": (manifest, [], 'hg manifest [rev]'),
698 691 "parents": (parents, [], 'hg parents [node]'),
699 "patch|import": (patch,
700 [('p', 'strip', 1, 'path strip'),
701 ('b', 'base', "", 'base path'),
702 ('q', 'quiet', "", 'silence diff')],
703 "hg import [options] patches"),
704 "pull|merge": (pull,
692 "pull": (pull,
705 693 [('u', 'update', None, 'update working directory')],
706 694 'hg pull [options] [source]'),
707 695 "push": (push, [], 'hg push <destination>'),
@@ -714,7 +702,7 b' table = {'
714 702 ('l', 'logfile', "", 'commit text file')],
715 703 'hg rawcommit [options] [files]'),
716 704 "recover": (recover, [], "hg recover"),
717 "remove": (remove, [], "hg remove [files]"),
705 "remove|rm": (remove, [], "hg remove [files]"),
718 706 "serve": (serve, [('p', 'port', 8000, 'listen port'),
719 707 ('a', 'address', '', 'interface address'),
720 708 ('n', 'name', os.getcwd(), 'repository name'),
@@ -728,12 +716,11 b' table = {'
728 716 "tags": (tags, [], 'hg tags'),
729 717 "tip": (tip, [], 'hg tip'),
730 718 "undo": (undo, [], 'hg undo'),
731 "update|up|checkout|co|resolve": (update,
732 [('m', 'merge', None,
733 'allow merging of conflicts'),
734 ('C', 'clean', None,
735 'overwrite locally modified files')],
736 'hg update [options] [node]'),
719 "update|up|checkout|co":
720 (update,
721 [('m', 'merge', None, 'allow merging of conflicts'),
722 ('C', 'clean', None, 'overwrite locally modified files')],
723 'hg update [options] [node]'),
737 724 "verify": (verify, [], 'hg verify'),
738 725 }
739 726
General Comments 0
You need to be logged in to leave comments. Login now