Mercurial > public > mercurial-scm > hg
diff tests/testlib/ext-sidedata-2.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 | 64cd1496bb70 |
children | 6000f5b25c9b |
line wrap: on
line diff
--- a/tests/testlib/ext-sidedata-2.py Sat Apr 10 11:27:40 2021 +0200 +++ b/tests/testlib/ext-sidedata-2.py Thu Apr 08 16:55:17 2021 +0200 @@ -16,13 +16,15 @@ from mercurial.revlogutils import sidedata as sidedatamod from mercurial.revlogutils import constants +NO_FLAGS = (0, 0) # hoot + def compute_sidedata_1(repo, revlog, rev, sidedata, text=None): sidedata = sidedata.copy() if text is None: text = revlog.revision(rev) sidedata[sidedatamod.SD_TEST1] = struct.pack('>I', len(text)) - return sidedata + return sidedata, NO_FLAGS def compute_sidedata_2(repo, revlog, rev, sidedata, text=None): @@ -31,7 +33,7 @@ text = revlog.revision(rev) sha256 = hashlib.sha256(text).digest() sidedata[sidedatamod.SD_TEST2] = struct.pack('>32s', sha256) - return sidedata + return sidedata, NO_FLAGS def reposetup(ui, repo): @@ -42,10 +44,12 @@ sidedatamod.SD_TEST1, (sidedatamod.SD_TEST1,), compute_sidedata_1, + 0, ) repo.register_sidedata_computer( kind, sidedatamod.SD_TEST2, (sidedatamod.SD_TEST2,), compute_sidedata_2, + 0, )