]> granicus.if.org Git - python/commitdiff
merge 3.4 (#22933)
authorBenjamin Peterson <benjamin@python.org>
Sun, 22 Mar 2015 14:15:12 +0000 (10:15 -0400)
committerBenjamin Peterson <benjamin@python.org>
Sun, 22 Mar 2015 14:15:12 +0000 (10:15 -0400)
1  2 
Doc/library/shutil.rst

index 82974ade226170503436583cd50d8038874ab91d,cd86e92944e17bc655c32a248a4f45d028e41e2c..3b467e01c27e595310775f177a8953e6682d980d
@@@ -288,25 -287,14 +288,22 @@@ Directory and files operation
     Recursively move a file or directory (*src*) to another location (*dst*)
     and return the destination.
  
-    If the destination is a directory or a symlink to a directory, then *src* is
-    moved inside that directory.
-    The destination directory must not already exist.  If the destination already
-    exists but is not a directory, it may be overwritten depending on
-    :func:`os.rename` semantics.
+    If the destination is an existing directory, then *src* is moved inside that
+    directory. If the destination already exists but is not a directory, it may
+    be overwritten depending on :func:`os.rename` semantics.
  
     If the destination is on the current filesystem, then :func:`os.rename` is
 -   used.  Otherwise, *src* is copied (using :func:`shutil.copy2`) to *dst* and
 -   then removed. In case of symlinks, a new symlink pointing to the target of
 -   *src* will be created in or as *dst* and *src* will be removed.
 +   used. Otherwise, *src* is copied to *dst* using *copy_function* and then
 +   removed.  In case of symlinks, a new symlink pointing to the target of *src*
 +   will be created in or as *dst* and *src* will be removed.
 +
 +   If *copy_function* is given, it must be a callable that takes two arguments
 +   *src* and *dst*, and will be used to copy *src* to *dest* if
 +   :func:`os.rename` cannot be used.  If the source is a directory,
 +   :func:`copytree` is called, passing it the :func:`copy_function`. The
 +   default *copy_function* is :func:`copy2`.  Using :func:`copy` as the
 +   *copy_function* allows the move to succeed when it is not possible to also
 +   copy the metadata, at the expense of not copying any of the metadata.
  
     .. versionchanged:: 3.3
        Added explicit symlink handling for foreign filesystems, thus adapting