[Unison-hackers] [unison-svn] r340 - trunk/src
vouillon@seas.upenn.edu
vouillon at seas.upenn.edu
Wed May 27 08:15:20 EDT 2009
Author: vouillon
Date: 2009-05-27 08:15:17 -0400 (Wed, 27 May 2009)
New Revision: 340
Modified:
trunk/src/RECENTNEWS
trunk/src/mkProjectInfo.ml
trunk/src/uitext.ml
trunk/src/update.ml
trunk/src/uutil.ml
trunk/src/uutil.mli
Log:
* Text UI: during update detection, display status by updating a
single line rather than generating a new line of output every so
often. That should be less confusing.
* Text UI: in repeat mode, don't save the archives when there is no
update. Indeed, in this mode, we should minimize the amount of work
performed and it is unlikely that the archives have changed much.
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/RECENTNEWS 2009-05-27 12:15:17 UTC (rev 340)
@@ -1,5 +1,15 @@
CHANGES FROM VERSION 2.34.0
+* Text UI: during update detection, display status by updating a
+ single line rather than generating a new line of output every so
+ often. That should be less confusing.
+* Text UI: in repeat mode, don't save the archives when there is no
+ update. Indeed, in this mode, we should minimize the amount of work
+ performed and it is unlikely that the archives have changed much.
+
+-------------------------------
+CHANGES FROM VERSION 2.34.0
+
* Got rid of the 16MiB marshalling limit by marshalling to a bigarray
-------------------------------
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/mkProjectInfo.ml 2009-05-27 12:15:17 UTC (rev 340)
@@ -153,3 +153,4 @@
+
Modified: trunk/src/uitext.ml
===================================================================
--- trunk/src/uitext.ml 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/uitext.ml 2009-05-27 12:15:17 UTC (rev 340)
@@ -534,7 +534,10 @@
no updates to propagate because some files (in fact, if we've
just switched to DST on windows, a LOT of files) might have new
modtimes in the archive. *)
- Update.commitUpdates ();
+ (* JV (5/09): Don't save the archive in repeat mode as it has some
+ costs and its unlikely there is much change to the archives in
+ this mode. *)
+ if Prefs.read Uicommon.repeat = "" then Update.commitUpdates ();
(skipped > 0, false, [])
end else if proceed=ProceedImmediately then begin
doit()
@@ -586,9 +589,31 @@
end
let synchronizeOnce() =
+ let showStatus path =
+ if path = "" then Util.set_infos "" else
+ let max_len = 70 in
+ let mid = (max_len - 3) / 2 in
+ let path =
+ let l = String.length path in
+ if l <= max_len then path else
+ String.sub path 0 (max_len - mid - 3) ^ "..." ^
+ String.sub path (l - mid) mid
+ in
+ let c = "-\\|/".[truncate (mod_float (4. *. Unix.gettimeofday ()) 4.)] in
+ Util.set_infos (Format.sprintf "%c %s" c path)
+ in
Trace.status "Looking for changes";
+ if not (Prefs.read Trace.terse) && (Prefs.read Trace.debugmods = []) then
+ Uutil.setUpdateStatusPrinter (Some showStatus);
+
+ let updates = Update.findUpdates() in
+
+ Uutil.setUpdateStatusPrinter None;
+ Util.set_infos "";
+
let (reconItemList, anyEqualUpdates, dangerousPaths) =
- Recon.reconcileAll (Update.findUpdates()) in
+ Recon.reconcileAll updates in
+
if reconItemList = [] then begin
(if anyEqualUpdates then
Trace.status ("Nothing to do: replicas have been changed only "
Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/update.ml 2009-05-27 12:15:17 UTC (rev 340)
@@ -1043,7 +1043,8 @@
fileLength := 0;
let t = Unix.gettimeofday () in
if t -. !t0 > 0.05 then begin
- Trace.statusDetail ("scanning... " ^ Path.toString path);
+ Uutil.showUpdateStatus (Path.toString path);
+(*Trace.statusDetail ("scanning... " ^ Path.toString path);*)
t0 := t
end
end
@@ -1436,7 +1437,7 @@
let rec buildUpdate archive fspath fullpath here path =
match Path.deconstruct path with
None ->
- showStatus path;
+ showStatus here;
let (arch, ui) =
buildUpdateRec archive fspath here (useFastChecking()) in
(begin match arch with
@@ -1572,8 +1573,9 @@
findOnRoot r pathList)
(fun (host, _) ->
begin match host with
- Remote(_) -> Trace.statusDetail "Waiting for changes from server"
- | _ -> ()
+ Remote _ -> Uutil.showUpdateStatus "";
+ Trace.statusDetail "Waiting for changes from server"
+ | _ -> ()
end)
>>= (fun updates ->
Trace.showTimer t;
Modified: trunk/src/uutil.ml
===================================================================
--- trunk/src/uutil.ml 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/uutil.ml 2009-05-27 12:15:17 UTC (rev 340)
@@ -94,6 +94,13 @@
let showProgress i bytes ch =
if i <> File.dummy then !progressPrinter i bytes ch
+let statusPrinter = ref None
+let setUpdateStatusPrinter p = statusPrinter := p
+let showUpdateStatus path =
+ match !statusPrinter with
+ Some f -> f path
+ | None -> Trace.statusDetail path
+
(*****************************************************************************)
(* Copy bytes from one file_desc to another *)
(*****************************************************************************)
Modified: trunk/src/uutil.mli
===================================================================
--- trunk/src/uutil.mli 2009-05-26 13:42:55 UTC (rev 339)
+++ trunk/src/uutil.mli 2009-05-27 12:15:17 UTC (rev 340)
@@ -46,6 +46,8 @@
val setProgressPrinter :
(File.t -> Filesize.t -> string -> unit) -> unit
val showProgress : File.t -> Filesize.t -> string -> unit
+val setUpdateStatusPrinter : (string -> unit) option -> unit
+val showUpdateStatus : string -> unit
(* Utility function to transfer bytes from one file descriptor to another
until EOF *)
More information about the Unison-hackers
mailing list