[PATCH] treediscovery: fix regression when running tests against older repos

Peter Arrenbrecht peter.arrenbrecht at gmail.com
Thu May 5 01:40:44 CDT 2011


# HG changeset patch
# User Peter Arrenbrecht <peter.arrenbrecht at gmail.com>
# Date 1304577611 -7200
# Branch fix-push
# Node ID 03157a52465a8325cc4191ebdc499fbb91232946
# Parent  8968e4428dbd83836662612fc948d1b733c08354
treediscovery: fix regression when running tests against older repos

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.

diff --git a/mercurial/treediscovery.py b/mercurial/treediscovery.py
--- a/mercurial/treediscovery.py
+++ b/mercurial/treediscovery.py
@@ -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
 


More information about the Mercurial-devel mailing list