changeset 29901:4d1e6f91f1c7

discovery: explicitly check for None in outgoing init f09d0004481c introduced default params for discovery.outgoing(), but it used a falsy check instead of an explicit check for None. The result is that callers that passed in an empty list would have that list overridden by the defaults, which is not the expected behavior. This was discovered by changes to the test-pushrebase.t test in Facebook's repository of mercurial extensions.
author Ryan McElroy <rmcelroy@fb.com>
date Tue, 06 Sep 2016 09:43:25 -0700
parents 50f2966f86ca
children a77d48219edd
files mercurial/commands.py mercurial/discovery.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Fri Aug 26 12:48:20 2016 +0200
+++ b/mercurial/commands.py	Tue Sep 06 09:43:25 2016 -0700
@@ -1411,7 +1411,7 @@
             raise error.Abort(_("--base is incompatible with specifying "
                                "a destination"))
         common = [repo.lookup(rev) for rev in base]
-        heads = revs and map(repo.lookup, revs) or revs
+        heads = revs and map(repo.lookup, revs) or None
         outgoing = discovery.outgoing(repo, common, heads)
         cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
                                         bundlecaps=bundlecaps,
--- a/mercurial/discovery.py	Fri Aug 26 12:48:20 2016 +0200
+++ b/mercurial/discovery.py	Tue Sep 06 09:43:25 2016 -0700
@@ -81,7 +81,7 @@
         # at least one of them must not be set
         assert None in (commonheads, missingroots)
         cl = repo.changelog
-        if not missingheads:
+        if missingheads is None:
             missingheads = cl.heads()
         if missingroots:
             discbases = []