comparison mercurial/metadata.py @ 45735:edf4fa06df94

upgrade: allow sidedata upgrade to modify revision flag In the process, we fix the lack of HAS_COPIES_INFO flag on upgrade, and test the results. Differential Revision: https://phab.mercurial-scm.org/D9199
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 13 Oct 2020 05:14:37 +0200
parents 53c265a6fc83
children 18c17d63fdab
comparison
equal deleted inserted replaced
45734:53c265a6fc83 45735:edf4fa06df94
891 r, data = sidedataq.get() 891 r, data = sidedataq.get()
892 while r != rev: 892 while r != rev:
893 staging[r] = data 893 staging[r] = data
894 r, sidedata = sidedataq.get() 894 r, sidedata = sidedataq.get()
895 tokens.release() 895 tokens.release()
896 sidedataq, has_copies_info = data 896 sidedata, has_copies_info = data
897 return False, (), sidedata 897 new_flag = 0
898 if has_copies_info:
899 new_flag = sidedataflag.REVIDX_HASCOPIESINFO
900 return False, (), sidedata, new_flag, 0
898 901
899 return sidedata_companion 902 return sidedata_companion
900 903
901 904
902 def _get_simple_sidedata_adder(srcrepo, destrepo): 905 def _get_simple_sidedata_adder(srcrepo, destrepo):
903 """The simple version of the sidedata computation 906 """The simple version of the sidedata computation
904 907
905 It just compute it in the same thread on request""" 908 It just compute it in the same thread on request"""
906 909
907 def sidedatacompanion(revlog, rev): 910 def sidedatacompanion(revlog, rev):
908 sidedata = {} 911 sidedata, has_copies_info = {}, False
909 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog 912 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog
910 sidedata, has_copies_info = _getsidedata(srcrepo, rev) 913 sidedata, has_copies_info = _getsidedata(srcrepo, rev)
911 return False, (), sidedata 914 new_flag = 0
915 if has_copies_info:
916 new_flag = sidedataflag.REVIDX_HASCOPIESINFO
917
918 return False, (), sidedata, new_flag, 0
912 919
913 return sidedatacompanion 920 return sidedatacompanion
914 921
915 922
916 def getsidedataremover(srcrepo, destrepo): 923 def getsidedataremover(srcrepo, destrepo):
922 sidedatamod.SD_P1COPIES, 929 sidedatamod.SD_P1COPIES,
923 sidedatamod.SD_P2COPIES, 930 sidedatamod.SD_P2COPIES,
924 sidedatamod.SD_FILESADDED, 931 sidedatamod.SD_FILESADDED,
925 sidedatamod.SD_FILESREMOVED, 932 sidedatamod.SD_FILESREMOVED,
926 ) 933 )
927 return False, f, {} 934 return False, f, {}, 0, sidedataflag.REVIDX_HASCOPIESINFO
928 935
929 return sidedatacompanion 936 return sidedatacompanion