[Unison-hackers] [unison-svn] r451 - trunk/src
bcpierce@seas.upenn.edu
bcpierce at seas.upenn.edu
Sun May 30 10:42:00 EDT 2010
Author: bcpierce
Date: 2010-05-30 10:42:00 -0400 (Sun, 30 May 2010)
New Revision: 451
Modified:
trunk/src/RECENTNEWS
trunk/src/mkProjectInfo.ml
trunk/src/uitext.ml
Log:
* Unison now passes path arguments and --follow directives to
fsmonitor.py. This seems to work except for one small issue with
how fsmonitor.py treats --follow directives for directories that
don't exist (or maybe this is an issue with how it treats any kind
of monitoring when the thing being monitored doesn't exist?). If I
create a symlink to a nonexistant directory, give Unison (hence
fsmonitor.py) a 'follow' directive for the symlink, start unison, and
*then* create the directory, fsmonitor.py misses the change.
Modified: trunk/src/RECENTNEWS
===================================================================
--- trunk/src/RECENTNEWS 2010-05-30 14:03:33 UTC (rev 450)
+++ trunk/src/RECENTNEWS 2010-05-30 14:42:00 UTC (rev 451)
@@ -1,5 +1,21 @@
CHANGES FROM VERSION 2.40.16
+* Unison now passes path arguments and --follow directives to
+ fsmonitor.py. This seems to work except for one small issue with
+ how fsmonitor.py treats --follow directives for directories that
+ don't exist (or maybe this is an issue with how it treats any kind
+ of monitoring when the thing being monitored doesn't exist?). If I
+ create a symlink to a nonexistant directory, give Unison (hence
+ fsmonitor.py) a 'follow' directive for the symlink, start unison, and
+ *then* create the directory, fsmonitor.py misses the change.
+
+
+
+
+
+-------------------------------
+CHANGES FROM VERSION 2.40.16
+
* More progress on file watching
* Add external fsmonitor.py script to svn repo
Modified: trunk/src/mkProjectInfo.ml
===================================================================
--- trunk/src/mkProjectInfo.ml 2010-05-30 14:03:33 UTC (rev 450)
+++ trunk/src/mkProjectInfo.ml 2010-05-30 14:42:00 UTC (rev 451)
@@ -98,3 +98,4 @@
Printf.printf "NAME=%s\n" projectName;;
+
Modified: trunk/src/uitext.ml
===================================================================
--- trunk/src/uitext.ml 2010-05-30 14:03:33 UTC (rev 450)
+++ trunk/src/uitext.ml 2010-05-30 14:42:00 UTC (rev 451)
@@ -707,31 +707,37 @@
let watcherTemp r n =
let s = n ^ (Update.archiveHash (Fspath.canonize (Some r))) in
Os.fileInUnisonDir s
- (* Fspath.toSysPath
- (Fspath.concat r (Os.tempPath r (Path.child Path.empty (Name.fromString s)))) *)
let watchercmd r =
- (* FIX: need to include --follow and path parameters *)
+ (* FIX: is the quoting of --follow parameters going to work on Win32? *)
(* FIX -- need to find the program using watcherosx preference *)
let root = Common.root2string r in
let changefile = watcherTemp root "changes" in
let statefile = watcherTemp root "state" in
- let cmd = Printf.sprintf "fsmonitor.py --outfile %s --statefile %s %s\n"
- (System.fspathToPrintString changefile)
- (System.fspathToPrintString statefile)
- root in
- debug (fun() -> Util.msg "change command: %s\n" cmd);
+ let paths = Safelist.map Path.toString (Prefs.read Globals.paths) in
+ let followpaths = Pred.extern Path.followPred in
+ let follow = Safelist.map (fun s -> "--follow '"^s^"'") followpaths in
+ let cmd = Printf.sprintf "fsmonitor.py %s --outfile %s --statefile %s %s %s\n"
+ root
+ (System.fspathToPrintString changefile)
+ (System.fspathToPrintString statefile)
+ (String.concat " " follow)
+ (String.concat " " paths) in
+ debug (fun() -> Util.msg "watchercmd = %s\n" cmd);
(changefile,cmd)
-module RootMap = Map.Make (struct type t = Common.root let compare = Pervasives.compare end)
+module RootMap = Map.Make (struct type t = Common.root
+ let compare = Pervasives.compare
+ end)
type watcherinfo = {file: System.fspath;
ch:Pervasives.in_channel option ref;
chars: string ref;
lines: string list ref}
let watchers : watcherinfo RootMap.t ref = ref RootMap.empty
-(* FIX; Using string concatenation to accumulate characters is
- pretty inefficient! *)
+(* FIX: Using string concatenation to accumulate characters is
+ a bit inefficient! Not sure how much it matters in the grand scheme,
+ though... *)
let getAvailableLinesFromWatcher wi =
let ch = match !(wi.ch) with Some(c) -> c | None -> assert false in
let rec loop () =
More information about the Unison-hackers
mailing list