Patchwork D6797: flagutil: use the new mixin use in remotefilelog

login
register
mail settings
Submitter phabricator
Date Sept. 7, 2019, 5 p.m.
Message ID <eff8b70d7ecd5e3ad230f19370637c25@localhost.localdomain>
Download mbox | patch
Permalink /patch/41545/
State Not Applicable
Headers show

Comments

phabricator - Sept. 7, 2019, 5 p.m.
Closed by commit rHGa5c088966d6c: flagutil: use the new mixin use in remotefilelog (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6797?vs=16402&id=16435#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6797?vs=16402&id=16435

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

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelog.py

CHANGE DETAILS




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

Patch

diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py
--- a/hgext/remotefilelog/remotefilelog.py
+++ b/hgext/remotefilelog/remotefilelog.py
@@ -24,6 +24,7 @@ 
     revlog,
 )
 from mercurial.utils import storageutil
+from mercurial.revlogutils import flagutil
 
 from . import (
     constants,
@@ -45,7 +46,7 @@ 
             raise KeyError(node)
         return node
 
-class remotefilelog(object):
+class remotefilelog(flagutil.flagprocessorsmixin):
 
     _generaldelta = True
 
@@ -57,6 +58,8 @@ 
 
         self.version = 1
 
+        self._flagprocessors = dict(flagutil.flagprocessors)
+
     def read(self, node):
         """returns the file contents at this node"""
         t = self.revision(node)
@@ -327,28 +330,6 @@ 
     def rawdata(self, node):
         return self.revision(node, raw=False)
 
-    def _processflags(self, text, flags, operation, raw=False):
-        # mostly copied from hg/mercurial/revlog.py
-        validatehash = True
-        orderedflags = revlog.REVIDX_FLAGS_ORDER
-        if operation == 'write':
-            orderedflags = reversed(orderedflags)
-        for flag in orderedflags:
-            if flag & flags:
-                vhash = True
-                if flag not in revlog._flagprocessors:
-                    message = _("missing processor for flag '%#x'") % (flag)
-                    raise revlog.RevlogError(message)
-                readfunc, writefunc, rawfunc = revlog._flagprocessors[flag]
-                if raw:
-                    vhash = rawfunc(self, text)
-                elif operation == 'read':
-                    text, vhash = readfunc(self, text)
-                elif operation == 'write':
-                    text, vhash = writefunc(self, text)
-                validatehash = validatehash and vhash
-        return text, validatehash
-
     def _read(self, id):
         """reads the raw file blob from disk, cache, or server"""
         fileservice = self.repo.fileservice