[PATCH 3 of 4] basestore: makes _verify abstract method
liscju
piotr.listkiewicz at gmail.com
Mon May 2 16:19:11 EDT 2016
# HG changeset patch
# User liscju <piotr.listkiewicz at gmail.com>
# Date 1462207969 -7200
# Mon May 02 18:52:49 2016 +0200
# Branch stable
# Node ID 889c3537ab941231ebc6881af6c1be6f0321294b
# Parent db90d22f291f40554f857a7b0b2d43a0d674cf75
basestore: makes _verify abstract method
This prepares for changing implementation of _verify in remotestore,
for now the implementation for localstore and remotestore does not differ
so was copied.
diff -r db90d22f291f -r 889c3537ab94 hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py Mon May 02 18:34:25 2016 +0200
+++ b/hgext/largefiles/basestore.py Mon May 02 18:52:49 2016 +0200
@@ -137,15 +137,7 @@ class basestore(object):
return int(failed)
def _verify(self, revs, contents, verified):
- failed = False
- for rev in revs:
- cctx = self.repo[rev]
- cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
-
- for standin in cctx:
- if self._verifyfile(cctx, cset, contents, standin, verified):
- failed = True
- return failed
+ raise NotImplementedError('abstract method')
def _getfile(self, tmpfile, filename, hash):
'''Fetch one revision of one file from the store and write it
diff -r db90d22f291f -r 889c3537ab94 hgext/largefiles/localstore.py
--- a/hgext/largefiles/localstore.py Mon May 02 18:34:25 2016 +0200
+++ b/hgext/largefiles/localstore.py Mon May 02 18:52:49 2016 +0200
@@ -8,6 +8,7 @@
'''store class for local filesystem'''
+from mercurial import node
from mercurial.i18n import _
import lfutil
@@ -42,6 +43,17 @@ class localstore(basestore.basestore):
with open(path, 'rb') as fd:
return lfutil.copyandhash(fd, tmpfile)
+ def _verify(self, revs, contents, verified):
+ failed = False
+ for rev in revs:
+ cctx = self.repo[rev]
+ cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
+
+ for standin in cctx:
+ if self._verifyfile(cctx, cset, contents, standin, verified):
+ failed = True
+ return failed
+
def _verifyfile(self, cctx, cset, contents, standin, verified):
filename = lfutil.splitstandin(standin)
if not filename:
diff -r db90d22f291f -r 889c3537ab94 hgext/largefiles/remotestore.py
--- a/hgext/largefiles/remotestore.py Mon May 02 18:34:25 2016 +0200
+++ b/hgext/largefiles/remotestore.py Mon May 02 18:52:49 2016 +0200
@@ -6,7 +6,7 @@
'''remote largefile store; the base class for wirestore'''
-from mercurial import util, wireproto, error
+from mercurial import util, wireproto, error, node
from mercurial.i18n import _
urlerr = util.urlerr
@@ -65,6 +65,17 @@ class remotestore(basestore.basestore):
return lfutil.copyandhash(chunks, tmpfile)
+ def _verify(self, revs, contents, verified):
+ failed = False
+ for rev in revs:
+ cctx = self.repo[rev]
+ cset = "%d:%s" % (cctx.rev(), node.short(cctx.node()))
+
+ for standin in cctx:
+ if self._verifyfile(cctx, cset, contents, standin, verified):
+ failed = True
+ return failed
+
def _verifyfile(self, cctx, cset, contents, standin, verified):
filename = lfutil.splitstandin(standin)
if not filename:
More information about the Mercurial-devel
mailing list