##// END OF EJS Templates
upgrade: allow sidedata upgrade to modify revision flag...
marmoute -
r46327:edf4fa06 default
parent child Browse files
Show More
@@ -893,8 +893,11 b' def _get_worker_sidedata_adder(srcrepo, '
893 893 staging[r] = data
894 894 r, sidedata = sidedataq.get()
895 895 tokens.release()
896 sidedataq, has_copies_info = data
897 return False, (), sidedata
896 sidedata, has_copies_info = data
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 902 return sidedata_companion
900 903
@@ -905,10 +908,14 b' def _get_simple_sidedata_adder(srcrepo, '
905 908 It just compute it in the same thread on request"""
906 909
907 910 def sidedatacompanion(revlog, rev):
908 sidedata = {}
911 sidedata, has_copies_info = {}, False
909 912 if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog
910 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 920 return sidedatacompanion
914 921
@@ -924,6 +931,6 b' def getsidedataremover(srcrepo, destrepo'
924 931 sidedatamod.SD_FILESADDED,
925 932 sidedatamod.SD_FILESREMOVED,
926 933 )
927 return False, f, {}
934 return False, f, {}, 0, sidedataflag.REVIDX_HASCOPIESINFO
928 935
929 936 return sidedatacompanion
@@ -2705,14 +2705,16 b' class revlog(object):'
2705 2705
2706 2706 (srcrevlog, rev)
2707 2707
2708 and return a triplet that control changes to sidedata content from the
2708 and return a quintet that control changes to sidedata content from the
2709 2709 old revision to the new clone result:
2710 2710
2711 (dropall, filterout, update)
2711 (dropall, filterout, update, new_flags, dropped_flags)
2712 2712
2713 2713 * if `dropall` is True, all sidedata should be dropped
2714 2714 * `filterout` is a set of sidedata keys that should be dropped
2715 2715 * `update` is a mapping of additionnal/new key -> value
2716 * new_flags is a bitfields of new flags that the revision should get
2717 * dropped_flags is a bitfields of new flags that the revision shoudl not longer have
2716 2718 """
2717 2719 if deltareuse not in self.DELTAREUSEALL:
2718 2720 raise ValueError(
@@ -2783,7 +2785,7 b' class revlog(object):'
2783 2785 p2 = index[entry[6]][7]
2784 2786 node = entry[7]
2785 2787
2786 sidedataactions = (False, [], {})
2788 sidedataactions = (False, [], {}, 0, 0)
2787 2789 if sidedatacompanion is not None:
2788 2790 sidedataactions = sidedatacompanion(self, rev)
2789 2791
@@ -2792,7 +2794,11 b' class revlog(object):'
2792 2794 cachedelta = None
2793 2795 rawtext = None
2794 2796 if any(sidedataactions) or deltareuse == self.DELTAREUSEFULLADD:
2795 dropall, filterout, update = sidedataactions
2797 dropall = sidedataactions[0]
2798 filterout = sidedataactions[1]
2799 update = sidedataactions[2]
2800 new_flags = sidedataactions[3]
2801 dropped_flags = sidedataactions[4]
2796 2802 text, sidedata = self._revisiondata(rev)
2797 2803 if dropall:
2798 2804 sidedata = {}
@@ -2801,6 +2807,10 b' class revlog(object):'
2801 2807 sidedata.update(update)
2802 2808 if not sidedata:
2803 2809 sidedata = None
2810
2811 flags |= new_flags
2812 flags &= ~dropped_flags
2813
2804 2814 destrevlog.addrevision(
2805 2815 text,
2806 2816 tr,
@@ -732,8 +732,8 b' def getsidedatacompanion(srcrepo, dstrep'
732 732 def sidedatacompanion(rl, rev):
733 733 rl = getattr(rl, '_revlog', rl)
734 734 if rl.flags(rev) & revlog.REVIDX_SIDEDATA:
735 return True, (), {}
736 return False, (), {}
735 return True, (), {}, 0, 0
736 return False, (), {}, 0, 0
737 737
738 738 elif requirements.COPIESSDC_REQUIREMENT in addedreqs:
739 739 sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo)
@@ -1,4 +1,4 b''
1 #testcases filelog compatibility changeset sidedata
1 #testcases filelog compatibility changeset sidedata upgraded
2 2
3 3 =====================================================
4 4 Test Copy tracing for chain of copies involving merge
@@ -594,7 +594,7 b' We upgrade a repository that is not usin'
594 594 commit time.
595 595
596 596
597 #if filelog
597 #if upgraded
598 598 $ cat >> $HGRCPATH << EOF
599 599 > [format]
600 600 > exp-use-side-data = yes
@@ -622,7 +622,7 b' We upgrade a repository that is not usin'
622 622 #endif
623 623
624 624
625 #if no-compatibility no-changeset
625 #if no-compatibility no-filelog no-changeset
626 626
627 627 $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do
628 628 > echo "##### revision $rev #####"
@@ -804,35 +804,6 b' We upgrade a repository that is not usin'
804 804
805 805 #endif
806 806
807 Downgrade to keep testing the filelog algorithm
808 (This can be removed once we have an explicite "upgrade" tests case_
809
810 #if filelog
811 $ cat >> $HGRCPATH << EOF
812 > [format]
813 > exp-use-side-data = no
814 > exp-use-copies-side-data-changeset = no
815 > EOF
816 $ hg debugformat -v
817 format-variant repo config default
818 fncache: yes yes yes
819 dotencode: yes yes yes
820 generaldelta: yes yes yes
821 sparserevlog: yes yes yes
822 sidedata: yes no no
823 persistent-nodemap: no no no
824 copies-sdc: yes no no
825 plain-cl-delta: yes yes yes
826 compression: * (glob)
827 compression-level: default default default
828 $ hg debugupgraderepo --run --quiet
829 upgrade will perform the following actions:
830
831 requirements
832 preserved: * (glob)
833 removed: exp-copies-sidedata-changeset, exp-sidedata-flag
834
835 #endif
836 807
837 808 Test copy information chaining
838 809 ==============================
@@ -70,7 +70,7 b' def wrapgetsidedatacompanion(orig, srcre'
70 70 # and sha2 hashes
71 71 sha256 = hashlib.sha256(text).digest()
72 72 update[sidedata.SD_TEST2] = struct.pack('>32s', sha256)
73 return False, (), update
73 return False, (), update, 0, 0
74 74
75 75 return sidedatacompanion
76 76
General Comments 0
You need to be logged in to leave comments. Login now