diff mercurial/changelog.py @ 45671:2d6aea053153

copies: add a HASCOPIESINFO flag to highlight rev with useful data If some files changes that may impact copy tracing are detected, we set this flag. This helps the copy tracing algorithm to skip fetching possibly expensive data when unnecessary. Differential Revision: https://phab.mercurial-scm.org/D9139
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 01 Oct 2020 09:29:49 +0200
parents 053c9014fd39
children f877b3628015
line wrap: on
line diff
--- a/mercurial/changelog.py	Wed Sep 16 21:00:02 2020 +0200
+++ b/mercurial/changelog.py	Thu Oct 01 09:29:49 2020 +0200
@@ -26,6 +26,7 @@
     dateutil,
     stringutil,
 )
+from .revlogutils import flagutil
 
 _defaultextra = {b'branch': b'default'}
 
@@ -579,8 +580,17 @@
                     _(b'the name \'%s\' is reserved') % branch
                 )
         sortedfiles = sorted(files.touched)
+        flags = 0
         sidedata = None
         if self._copiesstorage == b'changeset-sidedata':
+            if (
+                files.removed
+                or files.merged
+                or files.salvaged
+                or files.copied_from_p1
+                or files.copied_from_p2
+            ):
+                flags |= flagutil.REVIDX_HASCOPIESINFO
             sidedata = metadata.encode_files_sidedata(files)
 
         if extra: