diff mercurial/metadata.py @ 47078:223b47235d1c

sidedata: enable sidedata computers to optionally rewrite flags Sidedata computers may want to influence the flags of the revision they touch. For example, the computer for changelog-based copytracing can add a flag to signify that this revision might affect copytracing, inversely removing said flag if the information is no longer applicable. See inline documentation in `storageutil` for more details. Differential Revision: https://phab.mercurial-scm.org/D10344
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 08 Apr 2021 16:55:17 +0200
parents b409cdc6a139
children 27f1191b1305
line wrap: on
line diff
--- a/mercurial/metadata.py	Sat Apr 10 11:27:40 2021 +0200
+++ b/mercurial/metadata.py	Thu Apr 08 16:55:17 2021 +0200
@@ -820,7 +820,9 @@
 
 
 def copies_sidedata_computer(repo, revlog, rev, existing_sidedata):
-    return _getsidedata(repo, rev)[0]
+    sidedata, has_copies_info = _getsidedata(repo, rev)
+    flags_to_add = sidedataflag.REVIDX_HASCOPIESINFO if has_copies_info else 0
+    return sidedata, (flags_to_add, 0)
 
 
 def set_sidedata_spec_for_repo(repo):
@@ -831,6 +833,7 @@
         sidedatamod.SD_FILES,
         (sidedatamod.SD_FILES,),
         copies_sidedata_computer,
+        sidedataflag.REVIDX_HASCOPIESINFO,
     )