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