##// END OF EJS Templates
revsets: add branchpoint() function...
Ivan Andrus -
r17753:69d5078d default
parent child Browse files
Show More
@@ -918,6 +918,25 b' def merge(repo, subset, x):'
918 918 cl = repo.changelog
919 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 940 def minrev(repo, subset, x):
922 941 """``min(set)``
923 942 Changeset with lowest revision number in set.
@@ -1474,6 +1493,7 b' symbols = {'
1474 1493 "bisected": bisected,
1475 1494 "bookmark": bookmark,
1476 1495 "branch": branch,
1496 "branchpoint": branchpoint,
1477 1497 "children": children,
1478 1498 "closed": closed,
1479 1499 "contains": contains,
@@ -332,6 +332,9 b' quoting needed'
332 332 0
333 333 $ log 'merge()'
334 334 6
335 $ log 'branchpoint()'
336 1
337 4
335 338 $ log 'modifies(b)'
336 339 4
337 340 $ log 'modifies("path:b")'
@@ -362,6 +365,13 b' quoting needed'
362 365 $ log 'parents(merge())'
363 366 4
364 367 5
368 $ log 'p1(branchpoint())'
369 0
370 2
371 $ log 'p2(branchpoint())'
372 $ log 'parents(branchpoint())'
373 0
374 2
365 375 $ log 'removes(a)'
366 376 2
367 377 6
General Comments 0
You need to be logged in to leave comments. Login now