Mercurial > hg
comparison mercurial/commands.py @ 16866:91f3ac205816
revlog: ancestors(*revs) becomes ancestors(revs) (API)
Accepting a variable number of arguments as the old API did is
deeply ugly, particularly as it means the API can't be extended
with new arguments. Partly as a result, we have at least three
different implementations of the same ancestors algorithm (!?).
Most callers were forced to call ancestors(*somelist), adding to
both inefficiency and ugliness.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Fri, 01 Jun 2012 12:37:18 -0700 |
parents | 92cfde8728ac |
children | 54b03085065f |
comparison
equal
deleted
inserted
replaced
16865:a6543fdcf869 | 16866:91f3ac205816 |
---|---|
5394 # all ancestors of branch heads - all ancestors of parent = new csets | 5394 # all ancestors of branch heads - all ancestors of parent = new csets |
5395 new = [0] * len(repo) | 5395 new = [0] * len(repo) |
5396 cl = repo.changelog | 5396 cl = repo.changelog |
5397 for a in [cl.rev(n) for n in bheads]: | 5397 for a in [cl.rev(n) for n in bheads]: |
5398 new[a] = 1 | 5398 new[a] = 1 |
5399 for a in cl.ancestors(*[cl.rev(n) for n in bheads]): | 5399 for a in cl.ancestors([cl.rev(n) for n in bheads]): |
5400 new[a] = 1 | 5400 new[a] = 1 |
5401 for a in [p.rev() for p in parents]: | 5401 for a in [p.rev() for p in parents]: |
5402 if a >= 0: | 5402 if a >= 0: |
5403 new[a] = 0 | 5403 new[a] = 0 |
5404 for a in cl.ancestors(*[p.rev() for p in parents]): | 5404 for a in cl.ancestors([p.rev() for p in parents]): |
5405 new[a] = 0 | 5405 new[a] = 0 |
5406 new = sum(new) | 5406 new = sum(new) |
5407 | 5407 |
5408 if new == 0: | 5408 if new == 0: |
5409 ui.status(_('update: (current)\n')) | 5409 ui.status(_('update: (current)\n')) |