D6820: flagprocessors: make `processflagsraw` a module level function

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

D6820: flagprocessors: make `processflagsraw` a module level function

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
  One more steps toward removing the mixin.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py
  mercurial/revlogutils/flagutil.py
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -291,7 +291,7 @@
         rawtext = self._svfs.read(path)
 
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -94,30 +94,12 @@
         msg = ('_processflag(...) use the specialized variant')
         util.nouideprecwarn(msg, '5.2', stacklevel=2)
         if raw:
-            return text, self._processflagsraw(text, flags)
+            return text, processflagsraw(self, text, flags)
         elif operation == 'read':
             return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsraw(self, text, flags):
-        """Inspect revision data flags to check is the content hash should be
-        validated.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-
-        This method processes the flags in the order (or reverse order if
-        ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
-        flag processors registered for present flags. The order of flags defined
-        in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
-
-        Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
-        processed text and ``validatehash`` is a bool indicating whether the
-        returned text should be checked for hash integrity.
-        """
-        return _processflagsfunc(self, text, flags, 'raw')[1]
-
 def processflagswrite(revlog, text, flags, sidedata):
     """Inspect revision data flags and applies write transformations defined
     by registered flag processors.
@@ -157,6 +139,24 @@
     """
     return _processflagsfunc(revlog, text, flags, 'read')
 
+def processflagsraw(revlog, text, flags):
+    """Inspect revision data flags to check is the content hash should be
+    validated.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+
+    This method processes the flags in the order (or reverse order if
+    ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
+    flag processors registered for present flags. The order of flags defined
+    in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
+
+    Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
+    processed text and ``validatehash`` is a bool indicating whether the
+    returned text should be checked for hash integrity.
+    """
+    return _processflagsfunc(revlog, text, flags, 'raw')[1]
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -33,6 +33,10 @@
     util,
 )
 
+from . import (
+    flagutil,
+)
+
 # maximum <delta-chain-data>/<revision-text-length> ratio
 LIMIT_DELTA2TEXT = 2
 
@@ -521,7 +525,7 @@
         fulltext = mdiff.patch(basetext, delta)
 
     try:
-        validatehash = revlog._processflagsraw(fulltext, flags)
+        validatehash = flagutil.processflagsraw(revlog, fulltext, flags)
         if validatehash:
             revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
         if flags & REVIDX_ISCENSORED:
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1657,7 +1657,7 @@
 
         sidedata = {}
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)



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
|

D6820: flagprocessors: make `processflagsraw` a module level function

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6820?vs=16425&id=16486

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

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py
  mercurial/revlogutils/flagutil.py
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -291,7 +291,7 @@
         rawtext = self._svfs.read(path)
 
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -94,30 +94,12 @@
         msg = ('_processflag(...) use the specialized variant')
         util.nouideprecwarn(msg, '5.2', stacklevel=2)
         if raw:
-            return text, self._processflagsraw(text, flags)
+            return text, processflagsraw(self, text, flags)
         elif operation == 'read':
             return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsraw(self, text, flags):
-        """Inspect revision data flags to check is the content hash should be
-        validated.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-
-        This method processes the flags in the order (or reverse order if
-        ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
-        flag processors registered for present flags. The order of flags defined
-        in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
-
-        Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
-        processed text and ``validatehash`` is a bool indicating whether the
-        returned text should be checked for hash integrity.
-        """
-        return _processflagsfunc(self, text, flags, 'raw')[1]
-
 def processflagswrite(revlog, text, flags, sidedata):
     """Inspect revision data flags and applies write transformations defined
     by registered flag processors.
@@ -157,6 +139,24 @@
     """
     return _processflagsfunc(revlog, text, flags, 'read')
 
+def processflagsraw(revlog, text, flags):
+    """Inspect revision data flags to check is the content hash should be
+    validated.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+
+    This method processes the flags in the order (or reverse order if
+    ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
+    flag processors registered for present flags. The order of flags defined
+    in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
+
+    Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
+    processed text and ``validatehash`` is a bool indicating whether the
+    returned text should be checked for hash integrity.
+    """
+    return _processflagsfunc(revlog, text, flags, 'raw')[1]
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -33,6 +33,10 @@
     util,
 )
 
+from . import (
+    flagutil,
+)
+
 # maximum <delta-chain-data>/<revision-text-length> ratio
 LIMIT_DELTA2TEXT = 2
 
@@ -521,7 +525,7 @@
         fulltext = mdiff.patch(basetext, delta)
 
     try:
-        validatehash = revlog._processflagsraw(fulltext, flags)
+        validatehash = flagutil.processflagsraw(revlog, fulltext, flags)
         if validatehash:
             revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
         if flags & REVIDX_ISCENSORED:
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1661,7 +1661,7 @@
 
         sidedata = {}
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)



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
|

D6820: flagprocessors: make `processflagsraw` a module level function

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6820?vs=16486&id=16499

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

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py
  mercurial/revlogutils/flagutil.py
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -291,7 +291,7 @@
         rawtext = self._svfs.read(path)
 
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -94,30 +94,12 @@
         msg = ('_processflag(...) use the specialized variant')
         util.nouideprecwarn(msg, '5.2', stacklevel=2)
         if raw:
