equal
deleted
inserted
replaced
3 # Copyright 2010 Matt Mackall <mpm@selenic.com> |
3 # Copyright 2010 Matt Mackall <mpm@selenic.com> |
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, collections |
8 import re |
9 import parser, util, error, discovery, hbisect, phases |
9 import parser, util, error, discovery, hbisect, phases |
10 import node |
10 import node |
11 import bookmarks as bookmarksmod |
11 import bookmarks as bookmarksmod |
12 import match as matchmod |
12 import match as matchmod |
13 from i18n import _ |
13 from i18n import _ |
15 |
15 |
16 def _revancestors(repo, revs, followfirst): |
16 def _revancestors(repo, revs, followfirst): |
17 """Like revlog.ancestors(), but supports followfirst.""" |
17 """Like revlog.ancestors(), but supports followfirst.""" |
18 cut = followfirst and 1 or None |
18 cut = followfirst and 1 or None |
19 cl = repo.changelog |
19 cl = repo.changelog |
20 visit = collections.deque(revs) |
20 visit = util.deque(revs) |
21 seen = set([node.nullrev]) |
21 seen = set([node.nullrev]) |
22 while visit: |
22 while visit: |
23 for parent in cl.parentrevs(visit.popleft())[:cut]: |
23 for parent in cl.parentrevs(visit.popleft())[:cut]: |
24 if parent not in seen: |
24 if parent not in seen: |
25 visit.append(parent) |
25 visit.append(parent) |