Browse code

use --files-from only on local source (not remote, not dest)

The restriction to use --files-from on the source and not the
destination list comes from the equivalent behavior in rsync.

The restriction on not using it for remote sources is only because I
haven't figured out the best way to handle that. That may be added in
the future.

Matt Domsch authored on 2013/02/21 13:06:34
Showing 2 changed files
... ...
@@ -179,7 +179,7 @@ def _get_filelist_from_file(cfg, local_path):
179 179
         result.append((key, [], values))
180 180
     return result
181 181
 
182
-def fetch_local_list(args, recursive = None):
182
+def fetch_local_list(args, is_src = False, recursive = None):
183 183
     def _get_filelist_local(loc_list, local_uri, cache):
184 184
         info(u"Compiling list of local files...")
185 185
 
... ...
@@ -195,7 +195,7 @@ def fetch_local_list(args, recursive = None):
195 195
         if local_uri.isdir():
196 196
             local_base = deunicodise(local_uri.basename())
197 197
             local_path = deunicodise(local_uri.path())
198
-            if len(cfg.files_from):
198
+            if is_src and len(cfg.files_from):
199 199
                 filelist = _get_filelist_from_file(cfg, local_path)
200 200
                 single_file = False
201 201
             else:
... ...
@@ -271,7 +271,7 @@ def cmd_object_put(args):
271 271
     if len(args) == 0:
272 272
         raise ParameterError("Nothing to upload. Expecting a local file or directory.")
273 273
 
274
-    local_list, single_file_local = fetch_local_list(args)
274
+    local_list, single_file_local = fetch_local_list(args, is_src = True)
275 275
 
276 276
     local_list, exclude_list = filter_exclude_include(local_list)
277 277
 
... ...
@@ -717,7 +717,7 @@ def cmd_sync_remote2local(args):
717 717
     s3 = S3(Config())
718 718
 
719 719
     destination_base = args[-1]
720
-    local_list, single_file_local = fetch_local_list(destination_base, recursive = True)
720
+    local_list, single_file_local = fetch_local_list(destination_base, is_src = False, recursive = True)
721 721
     remote_list = fetch_remote_list(args[:-1], recursive = True, require_attribs = True)
722 722
 
723 723
     local_count = len(local_list)
... ...
@@ -1136,7 +1136,7 @@ def cmd_sync_local2remote(args):
1136 1136
         error(u"or disable encryption with --no-encrypt parameter.")
1137 1137
         sys.exit(1)
1138 1138
 
1139
-    local_list, single_file_local = fetch_local_list(args[:-1], recursive = True)
1139
+    local_list, single_file_local = fetch_local_list(args[:-1], is_src = True, recursive = True)
1140 1140
 
1141 1141
     destinations = [args[-1]]
1142 1142
     if cfg.additional_destinations: