D6953: sidedatacopies: read rename information from sidedata

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


marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in context.py:536-550
> Is there a way of writing `self._repo.filecopiesmode != b'changeset-sidedata'` in positive way? Maybe  `self._repo.filecopiesmode is None`? The `source != b'changeset-only'` is because we want any invalid/unexpected config to be treated as "filelog-only".
> 
> I won't insist on changing.

What about something like this: We "duplicate" the intend code, and factor the actual "computation" out.

  def filesadded(self):
      filesadded = self._changeset.filesadded
      compute_on_none = True
      if self._repo.filecopiesmode == b'changeset-sidedata':
          compute_on_none = False
      else:
          source = self._repo.ui.config(b'experimental', b'copies.read-from')
          if source == b'changeset-only':
              compute_on_none = False
          elif source != b'compatibility':
              # filelog mode, ignore any changelog content
              filesadded = None
      if filesadded is None:
          if compute_on_none:
              filesadded = scmutil.computechangesetfilesadded(self)
          else:
              filesadded = []
      return filesadded

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