]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fileutil: make the error behaviour of replace_file on Unix more similar to Windows.
authorDaira Hopwood <daira@jacaranda.org>
Tue, 2 Jun 2015 01:09:25 +0000 (02:09 +0100)
committerDaira Hopwood <daira@jacaranda.org>
Mon, 8 Jun 2015 13:24:30 +0000 (14:24 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/fileutil.py

index 26943212bde4b6870e96e825a39b572992af4885..133d22710e653dded221b668f30ec2062d9d3e3a 100644 (file)
@@ -615,6 +615,8 @@ else:
         precondition_abspath(replacement_path)
         precondition_abspath(backup_path)
 
+        if not os.path.exists(replacement_path):
+            raise ConflictError("Replacement file not found: %r" % (replacement_path,))
         try:
             os.rename(replaced_path, backup_path)
             rename_no_overwrite(replacement_path, replaced_path)