From b78c510ff29434383c2dca4125a1b11f8da489c5 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sun, 29 Oct 2017 15:57:01 -0400 Subject: [PATCH] Expand docstring for reflink utility --- beets/util/__init__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 425e7ac87..090151df2 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -548,12 +548,18 @@ def hardlink(path, dest, replace=False): def reflink(path, dest, replace=False, fallback=False): - """Create a reflink from `dest` to `path`. Raises an `OSError` if - `dest` already exists, unless `replace` is True. Does nothing if - `path` == `dest`. When `fallback` is True, `reflink` falls back on - `copy` when the filesystem does not support reflinks. + """Create a reflink from `dest` to `path`. + + Raise an `OSError` if `dest` already exists, unless `replace` is + True. If `path` == `dest`, then do nothing. + + If reflinking fails and `fallback` is enabled, try copying the file + instead. Otherwise, raise an error without trying a plain copy. + + May raise an `ImportError` if the `reflink` module is not available. """ import reflink as pyreflink + if samefile(path, dest): return