D6952: sidedatacopies: preindent some copies related code

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Oct 3 01:56:11 EDT 2019


marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This make the next changeset clearer.

REPOSITORY
  rHG Mercurial

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

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
@@ -455,55 +455,58 @@
         return sorted(modified)
 
     def filesadded(self):
-        source = self._repo.ui.config('experimental', 'copies.read-from')
         filesadded = self._changeset.filesadded
-        if source == 'changeset-only':
-            if filesadded is None:
-                filesadded = []
-        elif source == 'compatibility':
-            if filesadded is None:
+        if True:
+            source = self._repo.ui.config('experimental', 'copies.read-from')
+            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)
-        else:
-            filesadded = scmutil.computechangesetfilesadded(self)
         return filesadded
 
     def filesremoved(self):
-        source = self._repo.ui.config('experimental', 'copies.read-from')
         filesremoved = self._changeset.filesremoved
-        if source == 'changeset-only':
-            if filesremoved is None:
-                filesremoved = []
-        elif source == 'compatibility':
-            if filesremoved is None:
+        if True:
+            source = self._repo.ui.config('experimental', 'copies.read-from')
+            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)
-        else:
-            filesremoved = scmutil.computechangesetfilesremoved(self)
         return filesremoved
 
     @propertycache
     def _copies(self):
-        source = self._repo.ui.config('experimental', 'copies.read-from')
         p1copies = self._changeset.p1copies
         p2copies = self._changeset.p2copies
-        # If config says to get copy metadata only from changeset, then return
-        # that, defaulting to {} if there was no copy metadata.
-        # In compatibility mode, we return copy data from the changeset if
-        # it was recorded there, and otherwise we fall back to getting it from
-        # the filelogs (below).
-        if source == 'changeset-only':
-            if p1copies is None:
-                p1copies = {}
-            if p2copies is None:
-                p2copies = {}
-        elif source == 'compatibility':
-            if p1copies is None:
-                # we are in compatiblity mode and there is not data in the
-                # changeset), we get the copy metadata from the filelogs.
+        if True:
+            source = self._repo.ui.config('experimental', 'copies.read-from')
+            # If config says to get copy metadata only from changeset, then
+            # return that, defaulting to {} if there was no copy metadata.  In
+            # compatibility mode, we return copy data from the changeset if it
+            # was recorded there, and otherwise we fall back to getting it from
+            # the filelogs (below).
+            if source == 'changeset-only':
+                if p1copies is None:
+                    p1copies = {}
+                if p2copies is None:
+                    p2copies = {}
+            elif source == 'compatibility':
+                if p1copies is None:
+                    # we are in compatiblity mode and there is not data in the
+                    # changeset), we get the copy metadata from the filelogs.
+                    p1copies, p2copies = super(changectx, self)._copies
+            else:
+                # config said to read only from filelog, we get the copy
+                # metadata from the filelogs.
                 p1copies, p2copies = super(changectx, self)._copies
-        else:
-            # config said to read only from filelog, we get the copy metadata
-            # from the filelogs.
-            p1copies, p2copies = super(changectx, self)._copies
         return p1copies, p2copies
 
     def description(self):



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


More information about the Mercurial-devel mailing list