[Unison-hackers] [unison-svn] r317 - trunk/src

Benjamin C. Pierce bcpierce at seas.upenn.edu
Fri Feb 13 10:20:08 EST 2009


Author: bcpierce
Date: 2009-02-13 10:20:07 -0500 (Fri, 13 Feb 2009)
New Revision: 317

Modified:
   trunk/src/RECENTNEWS
   trunk/src/mkProjectInfo.ml
   trunk/src/update.ml
Log:
* Don't delete the temp file when a transfer fails due to a
  fingerprint mismatch (so that we can have a look and see why!)


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2009-01-15 03:34:22 UTC (rev 316)
+++ trunk/src/RECENTNEWS	2009-02-13 15:20:07 UTC (rev 317)
@@ -1,3 +1,9 @@
+CHANGES FROM VERSION 2.32.2
+
+* Don't delete the temp file when a transfer fails due to a
+  fingerprint mismatch (so that we can have a look and see why!)
+
+-------------------------------
 CHANGES FROM VERSION 2.32.1
 
 * Applied a patch from Karl M to make the GTK2 version build with

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2009-01-15 03:34:22 UTC (rev 316)
+++ trunk/src/mkProjectInfo.ml	2009-02-13 15:20:07 UTC (rev 317)
@@ -100,3 +100,4 @@
 
 
 
+

Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml	2009-01-15 03:34:22 UTC (rev 316)
+++ trunk/src/update.ml	2009-02-13 15:20:07 UTC (rev 317)
@@ -1748,12 +1748,17 @@
         let dig' = Os.fingerprint fspath path info in
         let ress' = Osx.stamp info.Fileinfo.osX in
         if dig' <> dig then begin
-          if deleteBadTempFiles then Os.delete fspath path; 
+          let savepath = Path.addSuffixToFinalName path "-bad" in
+          (* if deleteBadTempFiles then Os.delete fspath path; *)
+          if deleteBadTempFiles then
+            Os.rename "save temp" fspath path fspath savepath; 
           raise (Util.Transient (Printf.sprintf
             "The file %s was incorrectly transferred  (fingerprint mismatch in %s)%s"
             (Path.toString path)
             (Os.reasonForFingerprintMismatch dig dig')
-            (if deleteBadTempFiles then " -- temp file removed" else "")));
+            (if deleteBadTempFiles
+               then " -- temp file saved as" ^ Path.toString savepath
+               else "")));
         end;
         ArchiveFile (Props.override info.Fileinfo.desc desc,
                      dig, Fileinfo.stamp info, ress')



More information about the Unison-hackers mailing list