D6812: flagprocessors: return flagdata in the main processing function

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

D6812: flagprocessors: return flagdata in the main processing function

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

REVISION SUMMARY
  This function input and return are becoming stranger and stranger bnut I don't
  have a good plan to make is saner without problematic code duplication, so it
  will be this way to now.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -118,8 +118,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        text, vhash = self._processflagsfunc(text, flags, 'read')
-        return text, vhash, {}
+        return self._processflagsfunc(text, flags, 'read')
 
     def _processflagswrite(self, text, flags):
         """Inspect revision data flags and applies write transformations defined
@@ -137,7 +136,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        return self._processflagsfunc(text, flags, 'write')
+        return self._processflagsfunc(text, flags, 'write')[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -160,7 +159,7 @@
     def _processflagsfunc(self, text, flags, operation):
         # fast path: no flag processors will run
         if flags == 0:
-            return text, True
+            return text, True, {}
         if not operation in ('read', 'write', 'raw'):
             raise error.ProgrammingError(_("invalid '%s' operation") %
                                          operation)
@@ -175,6 +174,7 @@
         if operation == 'write':
             orderedflags = reversed(orderedflags)
 
+        sidedata = {}
         for flag in orderedflags:
             # If a flagprocessor has been registered for a known flag, apply the
             # related operation transform and update result tuple.
@@ -197,4 +197,4 @@
                         text, vhash = writetransform(self, text)
                 validatehash = validatehash and vhash
 
-        return text, validatehash
+        return text, validatehash, sidedata



To: marmoute, yuja, durin42, #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
|

D6812: flagprocessors: return flagdata in the main processing function

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6812?vs=16417&id=16478

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

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

AFFECTED FILES
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -118,8 +118,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        text, vhash = self._processflagsfunc(text, flags, 'read')
-        return text, vhash, {}
+        return self._processflagsfunc(text, flags, 'read')
 
     def _processflagswrite(self, text, flags):
         """Inspect revision data flags and applies write transformations defined
@@ -137,7 +136,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        return self._processflagsfunc(text, flags, 'write')
+        return self._processflagsfunc(text, flags, 'write')[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -160,7 +159,7 @@
     def _processflagsfunc(self, text, flags, operation):
         # fast path: no flag processors will run
         if flags == 0:
-            return text, True
+            return text, True, {}
         if operation not in ('read', 'write', 'raw'):
             raise error.ProgrammingError(_("invalid '%s' operation") %
                                          operation)
@@ -175,6 +174,7 @@
         if operation == 'write':
             orderedflags = reversed(orderedflags)
 
+        outsidedata = {}
         for flag in orderedflags:
             # If a flagprocessor has been registered for a known flag, apply the
             # related operation transform and update result tuple.
@@ -197,4 +197,4 @@
                         text, vhash = writetransform(self, text)
                 validatehash = validatehash and vhash
 
-        return text, validatehash
+        return text, validatehash, outsidedata



To: marmoute, yuja, durin42, #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
|

D6812: flagprocessors: return flagdata in the main processing function

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHG66dc5a522f37: flagprocessors: return flagdata in the main processing 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/D6812?vs=16478&id=16632

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

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

AFFECTED FILES
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -118,8 +118,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        text, vhash = self._processflagsfunc(text, flags, 'read')
-        return text, vhash, {}
+        return self._processflagsfunc(text, flags, 'read')
 
     def _processflagswrite(self, text, flags):
         """Inspect revision data flags and applies write transformations defined
@@ -137,7 +136,7 @@
         processed text and ``validatehash`` is a bool indicating whether the
         returned text should be checked for hash integrity.
         """
-        return self._processflagsfunc(text, flags, 'write')
+        return self._processflagsfunc(text, flags, 'write')[:2]
 
     def _processflagsraw(self, text, flags):
         """Inspect revision data flags to check is the content hash should be
@@ -160,7 +159,7 @@
     def _processflagsfunc(self, text, flags, operation):
         # fast path: no flag processors will run
         if flags == 0:
-            return text, True
+            return text, True, {}
         if operation not in ('read', 'write', 'raw'):
             raise error.ProgrammingError(_("invalid '%s' operation") %
                                          operation)
@@ -175,6 +174,7 @@
         if operation == 'write':
             orderedflags = reversed(orderedflags)
 
+        outsidedata = {}
         for flag in orderedflags:
             # If a flagprocessor has been registered for a known flag, apply the
             # related operation transform and update result tuple.
@@ -197,4 +197,4 @@
                         text, vhash = writetransform(self, text)
                 validatehash = validatehash and vhash
 
-        return text, validatehash
+        return text, validatehash, outsidedata



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