# HG changeset patch # User Pierre-Yves David # Date 2019-09-26 22:09:43 # Node ID 15badd621825e3b112b95f3bb46f8090f95adc0c # Parent 008e74b34fb728c98cecb29e337c56a58d93d533 context: clarify the various mode in the filesremoved method The previous code was compact but a bit dense. The new proposed code deal with each mode separately, there are some duplicated lines, but the meaning of each mode stand out. One of the benefit it to make it simpler to add further mode in the future. Differential Revision: https://phab.mercurial-scm.org/D6932 diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -469,11 +469,16 @@ class changectx(basectx): def filesremoved(self): source = self._repo.ui.config('experimental', 'copies.read-from') - if (source == 'changeset-only' or - (source == 'compatibility' and - self._changeset.filesremoved is not None)): - return self._changeset.filesremoved or [] - return scmutil.computechangesetfilesremoved(self) + filesremoved = self._changeset.filesremoved + if source == 'changeset-only': + if filesremoved is None: + filesremoved = [] + elif source == 'compatibility': + if filesremoved is None: + filesremoved = scmutil.computechangesetfilesremoved(self) + else: + filesremoved = scmutil.computechangesetfilesremoved(self) + return filesremoved @propertycache def _copies(self):