comparison mercurial/commands.py @ 3509:630e0b216192

fix graph traversal in commands.bundle (it wasn't O(n))
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Wed, 25 Oct 2006 18:22:04 +0200
parents aa8f086cb141
children 5c57a5a17963
comparison
equal deleted inserted replaced
3508:aa8f086cb141 3509:630e0b216192
837 has_set.update(repo.changelog.reachable(n)) 837 has_set.update(repo.changelog.reachable(n))
838 if revs: 838 if revs:
839 visit = list(revs) 839 visit = list(revs)
840 else: 840 else:
841 visit = repo.changelog.heads() 841 visit = repo.changelog.heads()
842 seen = sets.Set(visit)
842 while visit: 843 while visit:
843 n = visit.pop(0) 844 n = visit.pop(0)
844 parents = [p for p in repo.changelog.parents(n) 845 parents = [p for p in repo.changelog.parents(n)
845 if p != nullid and p not in has_set] 846 if p != nullid and p not in has_set]
846 if len(parents) == 0: 847 if len(parents) == 0:
847 o.insert(0, n) 848 o.insert(0, n)
848 else: 849 else:
849 visit.extend(parents) 850 for p in parents:
851 if p not in seen:
852 seen.add(p)
853 visit.append(p)
850 else: 854 else:
851 setremoteconfig(ui, opts) 855 setremoteconfig(ui, opts)
852 dest = ui.expandpath(dest or 'default-push', dest or 'default') 856 dest = ui.expandpath(dest or 'default-push', dest or 'default')
853 other = hg.repository(ui, dest) 857 other = hg.repository(ui, dest)
854 o = repo.findoutgoing(other, force=opts['force']) 858 o = repo.findoutgoing(other, force=opts['force'])