]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fixed wrong index in tahoe cp --verbose, as explained in #1805
authorfrederik b <freddy@flashpad>
Fri, 28 Sep 2012 17:22:53 +0000 (19:22 +0200)
committerBrian Warner <warner@lothar.com>
Sun, 30 Sep 2012 04:32:51 +0000 (21:32 -0700)
this bug shows wrong counters for copied files in verbose mode

src/allmydata/scripts/tahoe_cp.py
src/allmydata/test/test_cli.py

index 13537dc0a878a2eda35348e042bc0428302f4332..f2f8c92243d4d7758abfb56aa08caef3efd18738 100644 (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"))
index e3d0f4c6fd8384d8204dd9fbe63e5028eba82f79..c2dad120772227d6b63d8a24672e8352f1405078 100644 (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):