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

vouillon@seas.upenn.edu vouillon at seas.upenn.edu
Thu Jan 7 12:52:05 EST 2010


Author: vouillon
Date: 2010-01-07 12:52:04 -0500 (Thu, 07 Jan 2010)
New Revision: 395

Modified:
   trunk/src/RECENTNEWS
   trunk/src/fpcache.ml
   trunk/src/mkProjectInfo.ml
   trunk/src/update.ml
Log:
* Fix the fingerprint cache so that it works also with multiple paths


Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS	2010-01-06 22:13:17 UTC (rev 394)
+++ trunk/src/RECENTNEWS	2010-01-07 17:52:04 UTC (rev 395)
@@ -1,5 +1,10 @@
 CHANGES FROM VERSION 2.38.5
 
+* Fix the fingerprint cache so that it works also with multiple paths
+
+-------------------------------
+CHANGES FROM VERSION 2.38.5
+
 * GTK UI:
   - do not reposition the file list when updating the detail view
     anymore

Modified: trunk/src/fpcache.ml
===================================================================
--- trunk/src/fpcache.ml	2010-01-06 22:13:17 UTC (rev 394)
+++ trunk/src/fpcache.ml	2010-01-07 17:52:04 UTC (rev 395)
@@ -131,6 +131,8 @@
   finish ();
   if fastCheck then begin
     begin try
+      debug (fun () -> Util.msg "opening cache file %s for input\n"
+                         (System.fspathToDebugString fspath));
       let ic = System.open_in_bin fspath in
       begin try
         let header = input_line ic in
@@ -243,8 +245,9 @@
                          (Path.toDebugString path));
       res
     with Not_found ->
-      debug (fun () -> Util.msg "cache miss for path %s\n"
-                         (Path.toDebugString path));
+      if fastCheck then
+        debug (fun () -> Util.msg "cache miss for path %s\n"
+                           (Path.toDebugString path));
       Os.safeFingerprint currfspath path info optDig
   in
   save path res;

Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml	2010-01-06 22:13:17 UTC (rev 394)
+++ trunk/src/mkProjectInfo.ml	2010-01-07 17:52:04 UTC (rev 395)
@@ -88,3 +88,4 @@
 Printf.printf "NAME=%s\n" projectName;;
 
 
+

Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml	2010-01-06 22:13:17 UTC (rev 394)
+++ trunk/src/update.ml	2010-01-07 17:52:04 UTC (rev 395)
@@ -1549,24 +1549,12 @@
    contents.  The directory permissions along the path are also
    collected, in case we need to build the directory hierarchy
    on one side. *)
-let rec buildUpdate archive fspath fullpath here path dirStamp =
+let rec buildUpdate archive fspath fullpath here path dirStamp fastCheckInfos =
   match Path.deconstruct path with
     None ->
       showStatus here;
-      let fastCheckInfos =
-        { fastCheck = useFastChecking ();
-          (* Directory optimization is disabled under Windows,
-             as Windows does not update directory modification times
-             on FAT filesystems. *)
-          dirFastCheck = useFastChecking () && Util.osType = `Unix;
-          dirStamp = dirStamp }
-      in
-      let (cacheFilename, _) = archiveName fspath FPCache in
-      let cacheFile = Os.fileInUnisonDir cacheFilename in
-      Fpcache.init fastCheckInfos.fastCheck cacheFile;
       let (arch, ui) =
         buildUpdateRec archive fspath here fastCheckInfos in
-      Fpcache.finish ();
       (begin match arch with
          None      -> archive
        | Some arch -> arch
@@ -1634,7 +1622,7 @@
               let (arch, updates, localPath, props) =
                 buildUpdate
                   archChild fspath fullpath (Path.child here name') path'
-                  dirStamp
+                  dirStamp fastCheckInfos
               in
               let children =
                 if arch = NoArchive then otherChildren else
@@ -1647,7 +1635,7 @@
               let (arch, updates, localPath, props) =
                 buildUpdate
                   NoArchive fspath fullpath (Path.child here name') path'
-                  dirStamp
+                  dirStamp fastCheckInfos
               in
               assert (arch = NoArchive);
               (archive, updates, localPath,
@@ -1713,6 +1701,17 @@
 (*
 let t1 = Unix.gettimeofday () in
 *)
+  let fastCheckInfos =
+    { fastCheck = useFastChecking ();
+      (* Directory optimization is disabled under Windows,
+         as Windows does not update directory modification times
+         on FAT filesystems. *)
+      dirFastCheck = useFastChecking () && Util.osType = `Unix;
+      dirStamp = dirStamp }
+  in
+  let (cacheFilename, _) = archiveName fspath FPCache in
+  let cacheFile = Os.fileInUnisonDir cacheFilename in
+  Fpcache.init fastCheckInfos.fastCheck cacheFile;
   let (archive, updates) =
     Safelist.fold_right
       (fun path (arch, upd) ->
@@ -1720,11 +1719,13 @@
            (arch, (translatePathLocal fspath path, NoUpdates, []) :: upd)
          else
            let (arch', ui, localPath, props) =
-             buildUpdate arch fspath path Path.empty path dirStamp
+             buildUpdate
+               arch fspath path Path.empty path dirStamp fastCheckInfos
            in
            arch', (localPath, ui, props) :: upd)
       pathList (archive, [])
   in
+  Fpcache.finish ();
 (*
 let t2 = Unix.gettimeofday () in
 Format.eprintf "Update detection: %f at ." (t2 -. t1);



More information about the Unison-hackers mailing list