Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 13359:87f248e78173
bookmarks: move revset support to core
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 10 Feb 2011 13:46:28 -0600 |
parents | 3da456d0c885 |
children | 117990768fe0 |
comparison
equal
deleted
inserted
replaced
13358:f26a51857dc7 | 13359:87f248e78173 |
---|---|
5 # This software may be used and distributed according to the terms of the | 5 # This software may be used and distributed according to the terms of the |
6 # GNU General Public License version 2 or any later version. | 6 # GNU General Public License version 2 or any later version. |
7 | 7 |
8 import re | 8 import re |
9 import parser, util, error, discovery | 9 import parser, util, error, discovery |
10 import bookmarks as bookmarksmod | |
10 import match as matchmod | 11 import match as matchmod |
11 from i18n import _, gettext | 12 from i18n import _, gettext |
12 | 13 |
13 elements = { | 14 elements = { |
14 "(": (20, ("group", 1, ")"), ("func", 1, ")")), | 15 "(": (20, ("group", 1, ")"), ("func", 1, ")")), |
662 return [r for r in subset if r in s] | 663 return [r for r in subset if r in s] |
663 | 664 |
664 def tagged(repo, subset, x): | 665 def tagged(repo, subset, x): |
665 return tag(repo, subset, x) | 666 return tag(repo, subset, x) |
666 | 667 |
668 def bookmark(repo, subset, x): | |
669 """``bookmark([name])`` | |
670 The named bookmark or all bookmarks. | |
671 """ | |
672 # i18n: "bookmark" is a keyword | |
673 args = getargs(x, 0, 1, _('bookmark takes one or no arguments')) | |
674 if args: | |
675 bm = getstring(args[0], | |
676 # i18n: "bookmark" is a keyword | |
677 _('the argument to bookmark must be a string')) | |
678 bmrev = bookmarksmod.listbookmarks(repo).get(bm, None) | |
679 if bmrev: | |
680 bmrev = repo[bmrev].rev() | |
681 return [r for r in subset if r == bmrev] | |
682 bms = set([repo[r].rev() | |
683 for r in bookmarksmod.listbookmarks(repo).values()]) | |
684 return [r for r in subset if r in bms] | |
685 | |
667 symbols = { | 686 symbols = { |
668 "adds": adds, | 687 "adds": adds, |
669 "all": getall, | 688 "all": getall, |
670 "ancestor": ancestor, | 689 "ancestor": ancestor, |
671 "ancestors": ancestors, | 690 "ancestors": ancestors, |
672 "author": author, | 691 "author": author, |
692 "bookmark": bookmark, | |
673 "branch": branch, | 693 "branch": branch, |
674 "children": children, | 694 "children": children, |
675 "closed": closed, | 695 "closed": closed, |
676 "contains": contains, | 696 "contains": contains, |
677 "date": date, | 697 "date": date, |