Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 14357:cb4ff8ef466b
merge with stable
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Wed, 18 May 2011 09:56:27 +0200 |
parents | 9ed227f79e47 02a5bebd0dc4 |
children | 4f695345979c |
comparison
equal
deleted
inserted
replaced
14352:077cdf172580 | 14357:cb4ff8ef466b |
---|---|
331 getargs(x, 0, 0, _("closed takes no arguments")) | 331 getargs(x, 0, 0, _("closed takes no arguments")) |
332 return [r for r in subset if repo[r].extra().get('close')] | 332 return [r for r in subset if repo[r].extra().get('close')] |
333 | 333 |
334 def contains(repo, subset, x): | 334 def contains(repo, subset, x): |
335 """``contains(pattern)`` | 335 """``contains(pattern)`` |
336 Revision contains pattern. | 336 Revision contains a file matching pattern. See :hg:`help patterns` |
337 for information about file patterns. | |
337 """ | 338 """ |
338 # i18n: "contains" is a keyword | 339 # i18n: "contains" is a keyword |
339 pat = getstring(x, _("contains requires a pattern")) | 340 pat = getstring(x, _("contains requires a pattern")) |
340 m = matchmod.match(repo.root, repo.getcwd(), [pat]) | 341 m = matchmod.match(repo.root, repo.getcwd(), [pat]) |
341 s = [] | 342 s = [] |
430 return subset | 431 return subset |
431 | 432 |
432 def grep(repo, subset, x): | 433 def grep(repo, subset, x): |
433 """``grep(regex)`` | 434 """``grep(regex)`` |
434 Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')`` | 435 Like ``keyword(string)`` but accepts a regex. Use ``grep(r'...')`` |
435 to ensure special escape characters are handled correctly. | 436 to ensure special escape characters are handled correctly. Unlike |
437 ``keyword(string)``, the match is case-sensitive. | |
436 """ | 438 """ |
437 try: | 439 try: |
438 # i18n: "grep" is a keyword | 440 # i18n: "grep" is a keyword |
439 gr = re.compile(getstring(x, _("grep requires a string"))) | 441 gr = re.compile(getstring(x, _("grep requires a string"))) |
440 except re.error, e: | 442 except re.error, e: |
483 return [r for r in s if r not in ps] | 485 return [r for r in s if r not in ps] |
484 | 486 |
485 def keyword(repo, subset, x): | 487 def keyword(repo, subset, x): |
486 """``keyword(string)`` | 488 """``keyword(string)`` |
487 Search commit message, user name, and names of changed files for | 489 Search commit message, user name, and names of changed files for |
488 string. | 490 string. The match is case-insensitive. |
489 """ | 491 """ |
490 # i18n: "keyword" is a keyword | 492 # i18n: "keyword" is a keyword |
491 kw = getstring(x, _("keyword requires a string")).lower() | 493 kw = getstring(x, _("keyword requires a string")).lower() |
492 l = [] | 494 l = [] |
493 for r in subset: | 495 for r in subset: |
778 l.append(e) | 780 l.append(e) |
779 l.sort() | 781 l.sort() |
780 return [e[-1] for e in l] | 782 return [e[-1] for e in l] |
781 | 783 |
782 def tag(repo, subset, x): | 784 def tag(repo, subset, x): |
783 """``tag(name)`` | 785 """``tag([name])`` |
784 The specified tag by name, or all tagged revisions if no name is given. | 786 The specified tag by name, or all tagged revisions if no name is given. |
785 """ | 787 """ |
786 # i18n: "tag" is a keyword | 788 # i18n: "tag" is a keyword |
787 args = getargs(x, 0, 1, _("tag takes one or no arguments")) | 789 args = getargs(x, 0, 1, _("tag takes one or no arguments")) |
788 cl = repo.changelog | 790 cl = repo.changelog |
800 def tagged(repo, subset, x): | 802 def tagged(repo, subset, x): |
801 return tag(repo, subset, x) | 803 return tag(repo, subset, x) |
802 | 804 |
803 def user(repo, subset, x): | 805 def user(repo, subset, x): |
804 """``user(string)`` | 806 """``user(string)`` |
805 User name is string. | 807 User name contains string. The match is case-insensitive. |
806 """ | 808 """ |
807 return author(repo, subset, x) | 809 return author(repo, subset, x) |
808 | 810 |
809 symbols = { | 811 symbols = { |
810 "adds": adds, | 812 "adds": adds, |