(************************************************************ commit_known_files.ml Created : Wed Oct 29 01:40:38 2003 Last modified: Wed Oct 29 02:05:22 2003 Compile: ocamlc -dtypes unix.cma commit_known_files.ml -o commit_known_files # FTP Directory: sources/ocaml # ************************************************************) (** @author Takashi Masuyama *) let cvs_get_modified_files () = let in_channel = Unix.open_process_in "cvs -n update" in let rec iter () = try let line = input_line in_channel in if line.[0] = 'M' then (String.sub line 2 ((String.length line)-2))::(iter ()) else (iter ()) with End_of_file -> [] in let result = iter () in close_in in_channel; result ;; let commit_modified_files () = let modified_files = cvs_get_modified_files () in let target_file_string = List.fold_right (fun x s -> x^" "^s) modified_files "" in let command = "cvs commit -m \"\""^target_file_string in print_endline ("commit: "^target_file_string); Unix.system command ;; let _ = commit_modified_files () ;;