D6813: flagprocessors: have the read transform function return side data (API)
marmoute (Pierre-Yves David)
phabricator at mercurial-scm.org
Mon Sep 9 21:25:27 UTC 2019
marmoute updated this revision to Diff 16479.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D6813?vs=16418&id=16479
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D6813/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D6813
AFFECTED FILES
hgext/lfs/wrapper.py
mercurial/revlog.py
mercurial/revlogutils/flagutil.py
tests/flagprocessorext.py
tests/test-revlog-raw.py
CHANGE DETAILS
diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py
--- a/tests/test-revlog-raw.py
+++ b/tests/test-revlog-raw.py
@@ -45,7 +45,7 @@
def readprocessor(self, rawtext):
# True: the returned text could be used to verify hash
text = rawtext[len(_extheader):].replace(b'i', b'1')
- return text, True
+ return text, True, {}
def writeprocessor(self, text):
# False: the returned rawtext shouldn't be used to verify hash
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -33,17 +33,20 @@
def noopdonothing(self, text):
return (text, True)
+def noopdonothingread(self, text):
+ return (text, True, {})
+
def b64encode(self, text):
return (base64.b64encode(text), False)
def b64decode(self, text):
- return (base64.b64decode(text), True)
+ return (base64.b64decode(text), True, {})
def gzipcompress(self, text):
return (zlib.compress(text), False)
def gzipdecompress(self, text):
- return (zlib.decompress(text), True)
+ return (zlib.decompress(text), True, {})
def supportedoutgoingversions(orig, repo):
versions = orig(repo)
@@ -116,7 +119,7 @@
flagutil.addflagprocessor(
REVIDX_NOOP,
(
- noopdonothing,
+ noopdonothingread,
noopdonothing,
validatehash,
)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -192,7 +192,8 @@
if operation == 'raw':
vhash = rawtransform(self, text)
elif operation == 'read':
- text, vhash = readtransform(self, text)
+ text, vhash, s = readtransform(self, text)
+ outsidedata.update(s)
else: # write operation
text, vhash = writetransform(self, text)
validatehash = validatehash and vhash
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -113,7 +113,7 @@
# Flag processors for REVIDX_ELLIPSIS.
def ellipsisreadprocessor(rl, text):
- return text, False
+ return text, False, {}
def ellipsiswriteprocessor(rl, text):
return text, False
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -104,7 +104,7 @@
if hgmeta or text.startswith('\1\n'):
text = storageutil.packmeta(hgmeta, text)
- return (text, True)
+ return (text, True, {})
def writetostore(self, text):
# hg filelog metadata (includes rename, etc)
To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list