Patchwork D6821: flagprocessors: directly duplicate the deprecated layer back into revlog

login
register
mail settings
Submitter phabricator
Date Sept. 7, 2019, 9:30 a.m.
Message ID <differential-rev-PHID-DREV-72kjzseob6pfs5v6tfva-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41526/
State New
Headers show

Comments

phabricator - Sept. 7, 2019, 9:30 a.m.
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
  The code duplication benign and will get removed in a couple of month anyway.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py
  mercurial/revlog.py
  mercurial/revlogutils/flagutil.py

CHANGE DETAILS




To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Sept. 9, 2019, 6 p.m.
durin42 added inline comments.

INLINE COMMENTS

> remotefilelog.py:311
> +        """deprecated entry point to access flag processors"""
> +        msg = ('_processflag(...) use the specialized variant')
> +        util.nouideprecwarn(msg, '5.2', stacklevel=2)

I'm not sure what this is telling me.  Is it saying that I want one of processflags{raw,read,write}?

I missed this over the weekend when I wasn't coding (I don't do hg stuff on weekends), but the message is sufficiently confusing I want to clean it up.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel
phabricator - Sept. 11, 2019, 7:24 a.m.
marmoute added inline comments.

INLINE COMMENTS

> durin42 wrote in remotefilelog.py:311
> I'm not sure what this is telling me.  Is it saying that I want one of processflags{raw,read,write}?
> 
> I missed this over the weekend when I wasn't coding (I don't do hg stuff on weekends), but the message is sufficiently confusing I want to clean it up.

Yes, that's the message.

REPOSITORY
  rHG Mercurial

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

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

To: marmoute, yuja, durin42, indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/revlogutils/flagutil.py b/mercurial/revlogutils/flagutil.py
--- a/mercurial/revlogutils/flagutil.py
+++ b/mercurial/revlogutils/flagutil.py
@@ -89,17 +89,6 @@ 
 
     _flagserrorclass = error.RevlogError
 
-    def _processflags(self, text, flags, operation, raw=False):
-        """deprecated entry point to access flag processors"""
-        msg = ('_processflag(...) use the specialized variant')
-        util.nouideprecwarn(msg, '5.2', stacklevel=2)
-        if raw:
-            return text, processflagsraw(self, text, flags)
-        elif operation == 'read':
-            return processflagsread(self, text, flags)
-        else: # write operation
-            return processflagswrite(self, text, flags)
-
 def processflagswrite(revlog, text, flags, sidedata):
     """Inspect revision data flags and applies write transformations defined
     by registered flag processors.
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1601,6 +1601,17 @@ 
         return mdiff.textdiff(self.rawdata(rev1),
                               self.rawdata(rev2))
 
+    def _processflags(self, text, flags, operation, raw=False):
+        """deprecated entry point to access flag processors"""
+        msg = ('_processflag(...) use the specialized variant')
+        util.nouideprecwarn(msg, '5.2', stacklevel=2)
+        if raw:
+            return text, flagutil.processflagsraw(self, text, flags)
+        elif operation == 'read':
+            return flagutil.processflagsread(self, text, flags)
+        else: # write operation
+            return flagutil.processflagswrite(self, text, flags)
+
     def revision(self, nodeorrev, _df=None, raw=False):
         """return an uncompressed revision of a given node or revision
         number.
diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -22,6 +22,7 @@ 
     error,
     mdiff,
     revlog,
+    util,
 )
 from mercurial.utils import storageutil
 
@@ -305,6 +306,17 @@ 
                 'remotefilelog does not convert integer rev to node')
         return rev
 
+    def _processflags(self, text, flags, operation, raw=False):
+        """deprecated entry point to access flag processors"""
+        msg = ('_processflag(...) use the specialized variant')
+        util.nouideprecwarn(msg, '5.2', stacklevel=2)
+        if raw:
+            return text, flagutil.processflagsraw(self, text, flags)
+        elif operation == 'read':
+            return flagutil.processflagsread(self, text, flags)
+        else: # write operation
+            return flagutil.processflagswrite(self, text, flags)
+
     def revision(self, node, raw=False):
         """returns the revlog contents at this node.
         this includes the meta data traditionally included in file revlogs.