discovery: do not use the implicit updating of the "base" arg
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Sat, 09 Oct 2010 17:16:39 -0500
changeset 12759 9c5794223340
parent 12758 2d754eae430c
child 12760 b41e8dfee66e
discovery: do not use the implicit updating of the "base" arg
mercurial/discovery.py
--- a/mercurial/discovery.py	Tue Oct 19 20:20:10 2010 +0900
+++ b/mercurial/discovery.py	Sat Oct 09 17:16:39 2010 -0500
@@ -183,17 +183,19 @@
     the remote repository.
     """
     if base is None:
-        base = {}
-        findincoming(repo, remote, base, remoteheads, force=force)
+        base = findcommonincoming(repo, remote, heads=remoteheads,
+                                  force=force)[0]
+    else:
+        base = list(base)
 
     repo.ui.debug("common changesets up to "
-                  + " ".join(map(short, base.keys())) + "\n")
+                  + " ".join(map(short, base)) + "\n")
 
     remain = set(repo.changelog.nodemap)
 
     # prune everything remote has from the tree
     remain.remove(nullid)
-    remove = base.keys()
+    remove = base
     while remove:
         n = remove.pop(0)
         if n in remain:
@@ -225,9 +227,9 @@
     changegroup is a readable file-like object whose read() returns
     successive changegroup chunks ready to be sent over the wire and
     remoteheads is the list of remote heads.'''
-    common = {}
     remoteheads = remote.heads()
-    inc = findincoming(repo, remote, common, remoteheads, force=force)
+    common, inc, rheads = findcommonincoming(repo, remote, heads=remoteheads,
+                                             force=force)
 
     cl = repo.changelog
     update = findoutgoing(repo, remote, common, remoteheads)
@@ -326,7 +328,7 @@
 
     if revs is None:
         # use the fast path, no race possible on push
-        nodes = repo.changelog.findmissing(common.keys())
+        nodes = repo.changelog.findmissing(common)
         cg = repo._changegroup(nodes, 'push')
     else:
         cg = repo.changegroupsubset(update, revs, 'push')