##// END OF EJS Templates
discovery: stop using nodemap for membership testing...
Pierre-Yves David -
r20225:d2704c48 default
parent child Browse files
Show More
@@ -34,9 +34,9 b' def findcommonincoming(repo, remote, hea'
34
34
35 if heads:
35 if heads:
36 allknown = True
36 allknown = True
37 nm = repo.changelog.nodemap
37 knownnode = repo.changelog.hasnode # no nodemap until it is filtered
38 for h in heads:
38 for h in heads:
39 if nm.get(h) is None:
39 if not knownnode(h):
40 allknown = False
40 allknown = False
41 break
41 break
42 if allknown:
42 if allknown:
@@ -172,8 +172,9 b' def _headssummary(repo, remote, outgoing'
172 remotebranches.add(branch)
172 remotebranches.add(branch)
173 known = []
173 known = []
174 unsynced = []
174 unsynced = []
175 knownnode = cl.hasnode # do not use nodemap until it is filtered
175 for h in heads:
176 for h in heads:
176 if h in cl.nodemap:
177 if knownnode(h):
177 known.append(h)
178 known.append(h)
178 else:
179 else:
179 unsynced.append(h)
180 unsynced.append(h)
@@ -204,11 +205,11 b' def _headssummary(repo, remote, outgoing'
204 def _oldheadssummary(repo, remoteheads, outgoing, inc=False):
205 def _oldheadssummary(repo, remoteheads, outgoing, inc=False):
205 """Compute branchmapsummary for repo without branchmap support"""
206 """Compute branchmapsummary for repo without branchmap support"""
206
207
207 cl = repo.changelog
208 # 1-4b. old servers: Check for new topological heads.
208 # 1-4b. old servers: Check for new topological heads.
209 # Construct {old,new}map with branch = None (topological branch).
209 # Construct {old,new}map with branch = None (topological branch).
210 # (code based on update)
210 # (code based on update)
211 oldheads = set(h for h in remoteheads if h in cl.nodemap)
211 knownnode = repo.changelog.hasnode # no nodemap until it is filtered
212 oldheads = set(h for h in remoteheads if knownnode(h))
212 # all nodes in outgoing.missing are children of either:
213 # all nodes in outgoing.missing are children of either:
213 # - an element of oldheads
214 # - an element of oldheads
214 # - another element of outgoing.missing
215 # - another element of outgoing.missing
@@ -19,7 +19,7 b' def findcommonincoming(repo, remote, hea'
19 "heads" is either the supplied heads, or else the remote's heads.
19 "heads" is either the supplied heads, or else the remote's heads.
20 """
20 """
21
21
22 m = repo.changelog.nodemap
22 knownnode = repo.changelog.hasnode
23 search = []
23 search = []
24 fetch = set()
24 fetch = set()
25 seen = set()
25 seen = set()
@@ -41,7 +41,7 b' def findcommonincoming(repo, remote, hea'
41
41
42 unknown = []
42 unknown = []
43 for h in heads:
43 for h in heads:
44 if h not in m:
44 if not knownnode(h):
45 unknown.append(h)
45 unknown.append(h)
46 else:
46 else:
47 base.add(h)
47 base.add(h)
@@ -71,23 +71,23 b' def findcommonincoming(repo, remote, hea'
71 elif n in seenbranch:
71 elif n in seenbranch:
72 repo.ui.debug("branch already found\n")
72 repo.ui.debug("branch already found\n")
73 continue
73 continue
74 elif n[1] and n[1] in m: # do we know the base?
74 elif n[1] and knownnode(n[1]): # do we know the base?
75 repo.ui.debug("found incomplete branch %s:%s\n"
75 repo.ui.debug("found incomplete branch %s:%s\n"
76 % (short(n[0]), short(n[1])))
76 % (short(n[0]), short(n[1])))
77 search.append(n[0:2]) # schedule branch range for scanning
77 search.append(n[0:2]) # schedule branch range for scanning
78 seenbranch.add(n)
78 seenbranch.add(n)
79 else:
79 else:
80 if n[1] not in seen and n[1] not in fetch:
80 if n[1] not in seen and n[1] not in fetch:
81 if n[2] in m and n[3] in m:
81 if knownnode(n[2]) and knownnode(n[3]):
82 repo.ui.debug("found new changeset %s\n" %
82 repo.ui.debug("found new changeset %s\n" %
83 short(n[1]))
83 short(n[1]))
84 fetch.add(n[1]) # earliest unknown
84 fetch.add(n[1]) # earliest unknown
85 for p in n[2:4]:
85 for p in n[2:4]:
86 if p in m:
86 if knownnode(p):
87 base.add(p) # latest known
87 base.add(p) # latest known
88
88
89 for p in n[2:4]:
89 for p in n[2:4]:
90 if p not in req and p not in m:
90 if p not in req and not knownnode(p):
91 r.append(p)
91 r.append(p)
92 req.add(p)
92 req.add(p)
93 seen.add(n[0])
93 seen.add(n[0])
@@ -114,7 +114,7 b' def findcommonincoming(repo, remote, hea'
114 f = 1
114 f = 1
115 for i in l:
115 for i in l:
116 repo.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
116 repo.ui.debug("narrowing %d:%d %s\n" % (f, len(l), short(i)))
117 if i in m:
117 if knownnode(i):
118 if f <= 2:
118 if f <= 2:
119 repo.ui.debug("found new branch changeset %s\n" %
119 repo.ui.debug("found new branch changeset %s\n" %
120 short(p))
120 short(p))
@@ -130,7 +130,7 b' def findcommonincoming(repo, remote, hea'
130
130
131 # sanity check our fetch list
131 # sanity check our fetch list
132 for f in fetch:
132 for f in fetch:
133 if f in m:
133 if knownnode(f):
134 raise error.RepoError(_("already have changeset ")
134 raise error.RepoError(_("already have changeset ")
135 + short(f[:4]))
135 + short(f[:4]))
136
136
General Comments 0
You need to be logged in to leave comments. Login now