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