5 from cStringIO import StringIO
6 from twisted.python.failure import Failure
7 from allmydata.scripts.common import get_alias, escape_path, \
8 DefaultAliasMarker, TahoeError
9 from allmydata.scripts.common_http import do_http, HTTPError
10 from allmydata import uri
11 from allmydata.util import fileutil
12 from allmydata.util.fileutil import abspath_expanduser_unicode, precondition_abspath
13 from allmydata.util.encodingutil import unicode_to_url, listdir_unicode, quote_output, \
14 quote_local_unicode_path, to_str
15 from allmydata.util.assertutil import precondition
18 class MissingSourceError(TahoeError):
19 def __init__(self, name, quotefn=quote_output):
20 TahoeError.__init__(self, "No such file or directory %s" % quotefn(name))
24 resp = do_http("GET", url)
25 if resp.status == 200:
27 raise HTTPError("Error during GET", resp)
29 def GET_to_string(url):
34 resp = do_http("PUT", url, data)
35 if resp.status in (200, 201):
37 raise HTTPError("Error during PUT", resp)
40 resp = do_http("POST", url, data)
41 if resp.status in (200, 201):
43 raise HTTPError("Error during POST", resp)
46 url = targeturl + "?t=mkdir"
47 resp = do_http("POST", url)
48 if resp.status in (200, 201):
49 return resp.read().strip()
50 raise HTTPError("Error during mkdir", resp)
52 def make_tahoe_subdirectory(nodeurl, parent_writecap, name):
53 url = nodeurl + "/".join(["uri",
54 urllib.quote(parent_writecap),
55 urllib.quote(unicode_to_url(name)),
57 resp = do_http("POST", url)
58 if resp.status in (200, 201):
59 return resp.read().strip()
60 raise HTTPError("Error during mkdir", resp)
63 class LocalFileSource:
64 def __init__(self, pathname, basename):
65 precondition_abspath(pathname)
66 self.pathname = pathname
67 self._basename = basename
72 def need_to_copy_bytes(self):
75 def open(self, caps_only):
76 return open(self.pathname, "rb")
78 class LocalFileTarget:
79 def __init__(self, pathname):
80 precondition_abspath(pathname)
81 self.pathname = pathname
83 def put_file(self, inf):
84 fileutil.put_file(self.pathname, inf)
86 class LocalMissingTarget:
87 def __init__(self, pathname):
88 precondition_abspath(pathname)
89 self.pathname = pathname
91 def put_file(self, inf):
92 fileutil.put_file(self.pathname, inf)
94 class LocalDirectorySource:
95 def __init__(self, progressfunc, pathname, basename):
96 precondition_abspath(pathname)
98 self.progressfunc = progressfunc
99 self.pathname = pathname
101 self._basename = basename
104 return self._basename
106 def populate(self, recurse):
107 if self.children is not None:
110 children = listdir_unicode(self.pathname)
111 for i,n in enumerate(children):
112 self.progressfunc("examining %d of %d" % (i+1, len(children)))
113 pn = os.path.join(self.pathname, n)
114 if os.path.isdir(pn):
115 child = LocalDirectorySource(self.progressfunc, pn, n)
116 self.children[n] = child
119 elif os.path.isfile(pn):
120 self.children[n] = LocalFileSource(pn, n)
122 # Could be dangling symlink; probably not copy-able.
123 # TODO: output a warning
126 class LocalDirectoryTarget:
127 def __init__(self, progressfunc, pathname):
128 precondition_abspath(pathname)
130 self.progressfunc = progressfunc
131 self.pathname = pathname
134 def populate(self, recurse):
135 if self.children is not None:
138 children = listdir_unicode(self.pathname)
139 for i,n in enumerate(children):
140 self.progressfunc("examining %d of %d" % (i+1, len(children)))
141 pn = os.path.join(self.pathname, n)
142 if os.path.isdir(pn):
143 child = LocalDirectoryTarget(self.progressfunc, pn)
144 self.children[n] = child
148 assert os.path.isfile(pn)
149 self.children[n] = LocalFileTarget(pn)
151 def get_child_target(self, name):
152 precondition(isinstance(name, unicode), name)
153 if self.children is None:
155 if name in self.children:
156 return self.children[name]
157 pathname = os.path.join(self.pathname, name)
158 os.makedirs(pathname)
159 return LocalDirectoryTarget(self.progressfunc, pathname)
161 def put_file(self, name, inf):
162 precondition(isinstance(name, unicode), name)
163 pathname = os.path.join(self.pathname, name)
164 fileutil.put_file(pathname, inf)
166 def set_children(self):
170 class TahoeFileSource:
171 def __init__(self, nodeurl, mutable, writecap, readcap, basename):
172 self.nodeurl = nodeurl
173 self.mutable = mutable
174 self.writecap = writecap
175 self.readcap = readcap
176 self._basename = basename # unicode, or None for raw filecaps
179 return self._basename
181 def need_to_copy_bytes(self):
186 def open(self, caps_only):
188 return StringIO(self.readcap)
189 url = self.nodeurl + "uri/" + urllib.quote(self.readcap)
190 return GET_to_file(url)
193 return self.writecap or self.readcap
195 class TahoeFileTarget:
196 def __init__(self, nodeurl, mutable, writecap, readcap, url):
197 self.nodeurl = nodeurl
198 self.mutable = mutable
199 self.writecap = writecap
200 self.readcap = readcap
203 def put_file(self, inf):
204 # We want to replace this object in-place.
206 # our do_http() call currently requires a string or a filehandle with
208 if not hasattr(inf, "seek"):
211 # TODO: this always creates immutable files. We might want an option
212 # to always create mutable files, or to copy mutable files into new
213 # mutable files. ticket #835
215 class TahoeDirectorySource:
216 def __init__(self, nodeurl, cache, progressfunc, basename):
217 self.nodeurl = nodeurl
219 self.progressfunc = progressfunc
220 self._basename = basename # unicode, or None for raw dircaps
223 return self._basename
225 def init_from_grid(self, writecap, readcap):
226 self.writecap = writecap
227 self.readcap = readcap
228 bestcap = writecap or readcap
229 url = self.nodeurl + "uri/%s" % urllib.quote(bestcap)
230 resp = do_http("GET", url + "?t=json")
231 if resp.status != 200:
232 raise HTTPError("Error examining source directory", resp)
233 parsed = simplejson.loads(resp.read())
235 assert nodetype == "dirnode"
236 self.mutable = d.get("mutable", False) # older nodes don't provide it
237 self.children_d = dict( [(unicode(name),value)
239 in d["children"].iteritems()] )
242 def init_from_parsed(self, parsed):
244 self.writecap = to_str(d.get("rw_uri"))
245 self.readcap = to_str(d.get("ro_uri"))
246 self.mutable = d.get("mutable", False) # older nodes don't provide it
247 self.children_d = dict( [(unicode(name),value)
249 in d["children"].iteritems()] )
252 def populate(self, recurse):
253 if self.children is not None:
256 for i,(name, data) in enumerate(self.children_d.items()):
257 self.progressfunc("examining %d of %d" % (i+1, len(self.children_d)))
258 if data[0] == "filenode":
259 mutable = data[1].get("mutable", False)
260 writecap = to_str(data[1].get("rw_uri"))
261 readcap = to_str(data[1].get("ro_uri"))
262 self.children[name] = TahoeFileSource(self.nodeurl, mutable,
263 writecap, readcap, name)
264 elif data[0] == "dirnode":
265 writecap = to_str(data[1].get("rw_uri"))
266 readcap = to_str(data[1].get("ro_uri"))
267 if writecap and writecap in self.cache:
268 child = self.cache[writecap]
269 elif readcap and readcap in self.cache:
270 child = self.cache[readcap]
272 child = TahoeDirectorySource(self.nodeurl, self.cache,
273 self.progressfunc, name)
274 child.init_from_grid(writecap, readcap)
276 self.cache[writecap] = child
278 self.cache[readcap] = child
281 self.children[name] = child
283 # TODO: there should be an option to skip unknown nodes.
284 raise TahoeError("Cannot copy unknown nodes (ticket #839). "
285 "You probably need to use a later version of "
286 "Tahoe-LAFS to copy this directory.")
288 class TahoeMissingTarget:
289 def __init__(self, url):
292 def put_file(self, inf):
293 # We want to replace this object in-place.
294 if not hasattr(inf, "seek"):
297 # TODO: this always creates immutable files. We might want an option
298 # to always create mutable files, or to copy mutable files into new
301 def put_uri(self, filecap):
302 # I'm not sure this will always work
303 return PUT(self.url + "?t=uri", filecap)
305 class TahoeDirectoryTarget:
306 def __init__(self, nodeurl, cache, progressfunc):
307 self.nodeurl = nodeurl
309 self.progressfunc = progressfunc
310 self.new_children = {}
312 def init_from_parsed(self, parsed):
314 self.writecap = to_str(d.get("rw_uri"))
315 self.readcap = to_str(d.get("ro_uri"))
316 self.mutable = d.get("mutable", False) # older nodes don't provide it
317 self.children_d = dict( [(unicode(name),value)
319 in d["children"].iteritems()] )
322 def init_from_grid(self, writecap, readcap):
323 self.writecap = writecap
324 self.readcap = readcap
325 bestcap = writecap or readcap
326 url = self.nodeurl + "uri/%s" % urllib.quote(bestcap)
327 resp = do_http("GET", url + "?t=json")
328 if resp.status != 200:
329 raise HTTPError("Error examining target directory", resp)
330 parsed = simplejson.loads(resp.read())
332 assert nodetype == "dirnode"
333 self.mutable = d.get("mutable", False) # older nodes don't provide it
334 self.children_d = dict( [(unicode(name),value)
336 in d["children"].iteritems()] )
339 def just_created(self, writecap):
340 self.writecap = writecap
341 self.readcap = uri.from_string(writecap).get_readonly().to_string()
346 def populate(self, recurse):
347 if self.children is not None:
350 for i,(name, data) in enumerate(self.children_d.items()):
351 self.progressfunc("examining %d of %d" % (i+1, len(self.children_d)))
352 if data[0] == "filenode":
353 mutable = data[1].get("mutable", False)
354 writecap = to_str(data[1].get("rw_uri"))
355 readcap = to_str(data[1].get("ro_uri"))
358 url = self.nodeurl + "/".join(["uri",
359 urllib.quote(self.writecap),
360 urllib.quote(unicode_to_url(name))])
361 self.children[name] = TahoeFileTarget(self.nodeurl, mutable,
362 writecap, readcap, url)
363 elif data[0] == "dirnode":
364 writecap = to_str(data[1].get("rw_uri"))
365 readcap = to_str(data[1].get("ro_uri"))
366 if writecap and writecap in self.cache:
367 child = self.cache[writecap]
368 elif readcap and readcap in self.cache:
369 child = self.cache[readcap]
371 child = TahoeDirectoryTarget(self.nodeurl, self.cache,
373 child.init_from_grid(writecap, readcap)
375 self.cache[writecap] = child
377 self.cache[readcap] = child
380 self.children[name] = child
382 # TODO: there should be an option to skip unknown nodes.
383 raise TahoeError("Cannot copy unknown nodes (ticket #839). "
384 "You probably need to use a later version of "
385 "Tahoe-LAFS to copy this directory.")
387 def get_child_target(self, name):
388 # return a new target for a named subdirectory of this dir
389 precondition(isinstance(name, unicode), name)
390 if self.children is None:
392 if name in self.children:
393 return self.children[name]
394 writecap = make_tahoe_subdirectory(self.nodeurl, self.writecap, name)
395 child = TahoeDirectoryTarget(self.nodeurl, self.cache,
397 child.just_created(writecap)
398 self.children[name] = child
401 def put_file(self, name, inf):
402 precondition(isinstance(name, unicode), name)
403 url = self.nodeurl + "uri"
404 if not hasattr(inf, "seek"):
407 if self.children is None:
410 # Check to see if we already have a mutable file by this name.
411 # If so, overwrite that file in place.
412 if name in self.children and self.children[name].mutable:
413 self.children[name].put_file(inf)
415 filecap = PUT(url, inf)
416 # TODO: this always creates immutable files. We might want an option
417 # to always create mutable files, or to copy mutable files into new
419 self.new_children[name] = filecap
421 def put_uri(self, name, filecap):
422 precondition(isinstance(name, unicode), name)
423 self.new_children[name] = filecap
425 def set_children(self):
426 if not self.new_children:
428 url = (self.nodeurl + "uri/" + urllib.quote(self.writecap)
431 for (name, filecap) in self.new_children.items():
432 # it just so happens that ?t=set_children will accept both file
433 # read-caps and write-caps as ['rw_uri'], and will handle either
434 # correctly. So don't bother trying to figure out whether the one
435 # we have is read-only or read-write.
436 # TODO: think about how this affects forward-compatibility for
438 set_data[name] = ["filenode", {"rw_uri": filecap}]
439 body = simplejson.dumps(set_data)
444 def do_copy(self, options, progressfunc=None):
447 elif options['verbose']:
452 nodeurl = options['node-url']
453 if nodeurl[-1] != "/":
455 self.nodeurl = nodeurl
456 self.progressfunc = progressfunc
457 self.options = options
458 self.aliases = options.aliases
459 self.verbosity = verbosity
460 self.stdout = options.stdout
461 self.stderr = options.stderr
462 if verbosity >= 2 and not self.progressfunc:
463 def progress(message):
464 print >>self.stderr, message
465 self.progressfunc = progress
466 self.caps_only = options["caps-only"]
469 status = self.try_copy()
471 except TahoeError, te:
473 Failure().printTraceback(self.stderr)
475 te.display(self.stderr)
479 source_specs = self.options.sources
480 destination_spec = self.options.destination
481 recursive = self.options["recursive"]
483 target = self.get_target_info(destination_spec)
485 sources = [] # list of (name, source object)
486 for ss in source_specs:
487 name, source = self.get_source_info(ss)
488 sources.append( (name, source) )
491 have_source_dirs = bool([s for (name,s) in sources
492 if isinstance(s, (LocalDirectorySource,
493 TahoeDirectorySource))])
495 if have_source_dirs and not recursive:
496 self.to_stderr("cannot copy directories without --recursive")
499 if isinstance(target, (LocalFileTarget, TahoeFileTarget)):
500 # cp STUFF foo.txt, where foo.txt already exists. This limits the
501 # possibilities considerably.
503 self.to_stderr("target %s is not a directory" % quote_output(destination_spec))
506 self.to_stderr("cannot copy directory into a file")
508 name, source = sources[0]
509 return self.copy_file(source, target)
511 if isinstance(target, (LocalMissingTarget, TahoeMissingTarget)):
513 return self.copy_to_directory(sources, target)
515 # if we have -r, we'll auto-create the target directory. Without
516 # it, we'll only create a file.
517 self.to_stderr("cannot copy multiple files into a file without -r")
520 name, source = sources[0]
521 return self.copy_file(source, target)
523 if isinstance(target, (LocalDirectoryTarget, TahoeDirectoryTarget)):
524 # We're copying to an existing directory -- make sure that we
525 # have target names for everything
526 for (name, source) in sources:
527 if name is None and isinstance(source, TahoeFileSource):
529 "error: you must specify a destination filename")
531 return self.copy_to_directory(sources, target)
533 self.to_stderr("unknown target")
536 def to_stderr(self, text):
537 print >>self.stderr, text
539 # FIXME reduce the amount of near-duplicate code between get_target_info
540 # and get_source_info.
542 def get_target_info(self, destination_spec):
543 precondition(isinstance(destination_spec, unicode), destination_spec)
544 rootcap, path_utf8 = get_alias(self.aliases, destination_spec, None)
545 path = path_utf8.decode("utf-8")
546 if rootcap == DefaultAliasMarker:
547 # no alias, so this is a local file
548 pathname = abspath_expanduser_unicode(path)
549 if not os.path.exists(pathname):
550 t = LocalMissingTarget(pathname)
551 elif os.path.isdir(pathname):
552 t = LocalDirectoryTarget(self.progress, pathname)
554 # TODO: should this be _assert? what happens if the target is
556 assert os.path.isfile(pathname), pathname
557 t = LocalFileTarget(pathname) # non-empty
559 # this is a tahoe object
560 url = self.nodeurl + "uri/%s" % urllib.quote(rootcap)
562 url += "/" + escape_path(path)
564 resp = do_http("GET", url + "?t=json")
565 if resp.status == 404:
567 t = TahoeMissingTarget(url)
568 elif resp.status == 200:
569 parsed = simplejson.loads(resp.read())
571 if nodetype == "dirnode":
572 t = TahoeDirectoryTarget(self.nodeurl, self.cache,
574 t.init_from_parsed(parsed)
576 writecap = to_str(d.get("rw_uri"))
577 readcap = to_str(d.get("ro_uri"))
578 mutable = d.get("mutable", False)
579 t = TahoeFileTarget(self.nodeurl, mutable,
580 writecap, readcap, url)
582 raise HTTPError("Error examining target %s"
583 % quote_output(destination_spec), resp)
586 def get_source_info(self, source_spec):
587 precondition(isinstance(source_spec, unicode), source_spec)
588 rootcap, path_utf8 = get_alias(self.aliases, source_spec, None)
589 path = path_utf8.decode("utf-8")
590 if rootcap == DefaultAliasMarker:
591 # no alias, so this is a local file
592 pathname = abspath_expanduser_unicode(path)
593 name = os.path.basename(pathname)
594 if not os.path.exists(pathname):
595 raise MissingSourceError(source_spec, quotefn=quote_local_unicode_path)
596 if os.path.isdir(pathname):
597 t = LocalDirectorySource(self.progress, pathname, name)
599 assert os.path.isfile(pathname)
600 t = LocalFileSource(pathname, name) # non-empty
602 # this is a tahoe object
603 url = self.nodeurl + "uri/%s" % urllib.quote(rootcap)
606 url += "/" + escape_path(path)
607 last_slash = path.rfind(u"/")
610 name = path[last_slash+1:]
612 resp = do_http("GET", url + "?t=json")
613 if resp.status == 404:
614 raise MissingSourceError(source_spec)
615 elif resp.status != 200:
616 raise HTTPError("Error examining source %s" % quote_output(source_spec),
618 parsed = simplejson.loads(resp.read())
620 if nodetype == "dirnode":
621 t = TahoeDirectorySource(self.nodeurl, self.cache,
623 t.init_from_parsed(parsed)
625 writecap = to_str(d.get("rw_uri"))
626 readcap = to_str(d.get("ro_uri"))
627 mutable = d.get("mutable", False) # older nodes don't provide it
629 last_slash = source_spec.rfind(u"/")
631 # TODO: this looks funny and redundant with the 'name'
632 # assignment above. cf #2329
633 name = source_spec[last_slash+1:]
635 t = TahoeFileSource(self.nodeurl, mutable, writecap, readcap, name)
639 def dump_graph(self, s, indent=" "):
640 for name, child in s.children.items():
641 print "%s%s: %r" % (indent, quote_output(name), child)
642 if isinstance(child, (LocalDirectorySource, TahoeDirectorySource)):
643 self.dump_graph(child, indent+" ")
645 def copy_to_directory(self, source_infos, target):
646 # step one: build a recursive graph of the source tree. This returns
647 # a dictionary, with child names as keys, and values that are either
648 # Directory or File instances (local or tahoe).
649 source_dirs = self.build_graphs(source_infos)
650 source_files = [source for source in source_infos
651 if isinstance(source[1], (LocalFileSource,
655 #for s in source_dirs:
658 # step two: create the top-level target directory object
659 if isinstance(target, LocalMissingTarget):
660 os.makedirs(target.pathname)
661 target = LocalDirectoryTarget(self.progress, target.pathname)
662 elif isinstance(target, TahoeMissingTarget):
663 writecap = mkdir(target.url)
664 target = TahoeDirectoryTarget(self.nodeurl, self.cache,
666 target.just_created(writecap)
667 assert isinstance(target, (LocalDirectoryTarget, TahoeDirectoryTarget))
668 target.populate(False)
670 # step three: find a target for each source node, creating
671 # directories as necessary. 'targetmap' is a dictionary that uses
672 # target Directory instances as keys, and has values of
673 # (name->sourceobject) dicts for all the files that need to wind up
676 # sources are all LocalFile/LocalDirectory/TahoeFile/TahoeDirectory
677 # target is LocalDirectory/TahoeDirectory
679 self.progress("attaching sources to targets, "
680 "%d files / %d dirs in root" %
681 (len(source_files), len(source_dirs)))
684 self.files_to_copy = 0
686 for (name,s) in source_files:
687 self.attach_to_target(s, name, target)
689 for (name, source) in source_dirs:
690 new_target = target.get_child_target(name)
691 self.assign_targets(source, new_target)
693 self.progress("targets assigned, %s dirs, %s files" %
694 (len(self.targetmap), self.files_to_copy))
696 self.progress("starting copy, %d files, %d directories" %
697 (self.files_to_copy, len(self.targetmap)))
698 self.files_copied = 0
699 self.targets_finished = 0
701 # step four: walk through the list of targets. For each one, copy all
702 # the files. If the target is a TahoeDirectory, upload and create
703 # read-caps, then do a set_children to the target directory.
705 for target in self.targetmap:
706 self.copy_files_to_target(self.targetmap[target], target)
707 self.targets_finished += 1
708 self.progress("%d/%d directories" %
709 (self.targets_finished, len(self.targetmap)))
711 return self.announce_success("files copied")
713 def attach_to_target(self, source, name, target):
714 precondition(isinstance(name, unicode), name)
715 if target not in self.targetmap:
716 self.targetmap[target] = {}
717 self.targetmap[target][name] = source
718 self.files_to_copy += 1
720 def assign_targets(self, source, target):
721 # copy everything in the source into the target
722 precondition(isinstance(source, (LocalDirectorySource, TahoeDirectorySource)), source)
724 for name, child in source.children.items():
725 if isinstance(child, (LocalDirectorySource, TahoeDirectorySource)):
726 # we will need a target directory for this one
727 subtarget = target.get_child_target(name)
728 self.assign_targets(child, subtarget)
730 precondition(isinstance(child, (LocalFileSource, TahoeFileSource)), child)
731 self.attach_to_target(child, name, target)
733 def copy_files_to_target(self, targetmap, target):
734 for name, source in targetmap.items():
735 precondition(isinstance(source, (LocalFileSource, TahoeFileSource)), source)
736 self.copy_file_into(source, name, target)
737 self.files_copied += 1
738 self.progress("%d/%d files, %d/%d directories" %
739 (self.files_copied, self.files_to_copy,
740 self.targets_finished, len(self.targetmap)))
741 target.set_children()
743 def need_to_copy_bytes(self, source, target):
744 if source.need_to_copy_bytes:
745 # mutable tahoe files, and local files
747 if isinstance(target, (LocalFileTarget, LocalDirectoryTarget)):
751 def announce_success(self, msg):
752 if self.verbosity >= 1:
753 print >>self.stdout, "Success: %s" % msg
756 def copy_file(self, source, target):
757 precondition(isinstance(source, (LocalFileSource, TahoeFileSource)), source)
758 precondition(isinstance(target, (LocalFileTarget, TahoeFileTarget,
759 LocalMissingTarget, TahoeMissingTarget)), target)
760 if self.need_to_copy_bytes(source, target):
761 # if the target is a local directory, this will just write the
762 # bytes to disk. If it is a tahoe directory, it will upload the
763 # data, and stash the new filecap for a later set_children call.
764 f = source.open(self.caps_only)
766 return self.announce_success("file copied")
767 # otherwise we're copying tahoe to tahoe, and using immutable files,
768 # so we can just make a link. TODO: this probably won't always work:
769 # need to enumerate the cases and analyze them.
770 target.put_uri(source.bestcap())
771 return self.announce_success("file linked")
773 def copy_file_into(self, source, name, target):
774 precondition(isinstance(source, (LocalFileSource, TahoeFileSource)), source)
775 precondition(isinstance(target, (LocalDirectoryTarget, TahoeDirectoryTarget)), target)
776 precondition(isinstance(name, unicode), name)
777 if self.need_to_copy_bytes(source, target):
778 # if the target is a local directory, this will just write the
779 # bytes to disk. If it is a tahoe directory, it will upload the
780 # data, and stash the new filecap for a later set_children call.
781 f = source.open(self.caps_only)
782 target.put_file(name, f)
784 # otherwise we're copying tahoe to tahoe, and using immutable files,
785 # so we can just make a link
786 target.put_uri(name, source.bestcap())
789 def progress(self, message):
791 if self.progressfunc:
792 self.progressfunc(message)
794 def build_graphs(self, source_infos):
796 for name,source in source_infos:
797 if isinstance(source, (LocalDirectorySource, TahoeDirectorySource)):
798 source.populate(True)
799 # Remove trailing slash (if applicable) and get dir name
800 name = os.path.basename(os.path.normpath(name))
801 graphs.append((name, source))
806 return Copier().do_copy(options)
808 # error cases that need improvement:
809 # local-file-in-the-way
811 # tahoe cp -r my:docs/proposed/denver.txt proposed/denver.txt
812 # handling of unknown nodes
814 # things that maybe should be errors but aren't
815 # local-dir-in-the-way
817 # tahoe cp -r my:docs/proposed/denver.txt denver.txt
818 # (creates denver.txt/denver.txt)
820 # error cases that look good:
821 # tahoe cp -r my:docs/missing missing
823 # tahoe cp -r my:docs/missing missing -> No JSON object could be decoded
824 # tahoe-file-in-the-way (when we want to make a directory)
825 # tahoe put README my:docs
826 # tahoe cp -r docs/proposed my:docs/proposed