Show More
@@ -147,6 +147,11 b' def revrange(repo, revs):' | |||||
147 | # attempt to parse old-style ranges first to deal with |
|
147 | # attempt to parse old-style ranges first to deal with | |
148 | # things like old-tag which contain query metacharacters |
|
148 | # things like old-tag which contain query metacharacters | |
149 | try: |
|
149 | try: | |
|
150 | if isinstance(spec, int): | |||
|
151 | seen.add(spec) | |||
|
152 | l.append(spec) | |||
|
153 | continue | |||
|
154 | ||||
150 | if revrangesep in spec: |
|
155 | if revrangesep in spec: | |
151 | start, end = spec.split(revrangesep, 1) |
|
156 | start, end = spec.split(revrangesep, 1) | |
152 | start = revfix(repo, start, 0) |
|
157 | start = revfix(repo, start, 0) |
@@ -126,7 +126,7 b' def annotate(ui, repo, *pats, **opts):' | |||||
126 | lastfunc = funcmap[-1] |
|
126 | lastfunc = funcmap[-1] | |
127 | funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
|
127 | funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) | |
128 |
|
128 | |||
129 |
ctx = repo |
|
129 | ctx = cmdutil.revsingle(repo, opts.get('rev')) | |
130 | m = cmdutil.match(repo, pats, opts) |
|
130 | m = cmdutil.match(repo, pats, opts) | |
131 | follow = not opts.get('no_follow') |
|
131 | follow = not opts.get('no_follow') | |
132 | for abs in ctx.walk(m): |
|
132 | for abs in ctx.walk(m): | |
@@ -178,7 +178,7 b' def archive(ui, repo, dest, **opts):' | |||||
178 | Returns 0 on success. |
|
178 | Returns 0 on success. | |
179 | ''' |
|
179 | ''' | |
180 |
|
180 | |||
181 |
ctx = repo |
|
181 | ctx = cmdutil.revsingle(repo, opts.get('rev')) | |
182 | if not ctx: |
|
182 | if not ctx: | |
183 | raise util.Abort(_('no working directory: please specify a revision')) |
|
183 | raise util.Abort(_('no working directory: please specify a revision')) | |
184 | node = ctx.node() |
|
184 | node = ctx.node() | |
@@ -243,7 +243,7 b' def backout(ui, repo, node=None, rev=Non' | |||||
243 | opts['date'] = util.parsedate(date) |
|
243 | opts['date'] = util.parsedate(date) | |
244 |
|
244 | |||
245 | cmdutil.bail_if_changed(repo) |
|
245 | cmdutil.bail_if_changed(repo) | |
246 | node = repo.lookup(rev) |
|
246 | node = cmdutil.revsingle(repo, rev).node() | |
247 |
|
247 | |||
248 | op1, op2 = repo.dirstate.parents() |
|
248 | op1, op2 = repo.dirstate.parents() | |
249 | a = repo.changelog.ancestor(op1, node) |
|
249 | a = repo.changelog.ancestor(op1, node) | |
@@ -408,7 +408,8 b' def bisect(ui, repo, rev=None, extra=Non' | |||||
408 | raise util.Abort(_("%s killed") % command) |
|
408 | raise util.Abort(_("%s killed") % command) | |
409 | else: |
|
409 | else: | |
410 | transition = "bad" |
|
410 | transition = "bad" | |
411 |
ctx = repo |
|
411 | ctx = cmdutil.revsingle(repo, rev) | |
|
412 | rev = None # clear for future iterations | |||
412 | state[transition].append(ctx.node()) |
|
413 | state[transition].append(ctx.node()) | |
413 | ui.status(_('Changeset %d:%s: %s\n') % (ctx, ctx, transition)) |
|
414 | ui.status(_('Changeset %d:%s: %s\n') % (ctx, ctx, transition)) | |
414 | check_state(state, interactive=False) |
|
415 | check_state(state, interactive=False) | |
@@ -572,11 +573,14 b' def bundle(ui, repo, fname, dest=None, *' | |||||
572 |
|
573 | |||
573 | Returns 0 on success, 1 if no changes found. |
|
574 | Returns 0 on success, 1 if no changes found. | |
574 | """ |
|
575 | """ | |
575 |
revs = |
|
576 | revs = None | |
|
577 | if 'rev' in opts: | |||
|
578 | revs = cmdutil.revrange(repo, opts['rev']) | |||
|
579 | ||||
576 | if opts.get('all'): |
|
580 | if opts.get('all'): | |
577 | base = ['null'] |
|
581 | base = ['null'] | |
578 | else: |
|
582 | else: | |
579 | base = opts.get('base') |
|
583 | base = cmdutil.revrange(repo, opts.get('base')) | |
580 | if base: |
|
584 | if base: | |
581 | if dest: |
|
585 | if dest: | |
582 | raise util.Abort(_("--base is incompatible with specifying " |
|
586 | raise util.Abort(_("--base is incompatible with specifying " | |
@@ -1026,7 +1030,7 b' def debugfsinfo(ui, path = "."):' | |||||
1026 |
|
1030 | |||
1027 | def debugrebuildstate(ui, repo, rev="tip"): |
|
1031 | def debugrebuildstate(ui, repo, rev="tip"): | |
1028 | """rebuild the dirstate as it would look like for the given revision""" |
|
1032 | """rebuild the dirstate as it would look like for the given revision""" | |
1029 |
ctx = repo |
|
1033 | ctx = cmdutil.revsingle(repo, rev) | |
1030 | wlock = repo.wlock() |
|
1034 | wlock = repo.wlock() | |
1031 | try: |
|
1035 | try: | |
1032 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
|
1036 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) | |
@@ -1140,12 +1144,12 b' def debugsetparents(ui, repo, rev1, rev2' | |||||
1140 | Returns 0 on success. |
|
1144 | Returns 0 on success. | |
1141 | """ |
|
1145 | """ | |
1142 |
|
1146 | |||
1143 | if not rev2: |
|
1147 | r1 = cmdutil.revsingle(repo, rev1).node() | |
1144 | rev2 = hex(nullid) |
|
1148 | r2 = cmdutil.revsingle(repo, rev2, 'null').node() | |
1145 |
|
1149 | |||
1146 | wlock = repo.wlock() |
|
1150 | wlock = repo.wlock() | |
1147 | try: |
|
1151 | try: | |
1148 |
repo.dirstate.setparents(r |
|
1152 | repo.dirstate.setparents(r1, r2) | |
1149 | finally: |
|
1153 | finally: | |
1150 | wlock.release() |
|
1154 | wlock.release() | |
1151 |
|
1155 | |||
@@ -1174,9 +1178,8 b' def debugstate(ui, repo, nodates=None):' | |||||
1174 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
1178 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) | |
1175 |
|
1179 | |||
1176 | def debugsub(ui, repo, rev=None): |
|
1180 | def debugsub(ui, repo, rev=None): | |
1177 | if rev == '': |
|
1181 | ctx = cmdutil.revsingle(repo, rev, None) | |
1178 | rev = None |
|
1182 | for k, v in sorted(ctx.substate.items()): | |
1179 | for k, v in sorted(repo[rev].substate.items()): |
|
|||
1180 | ui.write('path %s\n' % k) |
|
1183 | ui.write('path %s\n' % k) | |
1181 | ui.write(' source %s\n' % v[0]) |
|
1184 | ui.write(' source %s\n' % v[0]) | |
1182 | ui.write(' revision %s\n' % v[1]) |
|
1185 | ui.write(' revision %s\n' % v[1]) | |
@@ -1435,7 +1438,7 b' def debuginstall(ui):' | |||||
1435 | def debugrename(ui, repo, file1, *pats, **opts): |
|
1438 | def debugrename(ui, repo, file1, *pats, **opts): | |
1436 | """dump rename information""" |
|
1439 | """dump rename information""" | |
1437 |
|
1440 | |||
1438 |
ctx = repo |
|
1441 | ctx = cmdutil.revsingle(repo, opts.get('rev')) | |
1439 | m = cmdutil.match(repo, (file1,) + pats, opts) |
|
1442 | m = cmdutil.match(repo, (file1,) + pats, opts) | |
1440 | for abs in ctx.walk(m): |
|
1443 | for abs in ctx.walk(m): | |
1441 | fctx = ctx[abs] |
|
1444 | fctx = ctx[abs] | |
@@ -1808,10 +1811,9 b' def heads(ui, repo, *branchrevs, **opts)' | |||||
1808 | Returns 0 if matching heads are found, 1 if not. |
|
1811 | Returns 0 if matching heads are found, 1 if not. | |
1809 | """ |
|
1812 | """ | |
1810 |
|
1813 | |||
1811 | if opts.get('rev'): |
|
|||
1812 | start = repo.lookup(opts['rev']) |
|
|||
1813 | else: |
|
|||
1814 | start = None |
|
1814 | start = None | |
|
1815 | if 'rev' in opts: | |||
|
1816 | start = cmdutil.revsingle(repo, opts['rev'], None).node() | |||
1815 |
|
1817 | |||
1816 | if opts.get('topo'): |
|
1818 | if opts.get('topo'): | |
1817 | heads = [repo[h] for h in repo.heads(start)] |
|
1819 | heads = [repo[h] for h in repo.heads(start)] | |
@@ -2200,7 +2202,7 b' def identify(ui, repo, source=None,' | |||||
2200 | output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]), |
|
2202 | output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]), | |
2201 | (changed) and "+" or "")) |
|
2203 | (changed) and "+" or "")) | |
2202 | else: |
|
2204 | else: | |
2203 |
ctx = repo |
|
2205 | ctx = cmdutil.revsingle(repo, rev) | |
2204 | if default or id: |
|
2206 | if default or id: | |
2205 | output = [hexfunc(ctx.node())] |
|
2207 | output = [hexfunc(ctx.node())] | |
2206 | if num: |
|
2208 | if num: | |
@@ -2443,7 +2445,7 b' def locate(ui, repo, *pats, **opts):' | |||||
2443 | Returns 0 if a match is found, 1 otherwise. |
|
2445 | Returns 0 if a match is found, 1 otherwise. | |
2444 | """ |
|
2446 | """ | |
2445 | end = opts.get('print0') and '\0' or '\n' |
|
2447 | end = opts.get('print0') and '\0' or '\n' | |
2446 |
rev = opts.get('rev') |
|
2448 | rev = cmdutil.revsingle(repo, opts.get('rev'), None).node() | |
2447 |
|
2449 | |||
2448 | ret = 1 |
|
2450 | ret = 1 | |
2449 | m = cmdutil.match(repo, pats, opts, default='relglob') |
|
2451 | m = cmdutil.match(repo, pats, opts, default='relglob') | |
@@ -2578,7 +2580,7 b' def manifest(ui, repo, node=None, rev=No' | |||||
2578 | node = rev |
|
2580 | node = rev | |
2579 |
|
2581 | |||
2580 | decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '} |
|
2582 | decor = {'l':'644 @ ', 'x':'755 * ', '':'644 '} | |
2581 |
ctx = repo |
|
2583 | ctx = cmdutil.revsingle(repo, node) | |
2582 | for f in ctx: |
|
2584 | for f in ctx: | |
2583 | if ui.debugflag: |
|
2585 | if ui.debugflag: | |
2584 | ui.write("%40s " % hex(ctx.manifest()[f])) |
|
2586 | ui.write("%40s " % hex(ctx.manifest()[f])) | |
@@ -2647,6 +2649,8 b' def merge(ui, repo, node=None, **opts):' | |||||
2647 | raise util.Abort(_('working dir not at a head rev - ' |
|
2649 | raise util.Abort(_('working dir not at a head rev - ' | |
2648 | 'use "hg update" or merge with an explicit rev')) |
|
2650 | 'use "hg update" or merge with an explicit rev')) | |
2649 | node = parent == bheads[0] and bheads[-1] or bheads[0] |
|
2651 | node = parent == bheads[0] and bheads[-1] or bheads[0] | |
|
2652 | else: | |||
|
2653 | node = cmdutil.revsingle(repo, node).node() | |||
2650 |
|
2654 | |||
2651 | if opts.get('preview'): |
|
2655 | if opts.get('preview'): | |
2652 | # find nodes that are ancestors of p2 but not of p1 |
|
2656 | # find nodes that are ancestors of p2 but not of p1 | |
@@ -2692,11 +2696,8 b' def parents(ui, repo, file_=None, **opts' | |||||
2692 |
|
2696 | |||
2693 | Returns 0 on success. |
|
2697 | Returns 0 on success. | |
2694 | """ |
|
2698 | """ | |
2695 | rev = opts.get('rev') |
|
2699 | ||
2696 | if rev: |
|
2700 | ctx = cmdutil.revsingle(repo, opts.get('rev'), None) | |
2697 | ctx = repo[rev] |
|
|||
2698 | else: |
|
|||
2699 | ctx = repo[None] |
|
|||
2700 |
|
2701 | |||
2701 | if file_: |
|
2702 | if file_: | |
2702 | m = cmdutil.match(repo, (file_,), opts) |
|
2703 | m = cmdutil.match(repo, (file_,), opts) | |
@@ -3112,7 +3113,7 b' def revert(ui, repo, *pats, **opts):' | |||||
3112 | if not opts.get('rev') and p2 != nullid: |
|
3113 | if not opts.get('rev') and p2 != nullid: | |
3113 | raise util.Abort(_('uncommitted merge - please provide a ' |
|
3114 | raise util.Abort(_('uncommitted merge - please provide a ' | |
3114 | 'specific revision')) |
|
3115 | 'specific revision')) | |
3115 |
ctx = repo |
|
3116 | ctx = cmdutil.revsingle(repo, opts.get('rev')) | |
3116 | node = ctx.node() |
|
3117 | node = ctx.node() | |
3117 | mf = ctx.manifest() |
|
3118 | mf = ctx.manifest() | |
3118 | if node == parent: |
|
3119 | if node == parent: | |
@@ -3721,7 +3722,7 b' def tag(ui, repo, name1, *names, **opts)' | |||||
3721 | if not rev_ and repo.dirstate.parents()[1] != nullid: |
|
3722 | if not rev_ and repo.dirstate.parents()[1] != nullid: | |
3722 | raise util.Abort(_('uncommitted merge - please provide a ' |
|
3723 | raise util.Abort(_('uncommitted merge - please provide a ' | |
3723 | 'specific revision')) |
|
3724 | 'specific revision')) | |
3724 |
r = repo |
|
3725 | r = cmdutil.revsingle(repo, rev_).node() | |
3725 |
|
3726 | |||
3726 | if not message: |
|
3727 | if not message: | |
3727 | # we don't translate commit messages |
|
3728 | # we don't translate commit messages |
@@ -69,12 +69,12 b' some random lookups' | |||||
69 | 6^^^^^: 0 |
|
69 | 6^^^^^: 0 | |
70 | 6^^^^^^: -1 |
|
70 | 6^^^^^^: -1 | |
71 | 6^1: 5 |
|
71 | 6^1: 5 | |
72 | 6^2: abort: unknown revision '6^2'! |
|
72 | 6^2: hg: parse error at 1: syntax error | |
73 | 6^^2: 4 |
|
73 | 6^^2: 4 | |
74 | 6^1^2: 4 |
|
74 | 6^1^2: 4 | |
75 | 6^^3: abort: unknown revision '6^^3'! |
|
75 | 6^^3: hg: parse error at 1: syntax error | |
76 | $ lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2" |
|
76 | $ lookup "6~" "6~1" "6~2" "6~3" "6~4" "6~5" "6~42" "6~1^2" "6~1^2~2" | |
77 | 6~: abort: unknown revision '6~'! |
|
77 | 6~: hg: parse error at 1: syntax error | |
78 | 6~1: 5 |
|
78 | 6~1: 5 | |
79 | 6~2: 3 |
|
79 | 6~2: 3 | |
80 | 6~3: 2 |
|
80 | 6~3: 2 | |
@@ -102,4 +102,4 b' with a tag "foo^bar" pointing to rev 2' | |||||
102 | $ hg tag -l -r 2 "foo^bar" |
|
102 | $ hg tag -l -r 2 "foo^bar" | |
103 | $ lookup "foo^bar" "foo^bar^" |
|
103 | $ lookup "foo^bar" "foo^bar^" | |
104 | foo^bar: 2 |
|
104 | foo^bar: 2 | |
105 | foo^bar^: abort: unknown revision 'foo^bar^'! |
|
105 | foo^bar^: hg: parse error at 3: syntax error |
General Comments 0
You need to be logged in to leave comments.
Login now