Patchwork D7976: copies: avoid calculating debug-only stuff without --debug

login
register
mail settings
Submitter phabricator
Date Jan. 23, 2020, 6:44 a.m.
Message ID <differential-rev-PHID-DREV-x4yods2b7vp5fnihzyyf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44584/
State Superseded
Headers show

Comments

phabricator - Jan. 23, 2020, 6:44 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `renamedeleteset` and `divergeset` is only used with
  `repo.ui.debugflag`, so let's avoid calculating them otherwise. While
  at it, I also added a `del renamedeleteset` for consistency.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -611,13 +611,6 @@ 
                 src, dsts2, m2, m1, mb, c1, base, copy, renamedelete
             )
 
-    renamedeleteset = set()
-    divergeset = set()
-    for dsts in diverge.values():
-        divergeset.update(dsts)
-    for dsts in renamedelete.values():
-        renamedeleteset.update(dsts)
-
     # find interesting file sets from manifests
     addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
     addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
@@ -634,6 +627,13 @@ 
     fullcopy.update(copies2)
 
     if repo.ui.debugflag:
+        renamedeleteset = set()
+        divergeset = set()
+        for dsts in diverge.values():
+            divergeset.update(dsts)
+        for dsts in renamedelete.values():
+            renamedeleteset.update(dsts)
+
         repo.ui.debug(
             b"  all copies found (* = to merge, ! = divergent, "
             b"% = renamed and deleted):\n"
@@ -649,7 +649,8 @@ 
             repo.ui.debug(
                 b"   src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f, note)
             )
-    del divergeset
+        del renamedeleteset
+        del divergeset
 
     repo.ui.debug(b"  checking for directory renames\n")