D6931: context: clarify the various mode in the filesadded method

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Tue Oct 1 13:07:44 EDT 2019


Closed by commit rHG008e74b34fb7: context: clarify the various mode in the filesadded method (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6931?vs=16728&id=16751

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

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -453,13 +453,20 @@
         modified.difference_update(self.filesadded())
         modified.difference_update(self.filesremoved())
         return sorted(modified)
+
     def filesadded(self):
         source = self._repo.ui.config('experimental', 'copies.read-from')
-        if (source == 'changeset-only' or
-            (source == 'compatibility' and
-             self._changeset.filesadded is not None)):
-            return self._changeset.filesadded or []
-        return scmutil.computechangesetfilesadded(self)
+        filesadded = self._changeset.filesadded
+        if source == 'changeset-only':
+            if filesadded is None:
+                filesadded = []
+        elif source == 'compatibility':
+            if filesadded is None:
+                filesadded = scmutil.computechangesetfilesadded(self)
+        else:
+            filesadded = scmutil.computechangesetfilesadded(self)
+        return filesadded
+
     def filesremoved(self):
         source = self._repo.ui.config('experimental', 'copies.read-from')
         if (source == 'changeset-only' or



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


More information about the Mercurial-devel mailing list