-            return text, self._processflagsraw(text, flags)
+            return text, processflagsraw(self, text, flags)
         elif operation == 'read':
             return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsraw(self, text, flags):
-        """Inspect revision data flags to check is the content hash should be
-        validated.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-
-        This method processes the flags in the order (or reverse order if
-        ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
-        flag processors registered for present flags. The order of flags defined
-        in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
-
-        Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
-        processed text and ``validatehash`` is a bool indicating whether the
-        returned text should be checked for hash integrity.
-        """
-        return _processflagsfunc(self, text, flags, 'raw')[1]
-
 def processflagswrite(revlog, text, flags, sidedata):
     """Inspect revision data flags and applies write transformations defined
     by registered flag processors.
@@ -157,6 +139,24 @@
     """
     return _processflagsfunc(revlog, text, flags, 'read')
 
+def processflagsraw(revlog, text, flags):
+    """Inspect revision data flags to check is the content hash should be
+    validated.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+
+    This method processes the flags in the order (or reverse order if
+    ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
+    flag processors registered for present flags. The order of flags defined
+    in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
+
+    Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
+    processed text and ``validatehash`` is a bool indicating whether the
+    returned text should be checked for hash integrity.
+    """
+    return _processflagsfunc(revlog, text, flags, 'raw')[1]
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -33,6 +33,10 @@
     util,
 )
 
+from . import (
+    flagutil,
+)
+
 # maximum <delta-chain-data>/<revision-text-length> ratio
 LIMIT_DELTA2TEXT = 2
 
@@ -521,7 +525,7 @@
         fulltext = mdiff.patch(basetext, delta)
 
     try:
-        validatehash = revlog._processflagsraw(fulltext, flags)
+        validatehash = flagutil.processflagsraw(revlog, fulltext, flags)
         if validatehash:
             revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
         if flags & REVIDX_ISCENSORED:
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1660,7 +1660,7 @@
 
         sidedata = {}
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)



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
|

D6820: flagprocessors: make `processflagsraw` a module level function

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHGdff95420480f: flagprocessors: make `processflagsraw` a module level function (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/D6820?vs=16499&id=16640

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

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/revlogutils/deltas.py
  mercurial/revlogutils/flagutil.py
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -291,7 +291,7 @@
         rawtext = self._svfs.read(path)
 
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -94,30 +94,12 @@
         msg = ('_processflag(...) use the specialized variant')
         util.nouideprecwarn(msg, '5.2', stacklevel=2)
         if raw:
-            return text, self._processflagsraw(text, flags)
+            return text, processflagsraw(self, text, flags)
         elif operation == 'read':
             return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsraw(self, text, flags):
-        """Inspect revision data flags to check is the content hash should be
-        validated.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-
-        This method processes the flags in the order (or reverse order if
-        ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
-        flag processors registered for present flags. The order of flags defined
-        in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
-
-        Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
-        processed text and ``validatehash`` is a bool indicating whether the
-        returned text should be checked for hash integrity.
-        """
-        return _processflagsfunc(self, text, flags, 'raw')[1]
-
 def processflagswrite(revlog, text, flags, sidedata):
     """Inspect revision data flags and applies write transformations defined
     by registered flag processors.
@@ -157,6 +139,24 @@
     """
     return _processflagsfunc(revlog, text, flags, 'read')
 
+def processflagsraw(revlog, text, flags):
+    """Inspect revision data flags to check is the content hash should be
+    validated.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+
+    This method processes the flags in the order (or reverse order if
+    ``operation`` is 'write') defined by REVIDX_FLAGS_ORDER, applying the
+    flag processors registered for present flags. The order of flags defined
+    in REVIDX_FLAGS_ORDER needs to be stable to allow non-commutativity.
+
+    Returns a 2-tuple of ``(text, validatehash)`` where ``text`` is the
+    processed text and ``validatehash`` is a bool indicating whether the
+    returned text should be checked for hash integrity.
+    """
+    return _processflagsfunc(revlog, text, flags, 'raw')[1]
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py
--- a/mercurial/revlogutils/deltas.py
+++ b/mercurial/revlogutils/deltas.py
@@ -33,6 +33,10 @@
     util,
 )
 
+from . import (
+    flagutil,
+)
+
 # maximum <delta-chain-data>/<revision-text-length> ratio
 LIMIT_DELTA2TEXT = 2
 
@@ -521,7 +525,7 @@
         fulltext = mdiff.patch(basetext, delta)
 
     try:
-        validatehash = revlog._processflagsraw(fulltext, flags)
+        validatehash = flagutil.processflagsraw(revlog, fulltext, flags)
         if validatehash:
             revlog.checkhash(fulltext, expectednode, p1=p1, p2=p2)
         if flags & REVIDX_ISCENSORED:
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1660,7 +1660,7 @@
 
         sidedata = {}
         if raw:
-            validatehash = self._processflagsraw(rawtext, flags)
+            validatehash = flagutil.processflagsraw(self, rawtext, flags)
             text = rawtext
         else:
             r = flagutil.processflagsread(self, rawtext, flags)



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