##// END OF EJS Templates
discovery: use set instead of dict
Benoit Boissinot -
r12761:11c3c77d default
parent child Browse files
Show More
@@ -34,13 +34,13 b' def findcommonincoming(repo, remote, hea'
34 fetch = set()
34 fetch = set()
35 seen = set()
35 seen = set()
36 seenbranch = set()
36 seenbranch = set()
37 base = {}
37 base = set()
38
38
39 if not heads:
39 if not heads:
40 heads = remote.heads()
40 heads = remote.heads()
41
41
42 if repo.changelog.tip() == nullid:
42 if repo.changelog.tip() == nullid:
43 base[nullid] = 1
43 base.add(nullid)
44 if heads != [nullid]:
44 if heads != [nullid]:
45 return [nullid], [nullid], list(heads)
45 return [nullid], [nullid], list(heads)
46 return [nullid], [], []
46 return [nullid], [], []
@@ -54,11 +54,11 b' def findcommonincoming(repo, remote, hea'
54 if h not in m:
54 if h not in m:
55 unknown.append(h)
55 unknown.append(h)
56 else:
56 else:
57 base[h] = 1
57 base.add(h)
58
58
59 heads = unknown
59 heads = unknown
60 if not unknown:
60 if not unknown:
61 return base.keys(), [], []
61 return list(base), [], []
62
62
63 req = set(unknown)
63 req = set(unknown)
64 reqcnt = 0
64 reqcnt = 0
@@ -95,7 +95,7 b' def findcommonincoming(repo, remote, hea'
95 fetch.add(n[1]) # earliest unknown
95 fetch.add(n[1]) # earliest unknown
96 for p in n[2:4]:
96 for p in n[2:4]:
97 if p in m:
97 if p in m:
98 base[p] = 1 # latest known
98 base.add(p) # latest known
99
99
100 for p in n[2:4]:
100 for p in n[2:4]:
101 if p not in req and p not in m:
101 if p not in req and p not in m:
@@ -130,7 +130,7 b' def findcommonincoming(repo, remote, hea'
130 repo.ui.debug("found new branch changeset %s\n" %
130 repo.ui.debug("found new branch changeset %s\n" %
131 short(p))
131 short(p))
132 fetch.add(p)
132 fetch.add(p)
133 base[i] = 1
133 base.add(i)
134 else:
134 else:
135 repo.ui.debug("narrowed branch search to %s:%s\n"
135 repo.ui.debug("narrowed branch search to %s:%s\n"
136 % (short(p), short(i)))
136 % (short(p), short(i)))
@@ -145,7 +145,8 b' def findcommonincoming(repo, remote, hea'
145 raise error.RepoError(_("already have changeset ")
145 raise error.RepoError(_("already have changeset ")
146 + short(f[:4]))
146 + short(f[:4]))
147
147
148 if base.keys() == [nullid]:
148 base = list(base)
149 if base == [nullid]:
149 if force:
150 if force:
150 repo.ui.warn(_("warning: repository is unrelated\n"))
151 repo.ui.warn(_("warning: repository is unrelated\n"))
151 else:
152 else:
@@ -157,7 +158,7 b' def findcommonincoming(repo, remote, hea'
157 repo.ui.progress(_('searching'), None)
158 repo.ui.progress(_('searching'), None)
158 repo.ui.debug("%d total queries\n" % reqcnt)
159 repo.ui.debug("%d total queries\n" % reqcnt)
159
160
160 return base.keys(), list(fetch), heads
161 return base, list(fetch), heads
161
162
162 def findoutgoing(repo, remote, base=None, remoteheads=None, force=False):
163 def findoutgoing(repo, remote, base=None, remoteheads=None, force=False):
163 """Return list of nodes that are roots of subsets not in remote
164 """Return list of nodes that are roots of subsets not in remote
General Comments 0
You need to be logged in to leave comments. Login now