setdiscovery: return anyincoming=False when remote's only head is nullid stable
authorAndrew Pritchard <andrewp@fogcreek.com>
Wed, 27 Jul 2011 18:32:54 -0400
branchstable
changeset 14981 192e02680d09
parent 14980 28e98a8b173d
child 14984 cc2c22511707
child 14988 e6730f9e13bc
child 14996 4fdab926e111
setdiscovery: return anyincoming=False when remote's only head is nullid This fixes (issue2907) a crash when using 'hg incoming --bundle' with an empty remote repo and a non-empty local repo. This also fixes an unreported bug that 'hg summary --remote' erroneously reports incoming changes when the remote repo is empty and the local is not. Also, add a test to make sure issue2907 stays fixed
mercurial/setdiscovery.py
tests/test-incoming-outgoing.t
--- a/mercurial/setdiscovery.py	Thu Jul 28 14:36:07 2011 +0900
+++ b/mercurial/setdiscovery.py	Wed Jul 27 18:32:54 2011 -0400
@@ -190,4 +190,5 @@
             ui.warn(_("warning: repository is unrelated\n"))
         return (set([nullid]), True, srvheadhashes,)
 
-    return (dag.externalizeall(result), True, srvheadhashes,)
+    anyincoming = (srvheadhashes != [nullid])
+    return dag.externalizeall(result), anyincoming, srvheadhashes
--- a/tests/test-incoming-outgoing.t	Thu Jul 28 14:36:07 2011 +0900
+++ b/tests/test-incoming-outgoing.t	Wed Jul 27 18:32:54 2011 -0400
@@ -465,3 +465,16 @@
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     11
   
+
+incoming from empty remote repository
+
+  $ hg init r1
+  $ hg init r2
+  $ echo a > r1/foo
+  $ hg -R r1 ci -Ama
+  adding foo
+  $ hg -R r1 incoming r2 --bundle x.hg
+  comparing with r2
+  searching for changes
+  no changes found
+  [1]