D6813: flagprocessors: have the read transform function return side data (API)

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

D6813: flagprocessors: have the read transform function return side data (API)

indygreg (Gregory Szorc)
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
  This makes it possible for flag processors to -read- flag data.

REPOSITORY
  rHG Mercurial

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)
+                        sidedata.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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6813: flagprocessors: have the read transform function return side data (API)

indygreg (Gregory Szorc)
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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6813: flagprocessors: have the read transform function return side data (API)

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
marmoute updated this revision to Diff 16493.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6813?vs=16479&id=16493

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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6813: flagprocessors: have the read transform function return side data (API)

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
Closed by commit rHGbd5858c28bbe: flagprocessors: have the read transform function return side data (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/D6813?vs=16493&id=16633

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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

D6813: flagprocessors: have the read transform function return side data (API)

indygreg (Gregory Szorc)
In reply to this post by indygreg (Gregory Szorc)
pulkit added a comment.


  Can you follow-up and add an entry about the API changes resulted by this sidedata series in `relnotes/next`?

REPOSITORY
  rHG Mercurial

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

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

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