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

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Oct 9 19:46:59 EDT 2019


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

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):



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


More information about the Mercurial-devel mailing list