D852: py3: return False early while checking whether None is a key in lazymanifest

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Sep 30 12:50:25 UTC 2017


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In this patch we returns False early if we are trying to check whether None is a
  key in lazymanifest. The reason I added a diff is that on Python 3, it goes into
  the lazy manifest code an returns a TypeError. I checked with Durham that
  whether None can be a possible key in lazymanifest and he said "no". So it's
  safe to have this if statement.
  
  This fixes `hg merge` on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D852

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -442,6 +442,8 @@
         self._lm[key] = node, self.flags(key, '')
 
     def __contains__(self, key):
+        if key is None:
+            return False
         return key in self._lm
 
     def __delitem__(self, key):



To: pulkit, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list