180 if not prefix: prefix = os.path.basename(repo.root) + '-%h' |
180 if not prefix: prefix = os.path.basename(repo.root) + '-%h' |
181 prefix = cmdutil.make_filename(repo, prefix, node) |
181 prefix = cmdutil.make_filename(repo, prefix, node) |
182 archival.archive(repo, dest, node, kind, not opts['no_decode'], |
182 archival.archive(repo, dest, node, kind, not opts['no_decode'], |
183 matchfn, prefix) |
183 matchfn, prefix) |
184 |
184 |
185 def backout(ui, repo, rev, **opts): |
185 def backout(ui, repo, node=None, rev=None, **opts): |
186 '''reverse effect of earlier changeset |
186 '''reverse effect of earlier changeset |
187 |
187 |
188 Commit the backed out changes as a new changeset. The new |
188 Commit the backed out changes as a new changeset. The new |
189 changeset is a child of the backed out changeset. |
189 changeset is a child of the backed out changeset. |
190 |
190 |
197 The --merge option remembers the parent of the working directory |
197 The --merge option remembers the parent of the working directory |
198 before starting the backout, then merges the new head with that |
198 before starting the backout, then merges the new head with that |
199 changeset afterwards. This saves you from doing the merge by |
199 changeset afterwards. This saves you from doing the merge by |
200 hand. The result of this merge is not committed, as for a normal |
200 hand. The result of this merge is not committed, as for a normal |
201 merge.''' |
201 merge.''' |
|
202 if rev and node: |
|
203 raise util.Abort(_("please specify just one revision")) |
|
204 |
|
205 if not rev: |
|
206 rev = node |
202 |
207 |
203 bail_if_changed(repo) |
208 bail_if_changed(repo) |
204 op1, op2 = repo.dirstate.parents() |
209 op1, op2 = repo.dirstate.parents() |
205 if op2 != nullid: |
210 if op2 != nullid: |
206 raise util.Abort(_('outstanding uncommitted merge')) |
211 raise util.Abort(_('outstanding uncommitted merge')) |
1509 for p in patches: |
1514 for p in patches: |
1510 pf = os.path.join(d, p) |
1515 pf = os.path.join(d, p) |
1511 |
1516 |
1512 if pf == '-': |
1517 if pf == '-': |
1513 ui.status(_("applying patch from stdin\n")) |
1518 ui.status(_("applying patch from stdin\n")) |
1514 tmpname, message, user, date, nodeid, p1, p2 = patch.extract(ui, sys.stdin) |
1519 tmpname, message, user, date, branch, nodeid, p1, p2 = patch.extract(ui, sys.stdin) |
1515 else: |
1520 else: |
1516 ui.status(_("applying %s\n") % p) |
1521 ui.status(_("applying %s\n") % p) |
1517 tmpname, message, user, date, nodeid, p1, p2 = patch.extract(ui, file(pf)) |
1522 tmpname, message, user, date, branch, nodeid, p1, p2 = patch.extract(ui, file(pf)) |
1518 |
1523 |
1519 if tmpname is None: |
1524 if tmpname is None: |
1520 raise util.Abort(_('no diffs found')) |
1525 raise util.Abort(_('no diffs found')) |
1521 |
1526 |
1522 try: |
1527 try: |
1540 p2 = repo.lookup(p2 or hex(nullid)) |
1545 p2 = repo.lookup(p2 or hex(nullid)) |
1541 |
1546 |
1542 if p1 != wp[0].node(): |
1547 if p1 != wp[0].node(): |
1543 hg.clean(repo, p1, wlock=wlock) |
1548 hg.clean(repo, p1, wlock=wlock) |
1544 repo.dirstate.setparents(p1, p2) |
1549 repo.dirstate.setparents(p1, p2) |
|
1550 repo.dirstate.setbranch(branch or 'default') |
1545 elif p2: |
1551 elif p2: |
1546 try: |
1552 try: |
1547 p1 = repo.lookup(p1) |
1553 p1 = repo.lookup(p1) |
1548 p2 = repo.lookup(p2) |
1554 p2 = repo.lookup(p2) |
1549 if p1 == wp[0].node(): |
1555 if p1 == wp[0].node(): |
1824 ui.write("%40s " % hex(m[f])) |
1830 ui.write("%40s " % hex(m[f])) |
1825 if ui.verbose: |
1831 if ui.verbose: |
1826 ui.write("%3s " % (m.execf(f) and "755" or "644")) |
1832 ui.write("%3s " % (m.execf(f) and "755" or "644")) |
1827 ui.write("%s\n" % f) |
1833 ui.write("%s\n" % f) |
1828 |
1834 |
1829 def merge(ui, repo, node=None, force=None): |
1835 def merge(ui, repo, node=None, force=None, rev=None): |
1830 """merge working directory with another revision |
1836 """merge working directory with another revision |
1831 |
1837 |
1832 Merge the contents of the current working directory and the |
1838 Merge the contents of the current working directory and the |
1833 requested revision. Files that changed between either parent are |
1839 requested revision. Files that changed between either parent are |
1834 marked as changed for the next commit and a commit must be |
1840 marked as changed for the next commit and a commit must be |
1837 If no revision is specified, the working directory's parent is a |
1843 If no revision is specified, the working directory's parent is a |
1838 head revision, and the repository contains exactly one other head, |
1844 head revision, and the repository contains exactly one other head, |
1839 the other head is merged with by default. Otherwise, an explicit |
1845 the other head is merged with by default. Otherwise, an explicit |
1840 revision to merge with must be provided. |
1846 revision to merge with must be provided. |
1841 """ |
1847 """ |
|
1848 |
|
1849 if rev and node: |
|
1850 raise util.Abort(_("please specify just one revision")) |
|
1851 |
|
1852 if not node: |
|
1853 node = rev |
1842 |
1854 |
1843 if not node: |
1855 if not node: |
1844 heads = repo.heads() |
1856 heads = repo.heads() |
1845 if len(heads) > 2: |
1857 if len(heads) > 2: |
1846 raise util.Abort(_('repo has %d heads - ' |
1858 raise util.Abort(_('repo has %d heads - ' |
2550 f = urllib.urlopen(fname) |
2562 f = urllib.urlopen(fname) |
2551 gen = changegroup.readbundle(f, fname) |
2563 gen = changegroup.readbundle(f, fname) |
2552 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2564 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2553 return postincoming(ui, repo, modheads, opts['update']) |
2565 return postincoming(ui, repo, modheads, opts['update']) |
2554 |
2566 |
2555 def update(ui, repo, node=None, clean=False, date=None): |
2567 def update(ui, repo, node=None, rev=None, clean=False, date=None): |
2556 """update working directory |
2568 """update working directory |
2557 |
2569 |
2558 Update the working directory to the specified revision, or the |
2570 Update the working directory to the specified revision, or the |
2559 tip of the current branch if none is specified. |
2571 tip of the current branch if none is specified. |
2560 |
2572 |
2566 merge command. |
2578 merge command. |
2567 |
2579 |
2568 By default, update will refuse to run if doing so would require |
2580 By default, update will refuse to run if doing so would require |
2569 discarding local changes. |
2581 discarding local changes. |
2570 """ |
2582 """ |
|
2583 if rev and node: |
|
2584 raise util.Abort(_("please specify just one revision")) |
|
2585 |
|
2586 if not rev: |
|
2587 rev = node |
|
2588 |
2571 if date: |
2589 if date: |
2572 if node: |
2590 if rev: |
2573 raise util.Abort(_("you can't specify a revision and a date")) |
2591 raise util.Abort(_("you can't specify a revision and a date")) |
2574 node = cmdutil.finddate(ui, repo, date) |
2592 rev = cmdutil.finddate(ui, repo, date) |
2575 |
2593 |
2576 if clean: |
2594 if clean: |
2577 return hg.clean(repo, node) |
2595 return hg.clean(repo, rev) |
2578 else: |
2596 else: |
2579 return hg.update(repo, node) |
2597 return hg.update(repo, rev) |
2580 |
2598 |
2581 def verify(ui, repo): |
2599 def verify(ui, repo): |
2582 """verify the integrity of the repository |
2600 """verify the integrity of the repository |
2583 |
2601 |
2584 Verify the integrity of the current repository. |
2602 Verify the integrity of the current repository. |
2674 [('', 'merge', None, |
2692 [('', 'merge', None, |
2675 _('merge with old dirstate parent after backout')), |
2693 _('merge with old dirstate parent after backout')), |
2676 ('d', 'date', '', _('record datecode as commit date')), |
2694 ('d', 'date', '', _('record datecode as commit date')), |
2677 ('', 'parent', '', _('parent to choose when backing out merge')), |
2695 ('', 'parent', '', _('parent to choose when backing out merge')), |
2678 ('u', 'user', '', _('record user as committer')), |
2696 ('u', 'user', '', _('record user as committer')), |
|
2697 ('r', 'rev', '', _('revision to backout')), |
2679 ] + walkopts + commitopts, |
2698 ] + walkopts + commitopts, |
2680 _('hg backout [OPTION]... REV')), |
2699 _('hg backout [OPTION]... [-r] REV')), |
2681 "branch": (branch, |
2700 "branch": (branch, |
2682 [('f', 'force', None, |
2701 [('f', 'force', None, |
2683 _('set branch name even if it shadows an existing branch'))], |
2702 _('set branch name even if it shadows an existing branch'))], |
2684 _('hg branch [NAME]')), |
2703 _('hg branch [NAME]')), |
2685 "branches": (branches, [], _('hg branches')), |
2704 "branches": (branches, [], _('hg branches')), |
2850 ] + walkopts, |
2869 ] + walkopts, |
2851 _('hg log [OPTION]... [FILE]')), |
2870 _('hg log [OPTION]... [FILE]')), |
2852 "manifest": (manifest, [], _('hg manifest [REV]')), |
2871 "manifest": (manifest, [], _('hg manifest [REV]')), |
2853 "^merge": |
2872 "^merge": |
2854 (merge, |
2873 (merge, |
2855 [('f', 'force', None, _('force a merge with outstanding changes'))], |
2874 [('f', 'force', None, _('force a merge with outstanding changes')), |
2856 _('hg merge [-f] [REV]')), |
2875 ('r', 'rev', '', _('revision to merge')), |
|
2876 ], |
|
2877 _('hg merge [-f] [[-r] REV]')), |
2857 "outgoing|out": (outgoing, |
2878 "outgoing|out": (outgoing, |
2858 [('M', 'no-merges', None, _('do not show merges')), |
2879 [('M', 'no-merges', None, _('do not show merges')), |
2859 ('f', 'force', None, |
2880 ('f', 'force', None, |
2860 _('run even when remote repository is unrelated')), |
2881 _('run even when remote repository is unrelated')), |
2861 ('p', 'patch', None, _('show patch')), |
2882 ('p', 'patch', None, _('show patch')), |
2982 _('update to new tip if changesets were unbundled'))], |
3003 _('update to new tip if changesets were unbundled'))], |
2983 _('hg unbundle [-u] FILE')), |
3004 _('hg unbundle [-u] FILE')), |
2984 "^update|up|checkout|co": |
3005 "^update|up|checkout|co": |
2985 (update, |
3006 (update, |
2986 [('C', 'clean', None, _('overwrite locally modified files')), |
3007 [('C', 'clean', None, _('overwrite locally modified files')), |
2987 ('d', 'date', '', _('tipmost revision matching date'))], |
3008 ('d', 'date', '', _('tipmost revision matching date')), |
2988 _('hg update [-C] [-d DATE] [REV]')), |
3009 ('r', 'rev', '', _('revision'))], |
|
3010 _('hg update [-C] [-d DATE] [[-r] REV]')), |
2989 "verify": (verify, [], _('hg verify')), |
3011 "verify": (verify, [], _('hg verify')), |
2990 "version": (version_, [], _('hg version')), |
3012 "version": (version_, [], _('hg version')), |
2991 } |
3013 } |
2992 |
3014 |
2993 norepo = ("clone init version help debugancestor debugcomplete debugdata" |
3015 norepo = ("clone init version help debugancestor debugcomplete debugdata" |