Patchwork D7037: context: make copies related function return None or a valid value

login
register
mail settings
Submitter phabricator
Date Oct. 9, 2019, 11:46 p.m.
Message ID <ef261e742b0477ff3edccb00e3c5ec88@localhost.localdomain>
Download mbox | patch
Permalink /patch/42167/
State Not Applicable
Headers show

Comments

phabricator - Oct. 9, 2019, 11:46 p.m.
Closed by commit rHG4296cc3c4ae1: changelog: make copies related function return None or a valid value (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7037?vs=17022&id=17026

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7037/new/

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

AFFECTED FILES
  mercurial/changelog.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -363,22 +363,30 @@ 
     @property
     def filesadded(self):
         rawindices = self.extra.get(b'filesadded')
-        return rawindices and decodefileindices(self.files, rawindices)
+        if rawindices is None:
+            return None
+        return decodefileindices(self.files, rawindices)
 
     @property
     def filesremoved(self):
         rawindices = self.extra.get(b'filesremoved')
-        return rawindices and decodefileindices(self.files, rawindices)
+        if rawindices is None:
+            return None
+        return decodefileindices(self.files, rawindices)
 
     @property
     def p1copies(self):
         rawcopies = self.extra.get(b'p1copies')
-        return rawcopies and decodecopies(self.files, rawcopies)
+        if rawcopies is None:
+            return None
+        return decodecopies(self.files, rawcopies)
 
     @property
     def p2copies(self):
         rawcopies = self.extra.get(b'p2copies')
-        return rawcopies and decodecopies(self.files, rawcopies)
+        if rawcopies is None:
+            return None
+        return decodecopies(self.files, rawcopies)
 
     @property
     def description(self):