D6816: flagprocessors: writetransform function take side data as parameter (API)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

D6816: flagprocessors: writetransform function take side data as parameter (API)

martinvonz (Martin von Zweigbergk)
marmoute created this revision.
marmoute added reviewers: yuja, durin42.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If we want some flag processors to be able to store sidedata it needs to be
  actually fed that data.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6816

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
@@ -47,7 +47,7 @@
     text = rawtext[len(_extheader):].replace(b'i', b'1')
     return text, True, {}
 
-def writeprocessor(self, text):
+def writeprocessor(self, text, sidedata):
     # False: the returned rawtext shouldn't be used to verify hash
     rawtext = _extheader + text.replace(b'1', b'i')
     return rawtext, False
@@ -262,7 +262,7 @@
 
         # Verify text, rawtext, and rawsize
         if isext:
-            rawtext = writeprocessor(None, text)[0]
+            rawtext = writeprocessor(None, text, {})[0]
         else:
             rawtext = text
         if rlog.rawsize(rev) != len(rawtext):
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -30,19 +30,19 @@
 def bypass(self, text):
     return False
 
-def noopdonothing(self, text):
+def noopdonothing(self, text, sidedata):
     return (text, True)
 
 def noopdonothingread(self, text):
     return (text, True, {})
 
-def b64encode(self, text):
+def b64encode(self, text, sidedata):
     return (base64.b64encode(text), False)
 
 def b64decode(self, text):
     return (base64.b64decode(text), True, {})
 
