Show More
@@ -0,0 +1,42 b'' | |||
|
1 | $ HGENCODING=utf-8 | |
|
2 | $ export HGENCODING | |
|
3 | ||
|
4 | $ try() { | |
|
5 | > hg debugrevspec --debug $@ | |
|
6 | > } | |
|
7 | ||
|
8 | $ log() { | |
|
9 | > hg log --template '{rev}\n' -r "$1" | |
|
10 | > } | |
|
11 | ||
|
12 | $ hg init repo | |
|
13 | $ cd repo | |
|
14 | ||
|
15 | $ try 'p1()' | |
|
16 | ('func', ('symbol', 'p1'), None) | |
|
17 | -1 | |
|
18 | $ try 'p2()' | |
|
19 | ('func', ('symbol', 'p2'), None) | |
|
20 | ||
|
21 | null revision | |
|
22 | $ log 'p1()' | |
|
23 | $ log 'p2()' | |
|
24 | ||
|
25 | working dir with a single parent | |
|
26 | $ echo a > a | |
|
27 | $ hg ci -Aqm0 | |
|
28 | $ log 'p1()' | |
|
29 | 0 | |
|
30 | $ log 'p2()' | |
|
31 | ||
|
32 | merge in progress | |
|
33 | $ echo b > b | |
|
34 | $ hg ci -Aqm1 | |
|
35 | $ hg up -q 0 | |
|
36 | $ echo c > c | |
|
37 | $ hg ci -Aqm2 | |
|
38 | $ hg merge -q | |
|
39 | $ log 'p1()' | |
|
40 | 2 | |
|
41 | $ log 'p2()' | |
|
42 | 1 |
@@ -202,9 +202,12 b' def rev(repo, subset, x):' | |||
|
202 | 202 | return [r for r in subset if r == l] |
|
203 | 203 | |
|
204 | 204 | def p1(repo, subset, x): |
|
205 | """``p1(set)`` | |
|
206 | First parent of changesets in set. | |
|
205 | """``p1([set])`` | |
|
206 | First parent of changesets in set, or the working directory. | |
|
207 | 207 | """ |
|
208 | if x is None: | |
|
209 | return [repo[x].parents()[0].rev()] | |
|
210 | ||
|
208 | 211 | ps = set() |
|
209 | 212 | cl = repo.changelog |
|
210 | 213 | for r in getset(repo, range(len(repo)), x): |
@@ -212,9 +215,16 b' def p1(repo, subset, x):' | |||
|
212 | 215 | return [r for r in subset if r in ps] |
|
213 | 216 | |
|
214 | 217 | def p2(repo, subset, x): |
|
215 | """``p2(set)`` | |
|
216 | Second parent of changesets in set. | |
|
218 | """``p2([set])`` | |
|
219 | Second parent of changesets in set, or the working directory. | |
|
217 | 220 | """ |
|
221 | if x is None: | |
|
222 | ps = repo[x].parents() | |
|
223 | try: | |
|
224 | return [ps[1].rev()] | |
|
225 | except IndexError: | |
|
226 | return [] | |
|
227 | ||
|
218 | 228 | ps = set() |
|
219 | 229 | cl = repo.changelog |
|
220 | 230 | for r in getset(repo, range(len(repo)), x): |
General Comments 0
You need to be logged in to leave comments.
Login now