Show More
@@ -97,9 +97,9 b' def getlist(x):' | |||||
97 | return getlist(x[1]) + [x[2]] |
|
97 | return getlist(x[1]) + [x[2]] | |
98 | return [x] |
|
98 | return [x] | |
99 |
|
99 | |||
100 |
def get |
|
100 | def getargs(x, min, max, err): | |
101 | l = getlist(x) |
|
101 | l = getlist(x) | |
102 | if len(l) != 2: |
|
102 | if len(l) < min or len(l) > max: | |
103 | raise error.ParseError(err) |
|
103 | raise error.ParseError(err) | |
104 | return l |
|
104 | return l | |
105 |
|
105 | |||
@@ -186,7 +186,7 b' def maxrev(repo, subset, x):' | |||||
186 | return [] |
|
186 | return [] | |
187 |
|
187 | |||
188 | def limit(repo, subset, x): |
|
188 | def limit(repo, subset, x): | |
189 |
l = get |
|
189 | l = getargs(x, 2, 2, "limit wants two args") | |
190 | try: |
|
190 | try: | |
191 | lim = int(getstring(l[1], "limit wants a number")) |
|
191 | lim = int(getstring(l[1], "limit wants a number")) | |
192 | except ValueError: |
|
192 | except ValueError: | |
@@ -212,7 +212,7 b' def branch(repo, subset, x):' | |||||
212 | return [r for r in subset if r in s or repo[r].branch() in b] |
|
212 | return [r for r in subset if r in s or repo[r].branch() in b] | |
213 |
|
213 | |||
214 | def ancestor(repo, subset, x): |
|
214 | def ancestor(repo, subset, x): | |
215 |
l = get |
|
215 | l = getargs(x, 2, 2, "ancestor wants two args") | |
216 | a = getset(repo, subset, l[0]) |
|
216 | a = getset(repo, subset, l[0]) | |
217 | b = getset(repo, subset, l[1]) |
|
217 | b = getset(repo, subset, l[1]) | |
218 | if len(a) > 1 or len(b) > 1: |
|
218 | if len(a) > 1 or len(b) > 1: | |
@@ -230,8 +230,7 b' def descendants(repo, subset, x):' | |||||
230 | return [r for r in subset if r in s] |
|
230 | return [r for r in subset if r in s] | |
231 |
|
231 | |||
232 | def follow(repo, subset, x): |
|
232 | def follow(repo, subset, x): | |
233 | if x: |
|
233 | getargs(x, 0, 0, "follow takes no arguments") | |
234 | raise error.ParseError("follow takes no args") |
|
|||
235 | p = repo['.'].rev() |
|
234 | p = repo['.'].rev() | |
236 | s = set(repo.changelog.ancestors(p)) | set([p]) |
|
235 | s = set(repo.changelog.ancestors(p)) | set([p]) | |
237 | return [r for r in subset if r in s] |
|
236 | return [r for r in subset if r in s] | |
@@ -334,15 +333,16 b' def removes(repo, subset, x):' | |||||
334 | return checkstatus(repo, subset, pat, 2) |
|
333 | return checkstatus(repo, subset, pat, 2) | |
335 |
|
334 | |||
336 | def merge(repo, subset, x): |
|
335 | def merge(repo, subset, x): | |
337 | if x: |
|
336 | getargs(x, 0, 0, "merge takes no arguments") | |
338 | raise error.ParseError("merge takes no args") |
|
|||
339 | cl = repo.changelog |
|
337 | cl = repo.changelog | |
340 | return [r for r in subset if cl.parentrevs(r)[1] != -1] |
|
338 | return [r for r in subset if cl.parentrevs(r)[1] != -1] | |
341 |
|
339 | |||
342 | def closed(repo, subset, x): |
|
340 | def closed(repo, subset, x): | |
|
341 | getargs(x, 0, 0, "closed takes no arguments") | |||
343 | return [r for r in subset if repo[r].extra('close')] |
|
342 | return [r for r in subset if repo[r].extra('close')] | |
344 |
|
343 | |||
345 | def head(repo, subset, x): |
|
344 | def head(repo, subset, x): | |
|
345 | getargs(x, 0, 0, "head takes no arguments") | |||
346 | hs = set() |
|
346 | hs = set() | |
347 | for b, ls in repo.branchmap().iteritems(): |
|
347 | for b, ls in repo.branchmap().iteritems(): | |
348 | hs.update(repo[h].rev() for h in ls) |
|
348 | hs.update(repo[h].rev() for h in ls) | |
@@ -354,7 +354,7 b' def reverse(repo, subset, x):' | |||||
354 | return l |
|
354 | return l | |
355 |
|
355 | |||
356 | def sort(repo, subset, x): |
|
356 | def sort(repo, subset, x): | |
357 | l = getlist(x) |
|
357 | l = getargs(x, 1, 2, "sort wants one or two arguments") | |
358 | keys = "rev" |
|
358 | keys = "rev" | |
359 | if len(l) == 2: |
|
359 | if len(l) == 2: | |
360 | keys = getstring(l[1], "sort spec must be a string") |
|
360 | keys = getstring(l[1], "sort spec must be a string") | |
@@ -396,6 +396,7 b' def sort(repo, subset, x):' | |||||
396 | return [e[-1] for e in l] |
|
396 | return [e[-1] for e in l] | |
397 |
|
397 | |||
398 | def getall(repo, subset, x): |
|
398 | def getall(repo, subset, x): | |
|
399 | getargs(x, 0, 0, "all takes no arguments") | |||
399 | return subset |
|
400 | return subset | |
400 |
|
401 | |||
401 | def heads(repo, subset, x): |
|
402 | def heads(repo, subset, x): | |
@@ -410,11 +411,8 b' def roots(repo, subset, x):' | |||||
410 |
|
411 | |||
411 | def outgoing(repo, subset, x): |
|
412 | def outgoing(repo, subset, x): | |
412 | import hg # avoid start-up nasties |
|
413 | import hg # avoid start-up nasties | |
413 | l = getlist(x) |
|
414 | l = getargs(x, 0, 1, "outgoing wants a repo path") | |
414 | if len(l) == 1: |
|
415 | dest = l[1:] or '' | |
415 | dest = getstring(l[0], "outgoing wants a repo path") |
|
|||
416 | else: |
|
|||
417 | dest = '' |
|
|||
418 | dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') |
|
416 | dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') | |
419 | dest, branches = hg.parseurl(dest) |
|
417 | dest, branches = hg.parseurl(dest) | |
420 | other = hg.repository(hg.remoteui(repo, {}), dest) |
|
418 | other = hg.repository(hg.remoteui(repo, {}), dest) | |
@@ -427,6 +425,7 b' def outgoing(repo, subset, x):' | |||||
427 | return [r for r in subset if r in o] |
|
425 | return [r for r in subset if r in o] | |
428 |
|
426 | |||
429 | def tagged(repo, subset, x): |
|
427 | def tagged(repo, subset, x): | |
|
428 | getargs(x, 0, 0, "tagged takes no arguments") | |||
430 | cl = repo.changelog |
|
429 | cl = repo.changelog | |
431 | s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) |
|
430 | s = set([cl.rev(n) for t, n in repo.tagslist() if t != 'tip']) | |
432 | return [r for r in subset if r in s] |
|
431 | return [r for r in subset if r in s] |
General Comments 0
You need to be logged in to leave comments.
Login now