diff mercurial/treediscovery.py @ 14199:e3dd3dcd6059

treediscovery: fix regression when run against older repos (issue2793) I ran the entire test suite with "known" and "getbundle" disabled in localrepository. This generated failures because the old findoutgoing had always queried remote's heads explicitly and thus always got them back in the returned heads. treediscovery.findcommonincoming now correctly returns remote's heads in all cases. Also adds a dedicated test for running treediscovery against a pre-getbundle HTTP server.
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Thu, 05 May 2011 12:53:33 +0200
parents cb98fed52495
children df902fe3d79e
line wrap: on
line diff
--- a/mercurial/treediscovery.py	Thu May 05 14:57:21 2011 +0200
+++ b/mercurial/treediscovery.py	Thu May 05 12:53:33 2011 +0200
@@ -33,7 +33,7 @@
         base.add(nullid)
         if heads != [nullid]:
             return [nullid], [nullid], list(heads)
-        return [nullid], [], []
+        return [nullid], [], heads
 
     # assume we're closer to the tip than the root
     # and start by examining the heads
@@ -46,10 +46,10 @@
         else:
             base.add(h)
 
+    if not unknown:
+        return list(base), [], list(heads)
+
     heads = unknown
-    if not unknown:
-        return list(base), [], []
-
     req = set(unknown)
     reqcnt = 0