]> 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>
Tue, 2 Jun 2015 14:48:14 +0000 (15:48 +0100)
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
src/allmydata/util/fileutil.py

index 8681c29d0e5656eae1b5f972170982dc452a4c18..6d7e596a85ac35622a467b4ca11cd6e287f84c3a 100644 (file)
@@ -630,6 +630,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)