Show More
@@ -174,7 +174,9 b' def func(repo, subset, a, b):' | |||||
174 | # functions |
|
174 | # functions | |
175 |
|
175 | |||
176 | def node(repo, subset, x): |
|
176 | def node(repo, subset, x): | |
|
177 | # i18n: "id" is a keyword | |||
177 | l = getargs(x, 1, 1, _("id requires one argument")) |
|
178 | l = getargs(x, 1, 1, _("id requires one argument")) | |
|
179 | # i18n: "id" is a keyword | |||
178 | n = getstring(l[0], _("id requires a string")) |
|
180 | n = getstring(l[0], _("id requires a string")) | |
179 | if len(n) == 40: |
|
181 | if len(n) == 40: | |
180 | rn = repo[n].rev() |
|
182 | rn = repo[n].rev() | |
@@ -183,10 +185,13 b' def node(repo, subset, x):' | |||||
183 | return [r for r in subset if r == rn] |
|
185 | return [r for r in subset if r == rn] | |
184 |
|
186 | |||
185 | def rev(repo, subset, x): |
|
187 | def rev(repo, subset, x): | |
|
188 | # i18n: "rev" is a keyword | |||
186 | l = getargs(x, 1, 1, _("rev requires one argument")) |
|
189 | l = getargs(x, 1, 1, _("rev requires one argument")) | |
187 | try: |
|
190 | try: | |
|
191 | # i18n: "rev" is a keyword | |||
188 | l = int(getstring(l[0], _("rev requires a number"))) |
|
192 | l = int(getstring(l[0], _("rev requires a number"))) | |
189 | except ValueError: |
|
193 | except ValueError: | |
|
194 | # i18n: "rev" is a keyword | |||
190 | raise error.ParseError(_("rev expects a number")) |
|
195 | raise error.ParseError(_("rev expects a number")) | |
191 | return [r for r in subset if r == l] |
|
196 | return [r for r in subset if r == l] | |
192 |
|
197 | |||
@@ -228,10 +233,13 b' def minrev(repo, subset, x):' | |||||
228 | return [] |
|
233 | return [] | |
229 |
|
234 | |||
230 | def limit(repo, subset, x): |
|
235 | def limit(repo, subset, x): | |
|
236 | # i18n: "limit" is a keyword | |||
231 | l = getargs(x, 2, 2, _("limit requires two arguments")) |
|
237 | l = getargs(x, 2, 2, _("limit requires two arguments")) | |
232 | try: |
|
238 | try: | |
|
239 | # i18n: "limit" is a keyword | |||
233 | lim = int(getstring(l[1], _("limit requires a number"))) |
|
240 | lim = int(getstring(l[1], _("limit requires a number"))) | |
234 | except ValueError: |
|
241 | except ValueError: | |
|
242 | # i18n: "limit" is a keyword | |||
235 | raise error.ParseError(_("limit expects a number")) |
|
243 | raise error.ParseError(_("limit expects a number")) | |
236 | return getset(repo, subset, l[0])[:lim] |
|
244 | return getset(repo, subset, l[0])[:lim] | |
237 |
|
245 | |||
@@ -254,11 +262,13 b' def branch(repo, subset, x):' | |||||
254 | return [r for r in subset if r in s or repo[r].branch() in b] |
|
262 | return [r for r in subset if r in s or repo[r].branch() in b] | |
255 |
|
263 | |||
256 | def ancestor(repo, subset, x): |
|
264 | def ancestor(repo, subset, x): | |
|
265 | # i18n: "ancestor" is a keyword | |||
257 | l = getargs(x, 2, 2, _("ancestor requires two arguments")) |
|
266 | l = getargs(x, 2, 2, _("ancestor requires two arguments")) | |
258 | r = range(len(repo)) |
|
267 | r = range(len(repo)) | |
259 | a = getset(repo, r, l[0]) |
|
268 | a = getset(repo, r, l[0]) | |
260 | b = getset(repo, r, l[1]) |
|
269 | b = getset(repo, r, l[1]) | |
261 | if len(a) != 1 or len(b) != 1: |
|
270 | if len(a) != 1 or len(b) != 1: | |
|
271 | # i18n: "ancestor" is a keyword | |||
262 | raise error.ParseError(_("ancestor arguments must be single revisions")) |
|
272 | raise error.ParseError(_("ancestor arguments must be single revisions")) | |
263 | an = [repo[a[0]].ancestor(repo[b[0]]).rev()] |
|
273 | an = [repo[a[0]].ancestor(repo[b[0]]).rev()] | |
264 |
|
274 | |||
@@ -279,17 +289,20 b' def descendants(repo, subset, x):' | |||||
279 | return [r for r in subset if r in s] |
|
289 | return [r for r in subset if r in s] | |
280 |
|
290 | |||
281 | def follow(repo, subset, x): |
|
291 | def follow(repo, subset, x): | |
|
292 | # i18n: "follow" is a keyword | |||
282 | getargs(x, 0, 0, _("follow takes no arguments")) |
|
293 | getargs(x, 0, 0, _("follow takes no arguments")) | |
283 | p = repo['.'].rev() |
|
294 | p = repo['.'].rev() | |
284 | s = set(repo.changelog.ancestors(p)) | set([p]) |
|
295 | s = set(repo.changelog.ancestors(p)) | set([p]) | |
285 | return [r for r in subset if r in s] |
|
296 | return [r for r in subset if r in s] | |
286 |
|
297 | |||
287 | def date(repo, subset, x): |
|
298 | def date(repo, subset, x): | |
|
299 | # i18n: "date" is a keyword | |||
288 | ds = getstring(x, _("date requires a string")) |
|
300 | ds = getstring(x, _("date requires a string")) | |
289 | dm = util.matchdate(ds) |
|
301 | dm = util.matchdate(ds) | |
290 | return [r for r in subset if dm(repo[r].date()[0])] |
|
302 | return [r for r in subset if dm(repo[r].date()[0])] | |
291 |
|
303 | |||
292 | def keyword(repo, subset, x): |
|
304 | def keyword(repo, subset, x): | |
|
305 | # i18n: "keyword" is a keyword | |||
293 | kw = getstring(x, _("keyword requires a string")).lower() |
|
306 | kw = getstring(x, _("keyword requires a string")).lower() | |
294 | l = [] |
|
307 | l = [] | |
295 | for r in subset: |
|
308 | for r in subset: | |
@@ -301,6 +314,7 b' def keyword(repo, subset, x):' | |||||
301 |
|
314 | |||
302 | def grep(repo, subset, x): |
|
315 | def grep(repo, subset, x): | |
303 | try: |
|
316 | try: | |
|
317 | # i18n: "grep" is a keyword | |||
304 | gr = re.compile(getstring(x, _("grep requires a string"))) |
|
318 | gr = re.compile(getstring(x, _("grep requires a string"))) | |
305 | except re.error, e: |
|
319 | except re.error, e: | |
306 | raise error.ParseError(_('invalid match pattern: %s') % e) |
|
320 | raise error.ParseError(_('invalid match pattern: %s') % e) | |
@@ -314,10 +328,12 b' def grep(repo, subset, x):' | |||||
314 | return l |
|
328 | return l | |
315 |
|
329 | |||
316 | def author(repo, subset, x): |
|
330 | def author(repo, subset, x): | |
|
331 | # i18n: "author" is a keyword | |||
317 | n = getstring(x, _("author requires a string")).lower() |
|
332 | n = getstring(x, _("author requires a string")).lower() | |
318 | return [r for r in subset if n in repo[r].user().lower()] |
|
333 | return [r for r in subset if n in repo[r].user().lower()] | |
319 |
|
334 | |||
320 | def hasfile(repo, subset, x): |
|
335 | def hasfile(repo, subset, x): | |
|
336 | # i18n: "file" is a keyword | |||
321 | pat = getstring(x, _("file requires a pattern")) |
|
337 | pat = getstring(x, _("file requires a pattern")) | |
322 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
|
338 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) | |
323 | s = [] |
|
339 | s = [] | |
@@ -329,6 +345,7 b' def hasfile(repo, subset, x):' | |||||
329 | return s |
|
345 | return s | |
330 |
|
346 | |||
331 | def contains(repo, subset, x): |
|
347 | def contains(repo, subset, x): | |
|
348 | # i18n: "contains" is a keyword | |||
332 | pat = getstring(x, _("contains requires a pattern")) |
|
349 | pat = getstring(x, _("contains requires a pattern")) | |
333 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
|
350 | m = matchmod.match(repo.root, repo.getcwd(), [pat]) | |
334 | s = [] |
|
351 | s = [] | |
@@ -373,27 +390,33 b' def checkstatus(repo, subset, pat, field' | |||||
373 | return s |
|
390 | return s | |
374 |
|
391 | |||
375 | def modifies(repo, subset, x): |
|
392 | def modifies(repo, subset, x): | |
|
393 | # i18n: "modifies" is a keyword | |||
376 | pat = getstring(x, _("modifies requires a pattern")) |
|
394 | pat = getstring(x, _("modifies requires a pattern")) | |
377 | return checkstatus(repo, subset, pat, 0) |
|
395 | return checkstatus(repo, subset, pat, 0) | |
378 |
|
396 | |||
379 | def adds(repo, subset, x): |
|
397 | def adds(repo, subset, x): | |
|
398 | # i18n: "adds" is a keyword | |||
380 | pat = getstring(x, _("adds requires a pattern")) |
|
399 | pat = getstring(x, _("adds requires a pattern")) | |
381 | return checkstatus(repo, subset, pat, 1) |
|
400 | return checkstatus(repo, subset, pat, 1) | |
382 |
|
401 | |||
383 | def removes(repo, subset, x): |
|
402 | def removes(repo, subset, x): | |
|
403 | # i18n: "removes" is a keyword | |||
384 | pat = getstring(x, _("removes requires a pattern")) |
|
404 | pat = getstring(x, _("removes requires a pattern")) | |
385 | return checkstatus(repo, subset, pat, 2) |
|
405 | return checkstatus(repo, subset, pat, 2) | |
386 |
|
406 | |||
387 | def merge(repo, subset, x): |
|
407 | def merge(repo, subset, x): | |
|
408 | # i18n: "merge" is a keyword | |||
388 | getargs(x, 0, 0, _("merge takes no arguments")) |
|
409 | getargs(x, 0, 0, _("merge takes no arguments")) | |
389 | cl = repo.changelog |
|
410 | cl = repo.changelog | |
390 | return [r for r in subset if cl.parentrevs(r)[1] != -1] |
|
411 | return [r for r in subset if cl.parentrevs(r)[1] != -1] | |
391 |
|
412 | |||
392 | def closed(repo, subset, x): |
|
413 | def closed(repo, subset, x): | |
|
414 | # i18n: "closed" is a keyword | |||
393 | getargs(x, 0, 0, _("closed takes no arguments")) |
|
415 | getargs(x, 0, 0, _("closed takes no arguments")) | |
394 | return [r for r in subset if repo[r].extra().get('close')] |
|
416 | return [r for r in subset if repo[r].extra().get('close')] | |
395 |
|
417 | |||
396 | def head(repo, subset, x): |
|
418 | def head(repo, subset, x): | |
|
419 | # i18n: "head" is a keyword | |||
397 | getargs(x, 0, 0, _("head takes no arguments")) |
|
420 | getargs(x, 0, 0, _("head takes no arguments")) | |
398 | hs = set() |
|
421 | hs = set() | |
399 | for b, ls in repo.branchmap().iteritems(): |
|
422 | for b, ls in repo.branchmap().iteritems(): | |
@@ -412,6 +435,7 b' def present(repo, subset, x):' | |||||
412 | return [] |
|
435 | return [] | |
413 |
|
436 | |||
414 | def sort(repo, subset, x): |
|
437 | def sort(repo, subset, x): | |
|
438 | # i18n: "sort" is a keyword | |||
415 | l = getargs(x, 1, 2, _("sort requires one or two arguments")) |
|
439 | l = getargs(x, 1, 2, _("sort requires one or two arguments")) | |
416 | keys = "rev" |
|
440 | keys = "rev" | |
417 | if len(l) == 2: |
|
441 | if len(l) == 2: | |
@@ -454,6 +478,7 b' def sort(repo, subset, x):' | |||||
454 | return [e[-1] for e in l] |
|
478 | return [e[-1] for e in l] | |
455 |
|
479 | |||
456 | def getall(repo, subset, x): |
|
480 | def getall(repo, subset, x): | |
|
481 | # i18n: "all" is a keyword | |||
457 | getargs(x, 0, 0, _("all takes no arguments")) |
|
482 | getargs(x, 0, 0, _("all takes no arguments")) | |
458 | return subset |
|
483 | return subset | |
459 |
|
484 | |||
@@ -469,7 +494,9 b' def roots(repo, subset, x):' | |||||
469 |
|
494 | |||
470 | def outgoing(repo, subset, x): |
|
495 | def outgoing(repo, subset, x): | |
471 | import hg # avoid start-up nasties |
|
496 | import hg # avoid start-up nasties | |
|
497 | # i18n: "outgoing" is a keyword | |||
472 | l = getargs(x, 0, 1, _("outgoing requires a repository path")) |
|
498 | l = getargs(x, 0, 1, _("outgoing requires a repository path")) | |
|
499 | # i18n: "outgoing" is a keyword | |||
473 | dest = l and getstring(l[0], _("outgoing requires a repository path")) or '' |
|
500 | dest = l and getstring(l[0], _("outgoing requires a repository path")) or '' | |
474 | dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') |
|
501 | dest = repo.ui.expandpath(dest or 'default-push', dest or 'default') | |
475 | dest, branches = hg.parseurl(dest) |
|
502 | dest, branches = hg.parseurl(dest) | |
@@ -485,10 +512,12 b' def outgoing(repo, subset, x):' | |||||
485 | return [r for r in subset if r in o] |
|
512 | return [r for r in subset if r in o] | |
486 |
|
513 | |||
487 | def tag(repo, subset, x): |
|
514 | def tag(repo, subset, x): | |
|
515 | # i18n: "tag" is a keyword | |||
488 | args = getargs(x, 0, 1, _("tag takes one or no arguments")) |
|
516 | args = getargs(x, 0, 1, _("tag takes one or no arguments")) | |
489 | cl = repo.changelog |
|
517 | cl = repo.changelog | |
490 | if args: |
|
518 | if args: | |
491 | tn = getstring(args[0], |
|
519 | tn = getstring(args[0], | |
|
520 | # i18n: "tag" is a keyword | |||
492 | _('the argument to tag must be a string')) |
|
521 | _('the argument to tag must be a string')) | |
493 | s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) |
|
522 | s = set([cl.rev(n) for t, n in repo.tagslist() if t == tn]) | |
494 | else: |
|
523 | else: |
General Comments 0
You need to be logged in to leave comments.
Login now