;;
(* update and checkout *)
-let up_classify line =
+let up_classify line uid =
+ let basedir = (Helm_registry.get "matita.rt_base_dir") ^ "/users/" ^ uid ^ "/" in
let rec aux n acc =
match (line.[n], n) with
- | _, n when n = 4 -> String.sub line 5 ((String.length line) - 5), acc
+ | _, n when n = 4 ->
+ let fn = String.sub line 5 ((String.length line) - 5) in
+ let prefix_len = String.length basedir in
+ let fn_len = String.length fn in
+ if String.sub fn 0 prefix_len = basedir
+ then String.sub fn prefix_len (fn_len - prefix_len), acc
+ else fn, acc
| ' ', _ -> aux (n+1) acc
| 'A',_ when n = 0 || n = 1 -> aux (n+1) (Add::acc)
| 'C',_ when n = 0 || n = 1 -> aux (n+1) (Conflict::acc)
| _ -> raise (SvnAnomaly line)
in aux 0 []
+let matita_flag_of_update fs =
+ if List.mem Conflict fs then Some MConflict
+ else if List.mem Delete fs then None
+ else if List.mem Merge fs then Some MModified
+ else Some MSynchronized
+
(* this should be executed only for a freshly created user so no CS is needed *)
let checkout user =
let rt_dir = Helm_registry.get "matita.rt_base_dir" in
let files, anomalies =
List.fold_left (fun (facc,eacc) line ->
try
- (up_classify line::facc), eacc
+ (up_classify line user::facc), eacc
with
| SvnAnomaly l -> facc, l::eacc) ([],[]) outlines
in
let repo = Helm_registry.get "matita.weblib" in
let errno, outlines, errlines = exec_process
- ("svn up " ^ rt_dir ^ "/users/" ^ user ^ "/")
+ ("svn up " ^ rt_dir ^ "/users/" ^ user ^ "/ --non-interactive")
in
let files, anomalies =
List.fold_left (fun (facc,eacc) line ->
try
- (up_classify line::facc), eacc
+ (let fname,flags = up_classify line user in
+ (fname,matita_flag_of_update flags)::facc), eacc
with
| SvnAnomaly l -> facc, l::eacc) ([],[]) outlines
in