]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/matitadaemon.ml
Matitaweb: fixed bugs in commit.
[helm.git] / matitaB / matita / matitadaemon.ml
index 22debcda494e763a27affba238ef137276837a8b..606ccea4a755878eced8b61addcab5a02a5c7668 100644 (file)
@@ -85,36 +85,39 @@ let do_global_commit () =
 
        (* call stat to get the final status *)
        let files, anomalies = MatitaFilesystem.stat_user u in
-       let add_count,not_added = List.fold_left 
-         (fun (ac_acc, na_acc) fname ->
+       let added,not_added = List.fold_left 
+         (fun (a_acc, na_acc) fname ->
             if List.mem fname (List.map fst files) then
-               ac_acc, fname::na_acc
+               a_acc, fname::na_acc
             else
-               ac_acc+1, na_acc)
-         (0,[]) to_be_added
+               fname::a_acc, na_acc)
+         ([],[]) to_be_added
        in
-       let commit_count,not_committed = List.fold_left 
-         (fun (cc_acc, nc_acc) fname ->
+       let committed,not_committed = List.fold_left 
+         (fun (c_acc, nc_acc) fname ->
             if List.mem fname (List.map fst files) then
-               cc_acc, fname::nc_acc
+               c_acc, fname::nc_acc
             else
-               cc_acc+1, nc_acc)
-         (0,[]) modified
+               fname::c_acc, nc_acc)
+         ([],[]) modified
        in
        let conflicts = List.map fst (List.filter 
          (fun (_,f) -> f = Some MatitaFilesystem.MConflict) files)
        in
+       MatitaAuthentication.set_file_flag u
+         (List.map (fun x -> x, Some MatitaFilesystem.MSynchronized) (added@committed));
        MatitaAuthentication.set_file_flag u files;
        out ^ "\n\n" ^ (Printf.sprintf
         ("COMMIT RESULTS for %s\n" ^^
          "==============\n" ^^
-         "added and committed: %d of %d\n" ^^
-         "modified and committed: %d of %d\n" ^^
+         "added and committed (%d of %d): %s\n" ^^
+         "modified and committed (%d of %d): %s\n" ^^
          "not added: %s\n" ^^
          "not committed: %s\n" ^^
          "conflicts: %s\n")
-         u add_count (List.length to_be_added) commit_count
-         (List.length modified) (String.concat ", " not_added)
+         u (List.length added) (List.length to_be_added) (String.concat ", " added)
+         (List.length committed) (List.length modified) (String.concat ", " committed)
+         (String.concat ", " not_added)
          (String.concat ", " not_committed) (String.concat ", " conflicts)))
 
   "" (List.rev !to_be_committed)
@@ -487,16 +490,17 @@ let save (cgi : Netcgi1_compat.Netcgi_types.cgi_activation) =
         List.assoc rel_filename (MatitaAuthentication.read_ft uid)
       with Not_found -> MatitaFilesystem.MUnversioned
     in
-    if old_flag <> MatitaFilesystem.MConflict then
+    (if old_flag <> MatitaFilesystem.MConflict &&
+       old_flag <> MatitaFilesystem.MAdd then
       let newflag = 
         if already_exists then MatitaFilesystem.MModified
         else MatitaFilesystem.MAdd
       in
-      MatitaAuthentication.set_file_flag uid [rel_filename, Some newflag];
+      MatitaAuthentication.set_file_flag uid [rel_filename, Some newflag]);
     cgi # set_header 
-      ~cache:`No_cache 
-      ~content_type:"text/xml; charset=\"utf-8\""
-      ();
+     ~cache:`No_cache 
+     ~content_type:"text/xml; charset=\"utf-8\""
+     ();
     cgi#out_channel#output_string "<response>ok</response>"
   with
   | File_already_exists ->