##// END OF EJS Templates
revset: leverage orset() to flatten ancestor() arguments...
Yuya Nishihara -
r38508:626d29c6 default
parent child Browse files
Show More
@@ -203,6 +203,8 b' def _orsetlist(repo, subset, xs, order):'
203
203
204 def orset(repo, subset, x, order):
204 def orset(repo, subset, x, order):
205 xs = getlist(x)
205 xs = getlist(x)
206 if not xs:
207 return baseset()
206 if order == followorder:
208 if order == followorder:
207 # slow path to take the subset order
209 # slow path to take the subset order
208 return subset & _orsetlist(repo, fullreposet(repo), xs, anyorder)
210 return subset & _orsetlist(repo, fullreposet(repo), xs, anyorder)
@@ -309,17 +311,12 b' def ancestor(repo, subset, x):'
309 Will return empty list when passed no args.
311 Will return empty list when passed no args.
310 Greatest common ancestor of a single changeset is that changeset.
312 Greatest common ancestor of a single changeset is that changeset.
311 """
313 """
312 l = getlist(x)
313 rl = fullreposet(repo)
314 anc = None
314 anc = None
315
315 for r in orset(repo, fullreposet(repo), x, order=anyorder):
316 # (getset(repo, rl, i) for i in l) generates a list of lists
316 if anc is None:
317 for revs in (getset(repo, rl, i) for i in l):
317 anc = repo[r]
318 for r in revs:
318 else:
319 if anc is None:
319 anc = anc.ancestor(repo[r])
320 anc = repo[r]
321 else:
322 anc = anc.ancestor(repo[r])
323
320
324 if anc is not None and anc.rev() in subset:
321 if anc is not None and anc.rev() in subset:
325 return baseset([anc.rev()])
322 return baseset([anc.rev()])
General Comments 0
You need to be logged in to leave comments. Login now