Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 13602:54b198fe9768
revset: add a revset command to get bisect state.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sat, 12 Mar 2011 18:48:30 +0100 |
parents | cc4721ed7a2a |
children | e798e430c5e5 |
comparison
equal
deleted
inserted
replaced
13601:0388e3e36693 | 13602:54b198fe9768 |
---|---|
4 # | 4 # |
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, help | 9 import parser, util, error, discovery, help, hbisect |
10 import bookmarks as bookmarksmod | 10 import bookmarks as bookmarksmod |
11 import match as matchmod | 11 import match as matchmod |
12 from i18n import _ | 12 from i18n import _ |
13 | 13 |
14 elements = { | 14 elements = { |
681 return [r for r in subset if r == bmrev] | 681 return [r for r in subset if r == bmrev] |
682 bms = set([repo[r].rev() | 682 bms = set([repo[r].rev() |
683 for r in bookmarksmod.listbookmarks(repo).values()]) | 683 for r in bookmarksmod.listbookmarks(repo).values()]) |
684 return [r for r in subset if r in bms] | 684 return [r for r in subset if r in bms] |
685 | 685 |
686 def bisected(repo, subset, x): | |
687 """``bisected(string)`` | |
688 Changesets marked in the specified bisect state (good, bad, skip). | |
689 """ | |
690 state = getstring(x, _("bisect requires a string")).lower() | |
691 if state not in ('good', 'bad', 'skip', 'unknown'): | |
692 raise ParseError(_('invalid bisect state')) | |
693 marked = set(repo.changelog.rev(n) for n in hbisect.load_state(repo)[state]) | |
694 l = [] | |
695 for r in subset: | |
696 if r in marked: | |
697 l.append(r) | |
698 return l | |
699 | |
686 symbols = { | 700 symbols = { |
687 "adds": adds, | 701 "adds": adds, |
688 "all": getall, | 702 "all": getall, |
689 "ancestor": ancestor, | 703 "ancestor": ancestor, |
690 "ancestors": ancestors, | 704 "ancestors": ancestors, |
691 "author": author, | 705 "author": author, |
706 "bisected": bisected, | |
692 "bookmark": bookmark, | 707 "bookmark": bookmark, |
693 "branch": branch, | 708 "branch": branch, |
694 "children": children, | 709 "children": children, |
695 "closed": closed, | 710 "closed": closed, |
696 "contains": contains, | 711 "contains": contains, |