From 1c96039270f9489a52c5d514ee4702d31bd24c22 Mon Sep 17 00:00:00 2001 From: Mark Berger Date: Mon, 5 Aug 2013 11:53:07 -0400 Subject: [PATCH] tahoe cp -r now copies the top level directory with its children --- src/allmydata/scripts/tahoe_cp.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/allmydata/scripts/tahoe_cp.py b/src/allmydata/scripts/tahoe_cp.py index cf421ae0..965aa26f 100644 --- a/src/allmydata/scripts/tahoe_cp.py +++ b/src/allmydata/scripts/tahoe_cp.py @@ -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 -- 2.45.2