Patchwork D6952: sidedatacopies: preindent some copies related code

login
register
mail settings
Submitter phabricator
Date Oct. 3, 2019, 5:56 a.m.
Message ID <differential-rev-PHID-DREV-zder47npvmpsy3fqyrq3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41937/
State Superseded
Headers show

Comments

phabricator - Oct. 3, 2019, 5:56 a.m.
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




To: marmoute, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 9, 2019, 5:21 p.m.
martinvonz added a comment.


  I personally don't think this type of patch is needed -- Phabricator makes it very readable anyway (and there is `hg diff --ignore-space-change` for others). I'm sure some people disagree with me.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - Oct. 9, 2019, 5:25 p.m.
marmoute added a comment.


  In D6952#103223 <https://phab.mercurial-scm.org/D6952#103223>, @martinvonz wrote:
  
  > I personally don't think this type of patch is needed -- Phabricator makes it very readable anyway (and there is `hg diff --ignore-space-change` for others). I'm sure some people disagree with me.
  
  I find it useful in my workflow, so I would rather keep it if you don't mind.

REPOSITORY
  rHG Mercurial

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

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

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

Patch

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):