fixed wrong index in tahoe cp --verbose, as explained in #1805

this bug shows wrong counters for copied files in verbose mode
This commit is contained in:
frederik b 2012-09-28 19:22:53 +02:00 committed by Brian Warner
parent bdd0b55b0d
commit 595d611c9b
2 changed files with 10 additions and 4 deletions

View File

@ -103,7 +103,7 @@ class LocalDirectorySource:
self.children = {}
children = listdir_unicode(self.pathname)
for i,n in enumerate(children):
self.progressfunc("examining %d of %d" % (i, len(children)))
self.progressfunc("examining %d of %d" % (i+1, len(children)))
pn = os.path.join(self.pathname, n)
if os.path.isdir(pn):
child = LocalDirectorySource(self.progressfunc, pn)
@ -131,7 +131,7 @@ class LocalDirectoryTarget:
self.children = {}
children = listdir_unicode(self.pathname)
for i,n in enumerate(children):
self.progressfunc("examining %d of %d" % (i, len(children)))
self.progressfunc("examining %d of %d" % (i+1, len(children)))
n = unicode(n)
pn = os.path.join(self.pathname, n)
if os.path.isdir(pn):
@ -239,7 +239,7 @@ class TahoeDirectorySource:
return
self.children = {}
for i,(name, data) in enumerate(self.children_d.items()):
self.progressfunc("examining %d of %d" % (i, len(self.children_d)))
self.progressfunc("examining %d of %d" % (i+1, len(self.children_d)))
if data[0] == "filenode":
mutable = data[1].get("mutable", False)
writecap = to_str(data[1].get("rw_uri"))
@ -333,7 +333,7 @@ class TahoeDirectoryTarget:
return
self.children = {}
for i,(name, data) in enumerate(self.children_d.items()):
self.progressfunc("examining %d of %d" % (i, len(self.children_d)))
self.progressfunc("examining %d of %d" % (i+1, len(self.children_d)))
if data[0] == "filenode":
mutable = data[1].get("mutable", False)
writecap = to_str(data[1].get("rw_uri"))

View File

@ -2031,6 +2031,12 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
results = fileutil.read(fn3)
self.failUnlessReallyEqual(results, DATA1)
d.addCallback(_get_resp2)
# cp --verbose filename3 dircap:test_file
d.addCallback(lambda ign:
self.do_cli("cp", "--verbose", '--recursive', self.basedir, self.dircap))
def _test_for_wrong_indices((rc, out, err)):
self.failUnless('examining 1 of 1\n' in err)
d.addCallback(_test_for_wrong_indices)
return d
def test_cp_with_nonexistent_alias(self):