Mercurial > hg-stable
diff hgext/remotefilelog/metadatastore.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 13d4ad8d7801 |
children | 687b865b95ad |
line wrap: on
line diff
--- a/hgext/remotefilelog/metadatastore.py Sat Oct 05 10:29:34 2019 -0400 +++ b/hgext/remotefilelog/metadatastore.py Sun Oct 06 09:45:02 2019 -0400 @@ -6,6 +6,7 @@ shallowutil, ) + class unionmetadatastore(basestore.baseunionstore): def __init__(self, *args, **kwargs): super(unionmetadatastore, self).__init__(*args, **kwargs) @@ -32,6 +33,7 @@ return [] ancestors = {} + def traverse(curname, curnode): # TODO: this algorithm has the potential to traverse parts of # history twice. Ex: with A->B->C->F and A->B->D->F, both D and C @@ -59,8 +61,9 @@ while missing: curname, curnode = missing.pop() try: - ancestors.update(self._getpartialancestors(curname, curnode, - known=known)) + ancestors.update( + self._getpartialancestors(curname, curnode, known=known) + ) newmissing = traverse(curname, curnode) missing.extend(newmissing) except KeyError: @@ -95,8 +98,9 @@ raise KeyError((name, hex(node))) def add(self, name, node, data): - raise RuntimeError("cannot add content only to remotefilelog " - "contentstore") + raise RuntimeError( + "cannot add content only to remotefilelog " "contentstore" + ) def getmissing(self, keys): missing = keys @@ -113,6 +117,7 @@ metrics = [s.getmetrics() for s in self.stores] return shallowutil.sumdicts(*metrics) + class remotefilelogmetadatastore(basestore.basestore): def getancestors(self, name, node, known=None): """Returns as many ancestors as we're aware of. @@ -130,8 +135,10 @@ return self.getancestors(name, node)[node] def add(self, name, node, parents, linknode): - raise RuntimeError("cannot add metadata only to remotefilelog " - "metadatastore") + raise RuntimeError( + "cannot add metadata only to remotefilelog " "metadatastore" + ) + class remotemetadatastore(object): def __init__(self, ui, fileservice, shared): @@ -139,8 +146,9 @@ self._shared = shared def getancestors(self, name, node, known=None): - self._fileservice.prefetch([(name, hex(node))], force=True, - fetchdata=False, fetchhistory=True) + self._fileservice.prefetch( + [(name, hex(node))], force=True, fetchdata=False, fetchhistory=True + ) return self._shared.getancestors(name, node, known=known) def getnodeinfo(self, name, node):