copies: avoid calculating debug-only stuff without --debug
authorMartin von Zweigbergk <martinvonz@google.com>
Wed, 22 Jan 2020 15:23:30 -0800
changeset 44163 782e0d9c3b74
parent 44162 baf3fe2977cc
child 44164 45192589555c
copies: avoid calculating debug-only stuff without --debug `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. Differential Revision: https://phab.mercurial-scm.org/D7976
mercurial/copies.py
--- a/mercurial/copies.py	Wed Jan 22 15:20:12 2020 -0800
+++ b/mercurial/copies.py	Wed Jan 22 15:23:30 2020 -0800
@@ -614,13 +614,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())
@@ -637,6 +630,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"
@@ -652,7 +652,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")