Show More
@@ -206,7 +206,8 b' def p1(repo, subset, x):' | |||
|
206 | 206 | First parent of changesets in set, or the working directory. |
|
207 | 207 | """ |
|
208 | 208 | if x is None: |
|
209 |
|
|
|
209 | p = repo[x].parents()[0].rev() | |
|
210 | return [r for r in subset if r == p] | |
|
210 | 211 | |
|
211 | 212 | ps = set() |
|
212 | 213 | cl = repo.changelog |
@@ -221,7 +222,8 b' def p2(repo, subset, x):' | |||
|
221 | 222 | if x is None: |
|
222 | 223 | ps = repo[x].parents() |
|
223 | 224 | try: |
|
224 |
|
|
|
225 | p = ps[1].rev() | |
|
226 | return [r for r in subset if r == p] | |
|
225 | 227 | except IndexError: |
|
226 | 228 | return [] |
|
227 | 229 | |
@@ -237,7 +239,8 b' def parents(repo, subset, x):' | |||
|
237 | 239 | """ |
|
238 | 240 | repo.ui.debug(repr(x), '\n') |
|
239 | 241 | if x is None: |
|
240 |
|
|
|
242 | ps = tuple(p.rev() for p in repo[x].parents()) | |
|
243 | return [r for r in subset if r in ps] | |
|
241 | 244 | |
|
242 | 245 | ps = set() |
|
243 | 246 | cl = repo.changelog |
@@ -14,9 +14,11 b'' | |||
|
14 | 14 | |
|
15 | 15 | $ try 'p1()' |
|
16 | 16 | ('func', ('symbol', 'p1'), None) |
|
17 | -1 | |
|
18 | 17 | $ try 'p2()' |
|
19 | 18 | ('func', ('symbol', 'p2'), None) |
|
19 | $ try 'parents()' | |
|
20 | ('func', ('symbol', 'parents'), None) | |
|
21 | None | |
|
20 | 22 | |
|
21 | 23 | null revision |
|
22 | 24 | $ log 'p1()' |
@@ -28,9 +30,11 b' working dir with a single parent' | |||
|
28 | 30 | $ hg ci -Aqm0 |
|
29 | 31 | $ log 'p1()' |
|
30 | 32 | 0 |
|
33 | $ log 'tag() and p1()' | |
|
31 | 34 | $ log 'p2()' |
|
32 | 35 | $ log 'parents()' |
|
33 | 36 | 0 |
|
37 | $ log 'tag() and parents()' | |
|
34 | 38 | |
|
35 | 39 | merge in progress |
|
36 | 40 | $ echo b > b |
@@ -43,6 +47,7 b' merge in progress' | |||
|
43 | 47 | 2 |
|
44 | 48 | $ log 'p2()' |
|
45 | 49 | 1 |
|
50 | $ log 'tag() and p2()' | |
|
46 | 51 | $ log 'parents()' |
|
52 | 1 | |
|
47 | 53 | 2 |
|
48 | 1 |
General Comments 0
You need to be logged in to leave comments.
Login now