D6819: flagprocessors: make `processflagsread` 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
|

D6819: flagprocessors: make `processflagsread` 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/D6819

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  mercurial/revlog.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
@@ -294,7 +294,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -96,30 +96,10 @@
         if raw:
             return text, self._processflagsraw(text, flags)
         elif operation == 'read':
-            return self._processflagsread(text, flags)
+            return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsread(self, text, flags):
-        """Inspect revision data flags and applies read transformations defined
-        by registered flag processors.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-        ``raw`` - an optional argument describing if the raw transform should be
-        applied.
-
-        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, 'read')
-
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
         validated.
@@ -157,6 +137,26 @@
     return _processflagsfunc(revlog, text, flags, 'write',
                              sidedata=sidedata)[:2]
 
+def processflagsread(revlog, text, flags):
+    """Inspect revision data flags and applies read transformations defined
+    by registered flag processors.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+    ``raw`` - an optional argument describing if the raw transform should be
+    applied.
+
+    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, 'read')
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1660,7 +1660,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -326,8 +326,7 @@
         flags = store.getmeta(self.filename, node).get(constants.METAKEYFLAG, 0)
         if flags == 0:
             return rawtext
-        text, verifyhash, sidedata = self._processflagsread(rawtext, flags)
-        return text
+        return flagutil.processflagsread(self, rawtext, flags)[0]
 
     def rawdata(self, node):
         return self.revision(node, raw=False)



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
|

D6819: flagprocessors: make `processflagsread` a module level function

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6819?vs=16424&id=16485

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

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  mercurial/revlog.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
@@ -294,7 +294,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -96,30 +96,10 @@
         if raw:
             return text, self._processflagsraw(text, flags)
         elif operation == 'read':
-            return self._processflagsread(text, flags)
+            return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsread(self, text, flags):
-        """Inspect revision data flags and applies read transformations defined
-        by registered flag processors.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-        ``raw`` - an optional argument describing if the raw transform should be
-        applied.
-
-        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, 'read')
-
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
         validated.
@@ -157,6 +137,26 @@
     return _processflagsfunc(revlog, text, flags, 'write',
                              sidedata=sidedata)[:2]
 
+def processflagsread(revlog, text, flags):
+    """Inspect revision data flags and applies read transformations defined
+    by registered flag processors.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+    ``raw`` - an optional argument describing if the raw transform should be
+    applied.
+
+    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, 'read')
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1664,7 +1664,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -325,8 +325,7 @@
         flags = store.getmeta(self.filename, node).get(constants.METAKEYFLAG, 0)
         if flags == 0:
             return rawtext
-        text, verifyhash, sidedata = self._processflagsread(rawtext, flags)
-        return text
+        return flagutil.processflagsread(self, rawtext, flags)[0]
 
     def rawdata(self, node):
         return self.revision(node, raw=False)



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
|

D6819: flagprocessors: make `processflagsread` a module level function

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6819?vs=16485&id=16498

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

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  mercurial/revlog.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
@@ -294,7 +294,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -96,30 +96,10 @@
         if raw:
             return text, self._processflagsraw(text, flags)
         elif operation == 'read':
-            return self._processflagsread(text, flags)
+            return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsread(self, text, flags):
-        """Inspect revision data flags and applies read transformations defined
-        by registered flag processors.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-        ``raw`` - an optional argument describing if the raw transform should be
-        applied.
-
-        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, 'read')
-
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
         validated.
@@ -157,6 +137,26 @@
     return _processflagsfunc(revlog, text, flags, 'write',
                              sidedata=sidedata)[:2]
 
+def processflagsread(revlog, text, flags):
+    """Inspect revision data flags and applies read transformations defined
+    by registered flag processors.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+    ``raw`` - an optional argument describing if the raw transform should be
+    applied.
+
+    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, 'read')
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1663,7 +1663,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -325,8 +325,7 @@
         flags = store.getmeta(self.filename, node).get(constants.METAKEYFLAG, 0)
         if flags == 0:
             return rawtext
-        text, verifyhash, sidedata = self._processflagsread(rawtext, flags)
-        return text
+        return flagutil.processflagsread(self, rawtext, flags)[0]
 
     def rawdata(self, node):
         return self.revision(node, raw=False)



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
|

D6819: flagprocessors: make `processflagsread` a module level function

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHGeb5048f8c533: flagprocessors: make `processflagsread` 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/D6819?vs=16498&id=16639

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

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  mercurial/revlog.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
@@ -294,7 +294,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -96,30 +96,10 @@
         if raw:
             return text, self._processflagsraw(text, flags)
         elif operation == 'read':
-            return self._processflagsread(text, flags)
+            return processflagsread(self, text, flags)
         else: # write operation
             return processflagswrite(self, text, flags)
 
-    def _processflagsread(self, text, flags):
-        """Inspect revision data flags and applies read transformations defined
-        by registered flag processors.
-
-        ``text`` - the revision data to process
-        ``flags`` - the revision flags
-        ``raw`` - an optional argument describing if the raw transform should be
-        applied.
-
-        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, 'read')
-
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
         validated.
@@ -157,6 +137,26 @@
     return _processflagsfunc(revlog, text, flags, 'write',
                              sidedata=sidedata)[:2]
 
+def processflagsread(revlog, text, flags):
+    """Inspect revision data flags and applies read transformations defined
+    by registered flag processors.
+
+    ``text`` - the revision data to process
+    ``flags`` - the revision flags
+    ``raw`` - an optional argument describing if the raw transform should be
+    applied.
+
+    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, 'read')
+
 def _processflagsfunc(revlog, text, flags, operation, sidedata=None):
     """internal function to process flag on a revlog
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1663,7 +1663,7 @@
             validatehash = self._processflagsraw(rawtext, flags)
             text = rawtext
         else:
-            r = self._processflagsread(rawtext, flags)
+            r = flagutil.processflagsread(self, rawtext, flags)
             text, validatehash, sidedata = r
         if validatehash:
             self.checkhash(text, node, rev=rev)
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -328,8 +328,7 @@
         flags = store.getmeta(self.filename, node).get(constants.METAKEYFLAG, 0)
         if flags == 0:
             return rawtext
-        text, verifyhash, sidedata = self._processflagsread(rawtext, flags)
-        return text
+        return flagutil.processflagsread(self, rawtext, flags)[0]
 
     def rawdata(self, node):
         return self.revision(node, raw=False)



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