Closed by commit rHG705428da231f: flagutil: use it in simplestorerepo (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/D6799?vs=16404&id=16437 CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6799/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6799 AFFECTED FILES tests/simplestorerepo.py CHANGE DETAILS diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -91,7 +91,7 @@ node = attr.ib(default=None) @interfaceutil.implementer(repository.ifilestorage) -class filestorage(object): +class filestorage(flagutil.flagprocessorsmixin): """Implements storage for a tracked path. Data is stored in the VFS in a directory corresponding to the tracked @@ -102,6 +102,8 @@ Fulltext data is stored in files having names of the node. """ + _flagserrorclass = simplestoreerror + def __init__(self, svfs, path): self._svfs = svfs self._path = path @@ -119,6 +121,8 @@ self._index = [] self._refreshindex() + self._flagprocessors = dict(flagutil.flagprocessors) + def _refreshindex(self): self._indexbynode.clear() self._indexbyrev.clear() @@ -263,45 +267,6 @@ return True - def _processflags(self, text, flags, operation, raw=False): - if flags == 0: - return text, True - - if flags & ~flagutil.REVIDX_KNOWN_FLAGS: - raise simplestoreerror(_("incompatible revision flag '%#x'") % - (flags & ~flagutil.REVIDX_KNOWN_FLAGS)) - - validatehash = True - # Depending on the operation (read or write), the order might be - # reversed due to non-commutative transforms. - orderedflags = revlog.REVIDX_FLAGS_ORDER - if operation == 'write': - orderedflags = reversed(orderedflags) - - for flag in orderedflags: - # If a flagprocessor has been registered for a known flag, apply the - # related operation transform and update result tuple. - if flag & flags: - vhash = True - - if flag not in revlog._flagprocessors: - message = _("missing processor for flag '%#x'") % (flag) - raise simplestoreerror(message) - - processor = revlog._flagprocessors[flag] - if processor is not None: - readtransform, writetransform, rawtransform = processor - - if raw: - vhash = rawtransform(self, text) - elif operation == 'read': - text, vhash = readtransform(self, text) - else: # write operation - text, vhash = writetransform(self, text) - validatehash = validatehash and vhash - - return text, validatehash - def checkhash(self, text, node, p1=None, p2=None, rev=None): if p1 is None and p2 is None: p1, p2 = self.parents(node) To: marmoute, yuja, durin42, #hg-reviewers, indygreg Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel