Patchwork D2307: tags: don't feed both int and None to min()

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 5:36 a.m.
Message ID <differential-rev-PHID-DREV-3t5ew7d2htuw67fwajpr-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28047/
State Superseded
Headers show

Comments

phabricator - Feb. 18, 2018, 5:36 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  They're not comparable on Python 3, and we can just map None to 0.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/tags.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -739,7 +739,7 @@ 
         entry = bytearray(prefix + fnode)
         self._raw[offset:offset + _fnodesrecsize] = entry
         # self._dirtyoffset could be None.
-        self._dirtyoffset = min(self._dirtyoffset, offset) or 0
+        self._dirtyoffset = min(self._dirtyoffset or 0, offset or 0)
 
     def write(self):
         """Perform all necessary writes to cache file.