Show More
@@ -918,6 +918,25 b' def merge(repo, subset, x):' | |||||
918 | cl = repo.changelog |
|
918 | cl = repo.changelog | |
919 | return [r for r in subset if cl.parentrevs(r)[1] != -1] |
|
919 | return [r for r in subset if cl.parentrevs(r)[1] != -1] | |
920 |
|
920 | |||
|
921 | def branchpoint(repo, subset, x): | |||
|
922 | """``branchpoint()`` | |||
|
923 | Changesets with more than one child. | |||
|
924 | """ | |||
|
925 | # i18n: "branchpoint" is a keyword | |||
|
926 | getargs(x, 0, 0, _("branchpoint takes no arguments")) | |||
|
927 | cl = repo.changelog | |||
|
928 | if not subset: | |||
|
929 | return [] | |||
|
930 | baserev = min(subset) | |||
|
931 | parentscount = [0]*(len(repo) - baserev) | |||
|
932 | for r in xrange(baserev + 1, len(repo)): | |||
|
933 | for p in cl.parentrevs(r): | |||
|
934 | if p >= baserev: | |||
|
935 | parentscount[p - baserev] += 1 | |||
|
936 | branchpoints = set((baserev + i) for i in xrange(len(parentscount)) | |||
|
937 | if parentscount[i] > 1) | |||
|
938 | return [r for r in subset if r in branchpoints] | |||
|
939 | ||||
921 | def minrev(repo, subset, x): |
|
940 | def minrev(repo, subset, x): | |
922 | """``min(set)`` |
|
941 | """``min(set)`` | |
923 | Changeset with lowest revision number in set. |
|
942 | Changeset with lowest revision number in set. | |
@@ -1474,6 +1493,7 b' symbols = {' | |||||
1474 | "bisected": bisected, |
|
1493 | "bisected": bisected, | |
1475 | "bookmark": bookmark, |
|
1494 | "bookmark": bookmark, | |
1476 | "branch": branch, |
|
1495 | "branch": branch, | |
|
1496 | "branchpoint": branchpoint, | |||
1477 | "children": children, |
|
1497 | "children": children, | |
1478 | "closed": closed, |
|
1498 | "closed": closed, | |
1479 | "contains": contains, |
|
1499 | "contains": contains, |
@@ -332,6 +332,9 b' quoting needed' | |||||
332 | 0 |
|
332 | 0 | |
333 | $ log 'merge()' |
|
333 | $ log 'merge()' | |
334 | 6 |
|
334 | 6 | |
|
335 | $ log 'branchpoint()' | |||
|
336 | 1 | |||
|
337 | 4 | |||
335 | $ log 'modifies(b)' |
|
338 | $ log 'modifies(b)' | |
336 | 4 |
|
339 | 4 | |
337 | $ log 'modifies("path:b")' |
|
340 | $ log 'modifies("path:b")' | |
@@ -362,6 +365,13 b' quoting needed' | |||||
362 | $ log 'parents(merge())' |
|
365 | $ log 'parents(merge())' | |
363 | 4 |
|
366 | 4 | |
364 | 5 |
|
367 | 5 | |
|
368 | $ log 'p1(branchpoint())' | |||
|
369 | 0 | |||
|
370 | 2 | |||
|
371 | $ log 'p2(branchpoint())' | |||
|
372 | $ log 'parents(branchpoint())' | |||
|
373 | 0 | |||
|
374 | 2 | |||
365 | $ log 'removes(a)' |
|
375 | $ log 'removes(a)' | |
366 | 2 |
|
376 | 2 | |
367 | 6 |
|
377 | 6 |
General Comments 0
You need to be logged in to leave comments.
Login now