D3704: py3: prevent comparison of integers with None

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Sat Jun 9 17:37:14 UTC 2018


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

REVISION SUMMARY
  On py2, we can compare integer type with NoneType but on py3 we can't.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/convert/cvsps.py

CHANGE DETAILS

diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py
--- a/hgext/convert/cvsps.py
+++ b/hgext/convert/cvsps.py
@@ -567,7 +567,10 @@
     mindate = {}
     for e in log:
         if e.commitid:
-            mindate[e.commitid] = min(e.date, mindate.get(e.commitid))
+            if mindate.get(e.commitid) is None:
+                mindate[e.commitid] = None
+            else:
+                mindate[e.commitid] = min(e.date, mindate.get(e.commitid))
 
     # Merge changesets
     log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment,



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


More information about the Mercurial-devel mailing list