changeset 43022:15badd621825

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
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 27 Sep 2019 00:09:43 +0200
parents 008e74b34fb7
children 8af909893188
files mercurial/context.py
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Fri Sep 27 00:06:02 2019 +0200
+++ b/mercurial/context.py	Fri Sep 27 00:09:43 2019 +0200
@@ -469,11 +469,16 @@
 
     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):