comparison mercurial/commands.py @ 3634:770c4fc03b8e

bundle: don't use sets.Set
author Matt Mackall <mpm@selenic.com>
date Mon, 13 Nov 2006 13:26:57 -0600
parents 4cfb72bcb978
children b4ad640a3bcf
comparison
equal deleted inserted replaced
3633:508036290b00 3634:770c4fc03b8e
9 from node import * 9 from node import *
10 from i18n import gettext as _ 10 from i18n import gettext as _
11 demandload(globals(), "os re sys signal imp urllib pdb shlex") 11 demandload(globals(), "os re sys signal imp urllib pdb shlex")
12 demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo") 12 demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo")
13 demandload(globals(), "difflib patch tempfile time") 13 demandload(globals(), "difflib patch tempfile time")
14 demandload(globals(), "traceback errno version atexit sets bz2") 14 demandload(globals(), "traceback errno version atexit bz2")
15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver") 15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver")
16 16
17 class UnknownCommand(Exception): 17 class UnknownCommand(Exception):
18 """Exception raised if command is not in the command table.""" 18 """Exception raised if command is not in the command table."""
19 class AmbiguousCommand(Exception): 19 class AmbiguousCommand(Exception):
825 "a destination")) 825 "a destination"))
826 base = [repo.lookup(rev) for rev in base] 826 base = [repo.lookup(rev) for rev in base]
827 # create the right base 827 # create the right base
828 # XXX: nodesbetween / changegroup* should be "fixed" instead 828 # XXX: nodesbetween / changegroup* should be "fixed" instead
829 o = [] 829 o = []
830 has_set = sets.Set(base) 830 has = {nullid: None}
831 for n in base: 831 for n in base:
832 has_set.update(repo.changelog.reachable(n)) 832 has.update(repo.changelog.reachable(n))
833 if revs: 833 if revs:
834 visit = list(revs) 834 visit = list(revs)
835 else: 835 else:
836 visit = repo.changelog.heads() 836 visit = repo.changelog.heads()
837 seen = sets.Set(visit) 837 seen = {}
838 while visit: 838 while visit:
839 n = visit.pop(0) 839 n = visit.pop(0)
840 parents = [p for p in repo.changelog.parents(n) 840 parents = [p for p in repo.changelog.parents(n) if p not in has]
841 if p != nullid and p not in has_set]
842 if len(parents) == 0: 841 if len(parents) == 0:
843 o.insert(0, n) 842 o.insert(0, n)
844 else: 843 else:
845 for p in parents: 844 for p in parents:
846 if p not in seen: 845 if p not in seen:
847 seen.add(p) 846 seen[p] = 1
848 visit.append(p) 847 visit.append(p)
849 else: 848 else:
850 setremoteconfig(ui, opts) 849 setremoteconfig(ui, opts)
851 dest = ui.expandpath(dest or 'default-push', dest or 'default') 850 dest = ui.expandpath(dest or 'default-push', dest or 'default')
852 other = hg.repository(ui, dest) 851 other = hg.repository(ui, dest)