Show More
@@ -91,7 +91,7 b' class simplefilestoreproblem(object):' | |||||
91 | node = attr.ib(default=None) |
|
91 | node = attr.ib(default=None) | |
92 |
|
92 | |||
93 | @interfaceutil.implementer(repository.ifilestorage) |
|
93 | @interfaceutil.implementer(repository.ifilestorage) | |
94 | class filestorage(object): |
|
94 | class filestorage(flagutil.flagprocessorsmixin): | |
95 | """Implements storage for a tracked path. |
|
95 | """Implements storage for a tracked path. | |
96 |
|
96 | |||
97 | Data is stored in the VFS in a directory corresponding to the tracked |
|
97 | Data is stored in the VFS in a directory corresponding to the tracked | |
@@ -102,6 +102,8 b' class filestorage(object):' | |||||
102 | Fulltext data is stored in files having names of the node. |
|
102 | Fulltext data is stored in files having names of the node. | |
103 | """ |
|
103 | """ | |
104 |
|
104 | |||
|
105 | _flagserrorclass = simplestoreerror | |||
|
106 | ||||
105 | def __init__(self, svfs, path): |
|
107 | def __init__(self, svfs, path): | |
106 | self._svfs = svfs |
|
108 | self._svfs = svfs | |
107 | self._path = path |
|
109 | self._path = path | |
@@ -119,6 +121,8 b' class filestorage(object):' | |||||
119 | self._index = [] |
|
121 | self._index = [] | |
120 | self._refreshindex() |
|
122 | self._refreshindex() | |
121 |
|
123 | |||
|
124 | self._flagprocessors = dict(flagutil.flagprocessors) | |||
|
125 | ||||
122 | def _refreshindex(self): |
|
126 | def _refreshindex(self): | |
123 | self._indexbynode.clear() |
|
127 | self._indexbynode.clear() | |
124 | self._indexbyrev.clear() |
|
128 | self._indexbyrev.clear() | |
@@ -263,45 +267,6 b' class filestorage(object):' | |||||
263 |
|
267 | |||
264 | return True |
|
268 | return True | |
265 |
|
269 | |||
266 | def _processflags(self, text, flags, operation, raw=False): |
|
|||
267 | if flags == 0: |
|
|||
268 | return text, True |
|
|||
269 |
|
||||
270 | if flags & ~flagutil.REVIDX_KNOWN_FLAGS: |
|
|||
271 | raise simplestoreerror(_("incompatible revision flag '%#x'") % |
|
|||
272 | (flags & ~flagutil.REVIDX_KNOWN_FLAGS)) |
|
|||
273 |
|
||||
274 | validatehash = True |
|
|||
275 | # Depending on the operation (read or write), the order might be |
|
|||
276 | # reversed due to non-commutative transforms. |
|
|||
277 | orderedflags = revlog.REVIDX_FLAGS_ORDER |
|
|||
278 | if operation == 'write': |
|
|||
279 | orderedflags = reversed(orderedflags) |
|
|||
280 |
|
||||
281 | for flag in orderedflags: |
|
|||
282 | # If a flagprocessor has been registered for a known flag, apply the |
|
|||
283 | # related operation transform and update result tuple. |
|
|||
284 | if flag & flags: |
|
|||
285 | vhash = True |
|
|||
286 |
|
||||
287 | if flag not in revlog._flagprocessors: |
|
|||
288 | message = _("missing processor for flag '%#x'") % (flag) |
|
|||
289 | raise simplestoreerror(message) |
|
|||
290 |
|
||||
291 | processor = revlog._flagprocessors[flag] |
|
|||
292 | if processor is not None: |
|
|||
293 | readtransform, writetransform, rawtransform = processor |
|
|||
294 |
|
||||
295 | if raw: |
|
|||
296 | vhash = rawtransform(self, text) |
|
|||
297 | elif operation == 'read': |
|
|||
298 | text, vhash = readtransform(self, text) |
|
|||
299 | else: # write operation |
|
|||
300 | text, vhash = writetransform(self, text) |
|
|||
301 | validatehash = validatehash and vhash |
|
|||
302 |
|
||||
303 | return text, validatehash |
|
|||
304 |
|
||||
305 | def checkhash(self, text, node, p1=None, p2=None, rev=None): |
|
270 | def checkhash(self, text, node, p1=None, p2=None, rev=None): | |
306 | if p1 is None and p2 is None: |
|
271 | if p1 is None and p2 is None: | |
307 | p1, p2 = self.parents(node) |
|
272 | p1, p2 = self.parents(node) |
General Comments 0
You need to be logged in to leave comments.
Login now