D6953: sidedatacopies: read rename information from sidedata

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Wed Oct 9 14:40:04 EDT 2019


marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in changelog.py:369-371
> I thought the reason you explicitly did `if rawindices is not None` was in order to not run the next statement if `rawindices` was an empty list. But that should have no effect anyway, so I was clearly wrong about that. So why did you make the `is not None` explicit? Can you just revert it if there was no good reason for it?

I am confused, the function should return a list or None. Since rawindides are bytes, they are not eligible for returns.
I updated the code as follow:

  --- a/mercurial/changelog.py
  +++ b/mercurial/changelog.py
  @@ -366,9 +366,9 @@ class changelogrevision(object):
               rawindices = self._sidedata.get(sidedatamod.SD_FILESADDED)
           else:
               rawindices = self.extra.get(b'filesadded')
  -        if rawindices is not None:
  -            rawindices = decodefileindices(self.files, rawindices)
  -        return rawindices
  +        if rawindices is None:
  +            return None
  +        return decodefileindices(self.files, rawindices)
   
       @property
       def filesremoved(self):

REPOSITORY
  rHG Mercurial

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

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

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


More information about the Mercurial-devel mailing list