Skip to content
Snippets Groups Projects
Commit c32286d0 authored by mpm's avatar mpm
Browse files

Improve pruning of branches in outstanding changeset algorithm

These changes make the client keep track of what it's seen more
carefully to avoid some redundant requests.
parent b6d8ed7a
No related branches found
No related tags found
No related merge requests found
......@@ -509,6 +509,8 @@
unknown = [tip]
search = []
fetch = []
seen = {}
seenbranch = {}
if tip[0] in m:
self.ui.note("nothing to do!\n")
......@@ -516,4 +518,7 @@
while unknown:
n = unknown.pop(0)
seen[n[0]] = 1
self.ui.debug("examining %s:%s\n" % (short(n[0]), short(n[1])))
if n == nullid: break
......@@ -519,2 +524,5 @@
if n == nullid: break
if n in seenbranch:
self.ui.debug("branch already found\n")
continue
if n[1] and n[1] in m: # do we know the base?
......@@ -520,3 +528,4 @@
if n[1] and n[1] in m: # do we know the base?
self.ui.debug("found incomplete branch %s\n" % short(n[1]))
self.ui.debug("found incomplete branch %s:%s\n"
% (short(n[0]), short(n[1])))
search.append(n) # schedule branch range for scanning
......@@ -522,4 +531,5 @@
search.append(n) # schedule branch range for scanning
seenbranch[n] = 1
else:
if n[2] in m and n[3] in m:
if n[1] not in fetch:
......@@ -527,9 +537,19 @@
short(n[1]))
fetch.append(n[1]) # earliest unknown
continue
for b in remote.branches([n[2], n[3]]):
if b[0] not in m:
unknown.append(b)
r = []
for a in n[2:4]:
if a not in seen: r.append(a)
if r:
self.ui.debug("requesting %s\n" %
" ".join(map(short, r)))
for b in remote.branches(r):
self.ui.debug("received %s:%s\n" %
(short(b[0]), short(b[1])))
if b[0] not in m and b[0] not in seen:
unknown.append(b)
while search:
n = search.pop(0)
......@@ -783,7 +803,7 @@
def branches(self, nodes):
n = " ".join(map(hex, nodes))
d = self.do_cmd("branches", nodes=n).read()
br = [ map(bin, b.split(" ")) for b in d.splitlines() ]
br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ]
return br
def between(self, pairs):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment