Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 8453:d1ca637b0773
revlog.missing(): use sets instead of a dict
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 17 May 2009 02:44:12 +0200 |
parents | 27bffd81d265 |
children | 7af92e70bb25 |
comparison
equal
deleted
inserted
replaced
8446:e1f4343db740 | 8453:d1ca637b0773 |
---|---|
622 has = set(self.ancestors(*common)) | 622 has = set(self.ancestors(*common)) |
623 has.add(nullrev) | 623 has.add(nullrev) |
624 has.update(common) | 624 has.update(common) |
625 | 625 |
626 # take all ancestors from heads that aren't in has | 626 # take all ancestors from heads that aren't in has |
627 missing = {} | 627 missing = set() |
628 visit = [r for r in heads if r not in has] | 628 visit = [r for r in heads if r not in has] |
629 while visit: | 629 while visit: |
630 r = visit.pop(0) | 630 r = visit.pop(0) |
631 if r in missing: | 631 if r in missing: |
632 continue | 632 continue |
633 else: | 633 else: |
634 missing[r] = None | 634 missing.add(r) |
635 for p in self.parentrevs(r): | 635 for p in self.parentrevs(r): |
636 if p not in has: | 636 if p not in has: |
637 visit.append(p) | 637 visit.append(p) |
638 missing = missing.keys() | 638 missing = list(missing) |
639 missing.sort() | 639 missing.sort() |
640 return [self.node(r) for r in missing] | 640 return [self.node(r) for r in missing] |
641 | 641 |
642 def nodesbetween(self, roots=None, heads=None): | 642 def nodesbetween(self, roots=None, heads=None): |
643 """Return a tuple containing three elements. Elements 1 and 2 contain | 643 """Return a tuple containing three elements. Elements 1 and 2 contain |