[Unison-hackers] [unison-svn] r318 - trunk/src
Benjamin C. Pierce
bcpierce at seas.upenn.edu
Thu Mar 12 22:38:03 EDT 2009
Author: bcpierce
Date: 2009-03-12 22:38:02 -0400 (Thu, 12 Mar 2009)
New Revision: 318
Modified:
trunk/src/RECENTNEWS
trunk/src/mkProjectInfo.ml
trunk/src/uitext.ml
trunk/src/update.ml
Log:
* Text UI now includes the current time in its completion message
* Fix a small bug that was affecting mainly windows users. We need to
commit the archives at the end of the sync even if there are 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. (Changed the text UI only. It's less clear where
to change the GUI.)
* Small improvement to text UI "scanning..." messages, to print just
directories (hopefully making it clearer that individual files are
not necessarily being fingerprinted).
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2009-02-13 15:20:07 UTC (rev 317)
+++ trunk/src/RECENTNEWS 2009-03-13 02:38:02 UTC (rev 318)
@@ -1,3 +1,20 @@
+CHANGES FROM VERSION 2.32.4
+
+* Text UI now includes the current time in its completion message
+
+* Fix a small bug that was affecting mainly windows users. We need to
+ commit the archives at the end of the sync even if there are 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. (Changed the text UI only. It's less clear where
+ to change the GUI.)
+
+* Small improvement to text UI "scanning..." messages, to print just
+ directories (hopefully making it clearer that individual files are
+ not necessarily being fingerprinted).
+
+
+-------------------------------
CHANGES FROM VERSION 2.32.2
* Don't delete the temp file when a transfer fails due to a
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2009-02-13 15:20:07 UTC (rev 317)
+++ trunk/src/mkProjectInfo.ml 2009-03-13 02:38:02 UTC (rev 318)
@@ -101,3 +101,4 @@
+
Modified: trunk/src/uitext.ml
===================================================================
--- trunk/src/uitext.ml 2009-02-13 15:20:07 UTC (rev 317)
+++ trunk/src/uitext.ml 2009-03-13 02:38:02 UTC (rev 318)
@@ -492,11 +492,14 @@
let trans = updatesToDo - failures in
let summary =
Printf.sprintf
- "Synchronization %s (%d item%s transferred, %d skipped, %d failure%s)"
+ "Synchronization %s at %s (%d item%s transferred, %d skipped, %d failed)"
(if failures=0 then "complete" else "incomplete")
+ (let tm = Util.localtime (Util.time()) in
+ Printf.sprintf "%02d:%02d:%02d"
+ tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec)
trans (if trans=1 then "" else "s")
skipped
- failures (if failures=1 then "" else "s") in
+ failures in
Trace.log (summary ^ "\n");
if skipped>0 then
Safelist.iter
@@ -509,14 +512,18 @@
Safelist.iter
(fun p -> alwaysDisplayAndLog (" failed: " ^ (Path.toString p)))
failedPaths;
- (skipped > 0, failures > 0, failedPaths)
- in
- if updatesToDo = 0 then
- (display "No updates to propagate\n";
- (skipped > 0, false, []))
- else if proceed=ProceedImmediately then
+ (skipped > 0, failures > 0, failedPaths) in
+ if updatesToDo = 0 then begin
+ display "No updates to propagate\n";
+ (* BCP (3/09): We need to commit the archives even if there are
+ 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 ();
+ (skipped > 0, false, [])
+ end else if proceed=ProceedImmediately then begin
doit()
- else begin
+ end else begin
displayWhenInteractive "\nProceed with propagating updates? ";
selectAction
(* BCP: I find it counterintuitive that every other prompt except this one
Modified: trunk/src/update.ml
===================================================================
--- trunk/src/update.ml 2009-02-13 15:20:07 UTC (rev 317)
+++ trunk/src/update.ml 2009-03-13 02:38:02 UTC (rev 318)
@@ -984,42 +984,61 @@
let immutablenot = Pred.create "immutablenot" ~advanced:true
("This preference overrides {\\tt immutable}.")
-let bigFileLength = 10 * 1024
-let bigFileLengthFS = Uutil.Filesize.ofInt bigFileLength
-let smallFileLength = 1024
-let fileLength = ref 0
-let t0 = ref 0.
+(** Status display **)
-(* Note that we do *not* want to do any status displays from the server
- side, since this will cause the server to block until the client has
- finished its own update detection and can receive and acknowledge
- the status display message -- thus effectively serializing the client
- and server! *)
-let showStatusAddLength info =
- if not !Trace.runningasserver then begin
- let len1 = Props.length info.Fileinfo.desc in
- let len2 = Osx.ressLength info.Fileinfo.osX.Osx.ressInfo in
- if len1 >= bigFileLengthFS || len2 >= bigFileLengthFS then
- fileLength := bigFileLength
- else
- fileLength :=
- min bigFileLength
- (!fileLength + Uutil.Filesize.toInt len1 + Uutil.Filesize.toInt len2)
- end
+(* BCP (3/09) We used to try to be smart about showing status messages
+ at regular intervals, but people seem to find this confusing.
+ Let's replace all this with something simpler -- just show directories as
+ they are scanned... (but I'll leave the code in for now, in case we find
+ we want to restore the old behavior). *)
+(*
+ let bigFileLength = 10 * 1024
+ let bigFileLengthFS = Uutil.Filesize.ofInt bigFileLength
+ let smallFileLength = 1024
+ let fileLength = ref 0
+ let t0 = ref 0.
-let showStatus path =
- if not !Trace.runningasserver then begin
- fileLength := !fileLength + smallFileLength;
- if !fileLength >= bigFileLength then begin
- fileLength := 0;
- let t = Unix.gettimeofday () in
- if t -. !t0 > 0.05 then begin
- Trace.statusDetail ("scanning " ^ Path.toString path);
- t0 := t
+ (* Note that we do *not* want to do any status displays from the server
+ side, since this will cause the server to block until the client has
+ finished its own update detection and can receive and acknowledge
+ the status display message -- thus effectively serializing the client
+ and server! *)
+ let showStatusAddLength info =
+ if not !Trace.runningasserver then begin
+ let len1 = Props.length info.Fileinfo.desc in
+ let len2 = Osx.ressLength info.Fileinfo.osX.Osx.ressInfo in
+ if len1 >= bigFileLengthFS || len2 >= bigFileLengthFS then
+ fileLength := bigFileLength
+ else
+ fileLength :=
+ min bigFileLength
+ (!fileLength + Uutil.Filesize.toInt len1 + Uutil.Filesize.toInt len2)
+ end
+
+ let showStatus path =
+ if not !Trace.runningasserver then begin
+ fileLength := !fileLength + smallFileLength;
+ if !fileLength >= bigFileLength then begin
+ fileLength := 0;
+ let t = Unix.gettimeofday () in
+ if t -. !t0 > 0.05 then begin
+ Trace.statusDetail ("scanning... got to " ^ Path.toString path);
+ t0 := t
+ end
end
end
+*)
+
+let showStatus path = ()
+let showStatusAddLength info = ()
+
+let showStatusDir path =
+ if not !Trace.runningasserver then begin
+ Trace.statusDetail ("scanning... " ^ Path.toString path);
end
+(* ------- *)
+
let symlinkInfo =
Common.Previous (`SYMLINK, Props.dummy, Os.fullfingerprint_dummy, Osx.ressDummy)
@@ -1079,7 +1098,7 @@
(Util.msg "archStamp is ctime (%f)" stamp;
Util.msg " / info.ctime (%f)" info.Fileinfo.ctime)
end;
- Util.msg " / times: %f - %f - %b"
+ Util.msg " / times: %f = %f... %b"
(Props.time archDesc) (Props.time info.Fileinfo.desc)
(Props.same_time info.Fileinfo.desc archDesc);
Util.msg " / lengths: %s - %s"
@@ -1122,10 +1141,15 @@
(Os.fullfingerprint_to_string archDig)
(Os.fullfingerprint_to_string newDigest));
if archDig = newDigest then begin
- Some (ArchiveFile
- (Props.setTime archDesc (Props.time info.Fileinfo.desc),
- archDig, Fileinfo.stamp info, Fileinfo.ressStamp info)),
- checkPropChange info archive archDesc
+ let newprops = Props.setTime archDesc (Props.time info.Fileinfo.desc) in
+ let newarch =
+ ArchiveFile
+
+ (newprops, archDig, Fileinfo.stamp info, Fileinfo.ressStamp info) in
+ debugverbose (fun() ->
+ Util.msg " Contents match: update archive with new time...%f\n"
+ (Props.time newprops));
+ Some newarch, checkPropChange info archive archDesc
end else begin
debug (fun() -> Util.msg " Updated file\n");
None,
@@ -1203,6 +1227,7 @@
fspath path (archChi: archive NameMap.t) fastCheck
: archive NameMap.t option * (Name.t * Common.updateItem) list * bool
=
+ showStatusDir path;
let t = Trace.startTimerQuietly
(Printf.sprintf "checking %s" (Path.toString path)) in
let skip =
More information about the Unison-hackers
mailing list