Show More
@@ -98,11 +98,15 b' def _genrevdescendants(repo, revs, follo' | |||||
98 | if first == nullrev: |
|
98 | if first == nullrev: | |
99 | # Are there nodes with a null first parent and a non-null |
|
99 | # Are there nodes with a null first parent and a non-null | |
100 | # second one? Maybe. Do we care? Probably not. |
|
100 | # second one? Maybe. Do we care? Probably not. | |
|
101 | yield first | |||
101 | for i in cl: |
|
102 | for i in cl: | |
102 | yield i |
|
103 | yield i | |
103 | else: |
|
104 | else: | |
104 | seen = set(revs) |
|
105 | seen = set(revs) | |
105 |
for i in cl.revs(first |
|
106 | for i in cl.revs(first): | |
|
107 | if i in seen: | |||
|
108 | yield i | |||
|
109 | continue | |||
106 | for x in cl.parentrevs(i)[:cut]: |
|
110 | for x in cl.parentrevs(i)[:cut]: | |
107 | if x != nullrev and x in seen: |
|
111 | if x != nullrev and x in seen: | |
108 | seen.add(i) |
|
112 | seen.add(i) | |
@@ -110,7 +114,8 b' def _genrevdescendants(repo, revs, follo' | |||||
110 | break |
|
114 | break | |
111 |
|
115 | |||
112 | def revdescendants(repo, revs, followfirst): |
|
116 | def revdescendants(repo, revs, followfirst): | |
113 |
"""Like revlog.descendants() but supports |
|
117 | """Like revlog.descendants() but supports additional options, includes | |
|
118 | the given revs themselves, and returns a smartset""" | |||
114 | gen = _genrevdescendants(repo, revs, followfirst) |
|
119 | gen = _genrevdescendants(repo, revs, followfirst) | |
115 | return generatorset(gen, iterasc=True) |
|
120 | return generatorset(gen, iterasc=True) | |
116 |
|
121 |
@@ -600,19 +600,7 b' def _descendants(repo, subset, x, follow' | |||||
600 | if not roots: |
|
600 | if not roots: | |
601 | return baseset() |
|
601 | return baseset() | |
602 | s = dagop.revdescendants(repo, roots, followfirst) |
|
602 | s = dagop.revdescendants(repo, roots, followfirst) | |
603 |
|
603 | return subset & s | ||
604 | # Both sets need to be ascending in order to lazily return the union |
|
|||
605 | # in the correct order. |
|
|||
606 | base = subset & roots |
|
|||
607 | desc = subset & s |
|
|||
608 | result = base + desc |
|
|||
609 | if subset.isascending(): |
|
|||
610 | result.sort() |
|
|||
611 | elif subset.isdescending(): |
|
|||
612 | result.sort(reverse=True) |
|
|||
613 | else: |
|
|||
614 | result = subset & result |
|
|||
615 | return result |
|
|||
616 |
|
604 | |||
617 | @predicate('descendants(set)', safe=True) |
|
605 | @predicate('descendants(set)', safe=True) | |
618 | def descendants(repo, subset, x): |
|
606 | def descendants(repo, subset, x): |
General Comments 0
You need to be logged in to leave comments.
Login now