From aba161c424b7e287aa3ede5e9daae2e89bd53683 Mon Sep 17 00:00:00 2001 From: Durham Goode Date: Mon, 4 Apr 2016 16:26:12 -0700 Subject: [PATCH] store: implement metadatastore functions This implements the metadatastore APIs that were previously just stubs. --- remotefilelog/metadatastore.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/remotefilelog/metadatastore.py b/remotefilelog/metadatastore.py index cf515e3805..cbbdbc87f8 100644 --- a/remotefilelog/metadatastore.py +++ b/remotefilelog/metadatastore.py @@ -10,7 +10,8 @@ class unionmetadatastore(object): def getparents(self, name, node): """Returns the immediate parents of the node.""" - pass + ancestors = self.getancestors(name, node) + return ancestors[node][:2] def getancestors(self, name, node): """Returns as many ancestors as we're aware of. @@ -61,7 +62,8 @@ class unionmetadatastore(object): class remotefilelogmetadatastore(basestore.basestore): def getparents(self, name, node): """Returns the immediate parents of the node.""" - pass + ancestors = self.getancestors(name, node) + return ancestors[node][:2] def getancestors(self, name, node): """Returns as many ancestors as we're aware of. @@ -71,10 +73,13 @@ class remotefilelogmetadatastore(basestore.basestore): ... } """ - pass + data = self._getdata(name, node) + ancestors = ioutil.ancestormap(data) + return ancestors def getlinknode(self, name, node): - pass + ancestors = self.getancestors(name, node) + return ancestors[node][3] def add(self, name, node, parents, linknode): raise Exception("cannot add metadata only to remotefilelog "