-def gzipcompress(self, text):
+def gzipcompress(self, text, sidedata):
     return (zlib.compress(text), False)
 
 def gzipdecompress(self, text):
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -136,8 +136,8 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        assert not sidedata # XXX until it is actually processed
-        return self._processflagsfunc(text, flags, 'write')[:2]
+        return self._processflagsfunc(text, flags, 'write',
+                                      sidedata=sidedata)[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -157,7 +157,7 @@
         """
         return self._processflagsfunc(text, flags, 'raw')[1]
 
-    def _processflagsfunc(self, text, flags, operation):
+    def _processflagsfunc(self, text, flags, operation, sidedata=None):
         # fast path: no flag processors will run
         if flags == 0:
             return text, True, {}
@@ -196,7 +196,7 @@
                         text, vhash, s = readtransform(self, text)
                         sidedata.update(s)
                     else: # write operation
-                        text, vhash = writetransform(self, text)
+                        text, vhash = writetransform(self, text, sidedata)
                 validatehash = validatehash and vhash
 
         return text, validatehash, sidedata
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -115,7 +115,7 @@
 def ellipsisreadprocessor(rl, text):
     return text, False, {}
 
-def ellipsiswriteprocessor(rl, text):
+def ellipsiswriteprocessor(rl, text, sidedata):
     return text, False
 
 def ellipsisrawprocessor(rl, text):
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -106,7 +106,7 @@
 
     return (text, True, {})
 
-def writetostore(self, text):
+def writetostore(self, text, sidedata):
     # hg filelog metadata (includes rename, etc)
     hgmeta, offset = storageutil.parsemeta(text)
     if offset and offset > 0:



To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6816: flagprocessors: writetransform function take side data as parameter (API)

martinvonz (Martin von Zweigbergk)
marmoute updated this revision to Diff 16482.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6816?vs=16421&id=16482

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6816/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6816

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
@@ -47,7 +47,7 @@
     text = rawtext[len(_extheader):].replace(b'i', b'1')
     return text, True, {}
 
-def writeprocessor(self, text):
+def writeprocessor(self, text, sidedata):
     # False: the returned rawtext shouldn't be used to verify hash
     rawtext = _extheader + text.replace(b'1', b'i')
     return rawtext, False
@@ -262,7 +262,7 @@
 
         # Verify text, rawtext, and rawsize
         if isext:
-            rawtext = writeprocessor(None, text)[0]
+            rawtext = writeprocessor(None, text, {})[0]
         else:
             rawtext = text
         if rlog.rawsize(rev) != len(rawtext):
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -30,19 +30,19 @@
 def bypass(self, text):
     return False
 
-def noopdonothing(self, text):
+def noopdonothing(self, text, sidedata):
     return (text, True)
 
 def noopdonothingread(self, text):
     return (text, True, {})
 
-def b64encode(self, text):
+def b64encode(self, text, sidedata):
     return (base64.b64encode(text), False)
 
 def b64decode(self, text):
     return (base64.b64decode(text), True, {})
 
-def gzipcompress(self, text):
+def gzipcompress(self, text, sidedata):
     return (zlib.compress(text), False)
 
 def gzipdecompress(self, text):
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -136,8 +136,8 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        assert not sidedata # XXX until it is actually processed
-        return self._processflagsfunc(text, flags, 'write')[:2]
+        return self._processflagsfunc(text, flags, 'write',
+                                      sidedata=sidedata)[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -157,7 +157,7 @@
         """
         return self._processflagsfunc(text, flags, 'raw')[1]
 
-    def _processflagsfunc(self, text, flags, operation):
+    def _processflagsfunc(self, text, flags, operation, sidedata=None):
         # fast path: no flag processors will run
         if flags == 0:
             return text, True, {}
@@ -196,7 +196,7 @@
                         text, vhash, s = readtransform(self, text)
                         outsidedata.update(s)
                     else: # write operation
-                        text, vhash = writetransform(self, text)
+                        text, vhash = writetransform(self, text, sidedata)
                 validatehash = validatehash and vhash
 
         return text, validatehash, outsidedata
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -115,7 +115,7 @@
 def ellipsisreadprocessor(rl, text):
     return text, False, {}
 
-def ellipsiswriteprocessor(rl, text):
+def ellipsiswriteprocessor(rl, text, sidedata):
     return text, False
 
 def ellipsisrawprocessor(rl, text):
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -106,7 +106,7 @@
 
     return (text, True, {})
 
-def writetostore(self, text):
+def writetostore(self, text, sidedata):
     # hg filelog metadata (includes rename, etc)
     hgmeta, offset = storageutil.parsemeta(text)
     if offset and offset > 0:



To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6816: flagprocessors: writetransform function take side data as parameter (API)

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
marmoute updated this revision to Diff 16496.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6816?vs=16482&id=16496

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6816/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6816

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
@@ -47,7 +47,7 @@
     text = rawtext[len(_extheader):].replace(b'i', b'1')
     return text, True, {}
 
-def writeprocessor(self, text):
+def writeprocessor(self, text, sidedata):
     # False: the returned rawtext shouldn't be used to verify hash
     rawtext = _extheader + text.replace(b'1', b'i')
     return rawtext, False
@@ -262,7 +262,7 @@
 
         # Verify text, rawtext, and rawsize
         if isext:
-            rawtext = writeprocessor(None, text)[0]
+            rawtext = writeprocessor(None, text, {})[0]
         else:
             rawtext = text
         if rlog.rawsize(rev) != len(rawtext):
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -30,19 +30,19 @@
 def bypass(self, text):
     return False
 
-def noopdonothing(self, text):
+def noopdonothing(self, text, sidedata):
     return (text, True)
 
 def noopdonothingread(self, text):
     return (text, True, {})
 
-def b64encode(self, text):
+def b64encode(self, text, sidedata):
     return (base64.b64encode(text), False)
 
 def b64decode(self, text):
     return (base64.b64decode(text), True, {})
 
-def gzipcompress(self, text):
+def gzipcompress(self, text, sidedata):
     return (zlib.compress(text), False)
 
 def gzipdecompress(self, text):
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -136,8 +136,8 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        assert not sidedata # XXX until it is actually processed
-        return self._processflagsfunc(text, flags, 'write')[:2]
+        return self._processflagsfunc(text, flags, 'write',
+                                      sidedata=sidedata)[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -157,7 +157,7 @@
         """
         return self._processflagsfunc(text, flags, 'raw')[1]
 
-    def _processflagsfunc(self, text, flags, operation):
+    def _processflagsfunc(self, text, flags, operation, sidedata=None):
         # fast path: no flag processors will run
         if flags == 0:
             return text, True, {}
@@ -196,7 +196,7 @@
                         text, vhash, s = readtransform(self, text)
                         outsidedata.update(s)
                     else: # write operation
-                        text, vhash = writetransform(self, text)
+                        text, vhash = writetransform(self, text, sidedata)
                 validatehash = validatehash and vhash
 
         return text, validatehash, outsidedata
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -115,7 +115,7 @@
 def ellipsisreadprocessor(rl, text):
     return text, False, {}
 
-def ellipsiswriteprocessor(rl, text):
+def ellipsiswriteprocessor(rl, text, sidedata):
     return text, False
 
 def ellipsisrawprocessor(rl, text):
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -106,7 +106,7 @@
 
     return (text, True, {})
 
-def writetostore(self, text):
+def writetostore(self, text, sidedata):
     # hg filelog metadata (includes rename, etc)
     hgmeta, offset = storageutil.parsemeta(text)
     if offset and offset > 0:



To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6816: flagprocessors: writetransform function take side data as parameter (API)

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHGf4caf910669e: flagprocessors: writetransform function take side data as parameter (API) (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6816?vs=16496&id=16636

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6816/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D6816

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
@@ -47,7 +47,7 @@
     text = rawtext[len(_extheader):].replace(b'i', b'1')
     return text, True, {}
 
-def writeprocessor(self, text):
+def writeprocessor(self, text, sidedata):
     # False: the returned rawtext shouldn't be used to verify hash
     rawtext = _extheader + text.replace(b'1', b'i')
     return rawtext, False
@@ -262,7 +262,7 @@
 
         # Verify text, rawtext, and rawsize
         if isext:
-            rawtext = writeprocessor(None, text)[0]
+            rawtext = writeprocessor(None, text, {})[0]
         else:
             rawtext = text
         if rlog.rawsize(rev) != len(rawtext):
diff --git a/tests/flagprocessorext.py b/tests/flagprocessorext.py
--- a/tests/flagprocessorext.py
+++ b/tests/flagprocessorext.py
@@ -30,19 +30,19 @@
 def bypass(self, text):
     return False
 
-def noopdonothing(self, text):
+def noopdonothing(self, text, sidedata):
     return (text, True)
 
 def noopdonothingread(self, text):
     return (text, True, {})
 
-def b64encode(self, text):
+def b64encode(self, text, sidedata):
     return (base64.b64encode(text), False)
 
 def b64decode(self, text):
     return (base64.b64decode(text), True, {})
 
-def gzipcompress(self, text):
+def gzipcompress(self, text, sidedata):
     return (zlib.compress(text), False)
 
 def gzipdecompress(self, text):
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -136,8 +136,8 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        assert not sidedata # XXX until it is actually processed
-        return self._processflagsfunc(text, flags, 'write')[:2]
+        return self._processflagsfunc(text, flags, 'write',
+                                      sidedata=sidedata)[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -157,7 +157,7 @@
         """
         return self._processflagsfunc(text, flags, 'raw')[1]
 
-    def _processflagsfunc(self, text, flags, operation):
+    def _processflagsfunc(self, text, flags, operation, sidedata=None):
         # fast path: no flag processors will run
         if flags == 0:
             return text, True, {}
@@ -196,7 +196,7 @@
                         text, vhash, s = readtransform(self, text)
                         outsidedata.update(s)
                     else: # write operation
-                        text, vhash = writetransform(self, text)
+                        text, vhash = writetransform(self, text, sidedata)
                 validatehash = validatehash and vhash
 
         return text, validatehash, outsidedata
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -115,7 +115,7 @@
 def ellipsisreadprocessor(rl, text):
     return text, False, {}
 
-def ellipsiswriteprocessor(rl, text):
+def ellipsiswriteprocessor(rl, text, sidedata):
     return text, False
 
 def ellipsisrawprocessor(rl, text):
diff --git a/hgext/lfs/wrapper.py b/hgext/lfs/wrapper.py
--- a/hgext/lfs/wrapper.py
+++ b/hgext/lfs/wrapper.py
@@ -106,7 +106,7 @@
 
     return (text, True, {})
 
-def writetostore(self, text):
+def writetostore(self, text, sidedata):
     # hg filelog metadata (includes rename, etc)
     hgmeta, offset = storageutil.parsemeta(text)
     if offset and offset > 0:



To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel