##// END OF EJS Templates
flagutil: use the new mixin use in remotefilelog...
marmoute -
r43141:a5c08896 default
parent child Browse files
Show More
@@ -24,6 +24,7 b' from mercurial import ('
24 revlog,
24 revlog,
25 )
25 )
26 from mercurial.utils import storageutil
26 from mercurial.utils import storageutil
27 from mercurial.revlogutils import flagutil
27
28
28 from . import (
29 from . import (
29 constants,
30 constants,
@@ -45,7 +46,7 b' class remotefilelognodemap(object):'
45 raise KeyError(node)
46 raise KeyError(node)
46 return node
47 return node
47
48
48 class remotefilelog(object):
49 class remotefilelog(flagutil.flagprocessorsmixin):
49
50
50 _generaldelta = True
51 _generaldelta = True
51
52
@@ -57,6 +58,8 b' class remotefilelog(object):'
57
58
58 self.version = 1
59 self.version = 1
59
60
61 self._flagprocessors = dict(flagutil.flagprocessors)
62
60 def read(self, node):
63 def read(self, node):
61 """returns the file contents at this node"""
64 """returns the file contents at this node"""
62 t = self.revision(node)
65 t = self.revision(node)
@@ -327,28 +330,6 b' class remotefilelog(object):'
327 def rawdata(self, node):
330 def rawdata(self, node):
328 return self.revision(node, raw=False)
331 return self.revision(node, raw=False)
329
332
330 def _processflags(self, text, flags, operation, raw=False):
331 # mostly copied from hg/mercurial/revlog.py
332 validatehash = True
333 orderedflags = revlog.REVIDX_FLAGS_ORDER
334 if operation == 'write':
335 orderedflags = reversed(orderedflags)
336 for flag in orderedflags:
337 if flag & flags:
338 vhash = True
339 if flag not in revlog._flagprocessors:
340 message = _("missing processor for flag '%#x'") % (flag)
341 raise revlog.RevlogError(message)
342 readfunc, writefunc, rawfunc = revlog._flagprocessors[flag]
343 if raw:
344 vhash = rawfunc(self, text)
345 elif operation == 'read':
346 text, vhash = readfunc(self, text)
347 elif operation == 'write':
348 text, vhash = writefunc(self, text)
349 validatehash = validatehash and vhash
350 return text, validatehash
351
352 def _read(self, id):
333 def _read(self, id):
353 """reads the raw file blob from disk, cache, or server"""
334 """reads the raw file blob from disk, cache, or server"""
354 fileservice = self.repo.fileservice
335 fileservice = self.repo.fileservice
General Comments 0
You need to be logged in to leave comments. Login now