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