Show More
@@ -178,7 +178,7 b' def help(ui, cmd=None):' | |||||
178 | d = "" |
|
178 | d = "" | |
179 | if f.__doc__: |
|
179 | if f.__doc__: | |
180 | d = f.__doc__.splitlines(0)[0].rstrip() |
|
180 | d = f.__doc__.splitlines(0)[0].rstrip() | |
181 | h[f.__name__] = d |
|
181 | h[f.__name__.rstrip("_")] = d | |
182 |
|
182 | |||
183 | fns = h.keys() |
|
183 | fns = h.keys() | |
184 | fns.sort() |
|
184 | fns.sort() | |
@@ -275,15 +275,6 b' def copy(ui, repo, source, dest):' | |||||
275 | """mark a file as copied or renamed for the next commit""" |
|
275 | """mark a file as copied or renamed for the next commit""" | |
276 | return repo.copy(*relpath(repo, (source, dest))) |
|
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 | def debugindex(ui, file): |
|
278 | def debugindex(ui, file): | |
288 | r = hg.revlog(hg.opener(""), file, "") |
|
279 | r = hg.revlog(hg.opener(""), file, "") | |
289 | print " rev offset length base linkrev"+\ |
|
280 | print " rev offset length base linkrev"+\ | |
@@ -373,6 +364,46 b' def identify(ui, repo):' | |||||
373 |
|
364 | |||
374 | ui.write("%s\n" % ' '.join(output)) |
|
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 | def init(ui, source=None, **opts): |
|
407 | def init(ui, source=None, **opts): | |
377 | """create a new repository or copy an existing one""" |
|
408 | """create a new repository or copy an existing one""" | |
378 |
|
409 | |||
@@ -445,46 +476,6 b' def parents(ui, repo, node = None):' | |||||
445 | if n != hg.nullid: |
|
476 | if n != hg.nullid: | |
446 | show_changeset(ui, repo, changenode=n) |
|
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 | def pull(ui, repo, source="default", **opts): |
|
479 | def pull(ui, repo, source="default", **opts): | |
489 | """pull changes from the specified source""" |
|
480 | """pull changes from the specified source""" | |
490 | paths = {} |
|
481 | paths = {} | |
@@ -664,13 +655,13 b' def verify(ui, repo):' | |||||
664 | table = { |
|
655 | table = { | |
665 | "add": (add, [], "hg add [files]"), |
|
656 | "add": (add, [], "hg add [files]"), | |
666 | "addremove": (addremove, [], "hg addremove [files]"), |
|
657 | "addremove": (addremove, [], "hg addremove [files]"), | |
667 |
" |
|
658 | "annotate": (annotate, | |
668 | [('r', 'revision', '', 'revision'), |
|
659 | [('r', 'revision', '', 'revision'), | |
669 | ('u', 'user', None, 'show user'), |
|
660 | ('u', 'user', None, 'show user'), | |
670 | ('n', 'number', None, 'show revision number'), |
|
661 | ('n', 'number', None, 'show revision number'), | |
671 | ('c', 'changeset', None, 'show changeset')], |
|
662 | ('c', 'changeset', None, 'show changeset')], | |
672 | 'hg annotate [-u] [-c] [-n] [-r id] [files]'), |
|
663 | 'hg annotate [-u] [-c] [-n] [-r id] [files]'), | |
673 |
"cat |
|
664 | "cat": (cat, [], 'hg cat <file> [rev]'), | |
674 | "commit|ci": (commit, |
|
665 | "commit|ci": (commit, | |
675 | [('t', 'text', "", 'commit text'), |
|
666 | [('t', 'text', "", 'commit text'), | |
676 | ('A', 'addremove', None, 'run add/remove during commit'), |
|
667 | ('A', 'addremove', None, 'run add/remove during commit'), | |
@@ -679,8 +670,6 b' table = {' | |||||
679 | ('u', 'user', "", 'user')], |
|
670 | ('u', 'user', "", 'user')], | |
680 | 'hg commit [files]'), |
|
671 | 'hg commit [files]'), | |
681 | "copy": (copy, [], 'hg copy <source> <dest>'), |
|
672 | "copy": (copy, [], 'hg copy <source> <dest>'), | |
682 | "debugaddchangegroup": (debugaddchangegroup, [], 'debugaddchangegroup'), |
|
|||
683 | "debugchangegroup": (debugchangegroup, [], 'debugchangegroup [roots]'), |
|
|||
684 | "debugindex": (debugindex, [], 'debugindex <file>'), |
|
673 | "debugindex": (debugindex, [], 'debugindex <file>'), | |
685 | "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'), |
|
674 | "debugindexdot": (debugindexdot, [], 'debugindexdot <file>'), | |
686 | "diff": (diff, [('r', 'rev', [], 'revision')], |
|
675 | "diff": (diff, [('r', 'rev', [], 'revision')], | |
@@ -691,17 +680,16 b' table = {' | |||||
691 | "history": (history, [], 'hg history'), |
|
680 | "history": (history, [], 'hg history'), | |
692 | "help": (help, [], 'hg help [command]'), |
|
681 | "help": (help, [], 'hg help [command]'), | |
693 | "identify|id": (identify, [], 'hg identify'), |
|
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 | "init": (init, [('u', 'update', None, 'update after init')], |
|
687 | "init": (init, [('u', 'update', None, 'update after init')], | |
695 | 'hg init [options] [url]'), |
|
688 | 'hg init [options] [url]'), | |
696 | "log": (log, [], 'hg log <file>'), |
|
689 | "log": (log, [], 'hg log <file>'), | |
697 |
"manifest |
|
690 | "manifest": (manifest, [], 'hg manifest [rev]'), | |
698 | "parents": (parents, [], 'hg parents [node]'), |
|
691 | "parents": (parents, [], 'hg parents [node]'), | |
699 | "patch|import": (patch, |
|
692 | "pull": (pull, | |
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, |
|
|||
705 | [('u', 'update', None, 'update working directory')], |
|
693 | [('u', 'update', None, 'update working directory')], | |
706 | 'hg pull [options] [source]'), |
|
694 | 'hg pull [options] [source]'), | |
707 | "push": (push, [], 'hg push <destination>'), |
|
695 | "push": (push, [], 'hg push <destination>'), | |
@@ -714,7 +702,7 b' table = {' | |||||
714 | ('l', 'logfile', "", 'commit text file')], |
|
702 | ('l', 'logfile', "", 'commit text file')], | |
715 | 'hg rawcommit [options] [files]'), |
|
703 | 'hg rawcommit [options] [files]'), | |
716 | "recover": (recover, [], "hg recover"), |
|
704 | "recover": (recover, [], "hg recover"), | |
717 | "remove": (remove, [], "hg remove [files]"), |
|
705 | "remove|rm": (remove, [], "hg remove [files]"), | |
718 | "serve": (serve, [('p', 'port', 8000, 'listen port'), |
|
706 | "serve": (serve, [('p', 'port', 8000, 'listen port'), | |
719 | ('a', 'address', '', 'interface address'), |
|
707 | ('a', 'address', '', 'interface address'), | |
720 | ('n', 'name', os.getcwd(), 'repository name'), |
|
708 | ('n', 'name', os.getcwd(), 'repository name'), | |
@@ -728,11 +716,10 b' table = {' | |||||
728 | "tags": (tags, [], 'hg tags'), |
|
716 | "tags": (tags, [], 'hg tags'), | |
729 | "tip": (tip, [], 'hg tip'), |
|
717 | "tip": (tip, [], 'hg tip'), | |
730 | "undo": (undo, [], 'hg undo'), |
|
718 | "undo": (undo, [], 'hg undo'), | |
731 |
"update|up|checkout|co |
|
719 | "update|up|checkout|co": | |
732 | [('m', 'merge', None, |
|
720 | (update, | |
733 |
|
|
721 | [('m', 'merge', None, 'allow merging of conflicts'), | |
734 | ('C', 'clean', None, |
|
722 | ('C', 'clean', None, 'overwrite locally modified files')], | |
735 | 'overwrite locally modified files')], |
|
|||
736 |
|
|
723 | 'hg update [options] [node]'), | |
737 | "verify": (verify, [], 'hg verify'), |
|
724 | "verify": (verify, [], 'hg verify'), | |
738 | } |
|
725 | } |
General Comments 0
You need to be logged in to leave comments.
Login now