diff --git a/mercurial/metadata.py b/mercurial/metadata.py --- a/mercurial/metadata.py +++ b/mercurial/metadata.py @@ -893,8 +893,11 @@ staging[r] = data r, sidedata = sidedataq.get() tokens.release() - sidedataq, has_copies_info = data - return False, (), sidedata + sidedata, has_copies_info = data + new_flag = 0 + if has_copies_info: + new_flag = sidedataflag.REVIDX_HASCOPIESINFO + return False, (), sidedata, new_flag, 0 return sidedata_companion @@ -905,10 +908,14 @@ It just compute it in the same thread on request""" def sidedatacompanion(revlog, rev): - sidedata = {} + sidedata, has_copies_info = {}, False if util.safehasattr(revlog, 'filteredrevs'): # this is a changelog sidedata, has_copies_info = _getsidedata(srcrepo, rev) - return False, (), sidedata + new_flag = 0 + if has_copies_info: + new_flag = sidedataflag.REVIDX_HASCOPIESINFO + + return False, (), sidedata, new_flag, 0 return sidedatacompanion @@ -924,6 +931,6 @@ sidedatamod.SD_FILESADDED, sidedatamod.SD_FILESREMOVED, ) - return False, f, {} + return False, f, {}, 0, sidedataflag.REVIDX_HASCOPIESINFO return sidedatacompanion diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2705,14 +2705,16 @@ (srcrevlog, rev) - and return a triplet that control changes to sidedata content from the + and return a quintet that control changes to sidedata content from the old revision to the new clone result: - (dropall, filterout, update) + (dropall, filterout, update, new_flags, dropped_flags) * if `dropall` is True, all sidedata should be dropped * `filterout` is a set of sidedata keys that should be dropped * `update` is a mapping of additionnal/new key -> value + * new_flags is a bitfields of new flags that the revision should get + * dropped_flags is a bitfields of new flags that the revision shoudl not longer have """ if deltareuse not in self.DELTAREUSEALL: raise ValueError( @@ -2783,7 +2785,7 @@ p2 = index[entry[6]][7] node = entry[7] - sidedataactions = (False, [], {}) + sidedataactions = (False, [], {}, 0, 0) if sidedatacompanion is not None: sidedataactions = sidedatacompanion(self, rev) @@ -2792,7 +2794,11 @@ cachedelta = None rawtext = None if any(sidedataactions) or deltareuse == self.DELTAREUSEFULLADD: - dropall, filterout, update = sidedataactions + dropall = sidedataactions[0] + filterout = sidedataactions[1] + update = sidedataactions[2] + new_flags = sidedataactions[3] + dropped_flags = sidedataactions[4] text, sidedata = self._revisiondata(rev) if dropall: sidedata = {} @@ -2801,6 +2807,10 @@ sidedata.update(update) if not sidedata: sidedata = None + + flags |= new_flags + flags &= ~dropped_flags + destrevlog.addrevision( text, tr, diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py --- a/mercurial/upgrade.py +++ b/mercurial/upgrade.py @@ -732,8 +732,8 @@ def sidedatacompanion(rl, rev): rl = getattr(rl, '_revlog', rl) if rl.flags(rev) & revlog.REVIDX_SIDEDATA: - return True, (), {} - return False, (), {} + return True, (), {}, 0, 0 + return False, (), {}, 0, 0 elif requirements.COPIESSDC_REQUIREMENT in addedreqs: sidedatacompanion = metadata.getsidedataadder(srcrepo, dstrepo) diff --git a/tests/test-copies-chain-merge.t b/tests/test-copies-chain-merge.t --- a/tests/test-copies-chain-merge.t +++ b/tests/test-copies-chain-merge.t @@ -1,4 +1,4 @@ -#testcases filelog compatibility sidedata +#testcases filelog compatibility sidedata upgraded ===================================================== Test Copy tracing for chain of copies involving merge @@ -580,7 +580,7 @@ commit time. -#if filelog +#if upgraded $ cat >> $HGRCPATH << EOF > [format] > exp-use-side-data = yes @@ -608,7 +608,7 @@ #endif -#if no-compatibility +#if no-compatibility no-filelog $ for rev in `hg log --rev 'all()' -T '{rev}\n'`; do > echo "##### revision $rev #####" @@ -790,35 +790,6 @@ #endif -Downgrade to keep testing the filelog algorithm -(This can be removed once we have an explicite "upgrade" tests case_ - -#if filelog - $ cat >> $HGRCPATH << EOF - > [format] - > exp-use-side-data = no - > exp-use-copies-side-data-changeset = no - > EOF - $ hg debugformat -v - format-variant repo config default - fncache: yes yes yes - dotencode: yes yes yes - generaldelta: yes yes yes - sparserevlog: yes yes yes - sidedata: yes no no - persistent-nodemap: no no no - copies-sdc: yes no no - plain-cl-delta: yes yes yes - compression: * (glob) - compression-level: default default default - $ hg debugupgraderepo --run --quiet - upgrade will perform the following actions: - - requirements - preserved: * (glob) - removed: exp-copies-sidedata-changeset, exp-sidedata-flag - -#endif Test copy information chaining ============================== diff --git a/tests/testlib/ext-sidedata.py b/tests/testlib/ext-sidedata.py --- a/tests/testlib/ext-sidedata.py +++ b/tests/testlib/ext-sidedata.py @@ -70,7 +70,7 @@ # and sha2 hashes sha256 = hashlib.sha256(text).digest() update[sidedata.SD_TEST2] = struct.pack('>32s', sha256) - return False, (), update + return False, (), update, 0, 0 return sidedatacompanion