]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
tahoe cp -r now copies the top level directory with its children
authorMark Berger <mark.berger.j@gmail.com>
Mon, 5 Aug 2013 15:53:07 +0000 (11:53 -0400)
committerBrian Warner <warner@lothar.com>
Tue, 2 Sep 2014 19:51:13 +0000 (12:51 -0700)
src/allmydata/scripts/tahoe_cp.py

index cf421ae0dce5b8a03f2f643d09c4a2c93a844783..965aa26f3fa42aa8936339763ea1655d8ed7fb2a 100644 (file)
@@ -654,8 +654,9 @@ class Copier:
         for (name,s) in source_files:
             self.attach_to_target(s, name, target)
 
-        for source in source_dirs:
-            self.assign_targets(source, target)
+        for (name, source) in source_dirs:
+            new_target = target.get_child_target(name)
+            self.assign_targets(source, new_target)
 
         self.progress("targets assigned, %s dirs, %s files" %
                       (len(self.targetmap), self.files_to_copy))
@@ -763,7 +764,9 @@ class Copier:
         for name,source in source_infos:
             if isinstance(source, (LocalDirectorySource, TahoeDirectorySource)):
                 source.populate(True)
-                graphs.append(source)
+                # Remove trailing slash (if applicable) and get dir name
+                name = os.path.basename(os.path.normpath(name))
+                graphs.append((name, source))
         return graphs