From 1794324d25a0116b70e8e97b7b163780ac1de764 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 8 Jun 2014 20:40:01 +0200 Subject: adapt for ancient git --- context_mirror_bot.ml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/context_mirror_bot.ml b/context_mirror_bot.ml index 5dc76e2..5da9172 100644 --- a/context_mirror_bot.ml +++ b/context_mirror_bot.ml @@ -42,9 +42,9 @@ type download = { type source_status = Stagnation | New_zip of download -type extract_status = Extract_ignored | Extract_failed of string | Path of download +type extract_status = Extract_ignored of string | Extract_failed of string | Path of download -type import_status = Import_ignored | Import_failed of string | Imported of string +type import_status = Import_ignored of string | Import_failed of string | Imported of string type timestamp_status = Changed of float | Unchanged @@ -55,7 +55,11 @@ exception Bad_env of string exception Prepare_failed of string -let bootstrap_repo = "git://repo.or.cz/context.git" (* Marius’s mirror *) +(* + * let bootstrap_repo = "git://repo.or.cz/context.git" (* Marius’s mirror *) + *) +(* let bootstrap_repo = "git@bb-git-mirror:phg/context-mirror.git" (* our mirror *) *) +let bootstrap_repo = "git@bitbucket.org:phg/context-mirror.git" (* our mirror *) let garden_repo = "http://git.contextgarden.net/context/context.git" (* official, but broken *) (*let mirror_repo = "git@bitbucket.org:phg/context-mirror.git" [> our mirror <]*) let mirror_repo = "git@bb-git-mirror:phg/context-mirror.git" (* our mirror *) @@ -72,7 +76,7 @@ let sources = let bot_owner = "Philipp Gesang" let owner_contact = "phg42.2a@gmail.com" -let repo_root = "/home/phg/src/mirror" +let repo_root = "/home/mirror/mirror" let repo_subdir = "context-git" let repo_dir = Filename.concat repo_root repo_subdir let git_dir = Filename.concat repo_dir ".git" @@ -380,7 +384,8 @@ end = struct let import status = match status with - | Extract_ignored | Extract_failed _ -> Import_ignored + | Extract_ignored msg -> Import_ignored msg + | Extract_failed branch -> Import_ignored (Printf.sprintf "Extracting branch %s failed." branch) | Path { branch = branch; ts = ts; file = _; dst = dst } -> begin ignore (list_of_pipe "git checkout origin"); @@ -405,7 +410,7 @@ end = struct else (* -> git add; git commit *) begin match exec_commands [ - (Printf.sprintf "git add --all %s/" repo_dir); + (Printf.sprintf "git add -A %s/" repo_dir); "git add --update"; ] with | Bad errmsg -> Import_failed errmsg @@ -596,7 +601,7 @@ let retrieve_sources sources = List.map aux sources let handle_zipball = function - | Stagnation -> Extract_ignored + | Stagnation -> Extract_ignored "Nothing todo." | New_zip download -> begin msg (Printf.sprintf "Extracting %s to %s" download.file download.dst); @@ -622,7 +627,7 @@ let usage = Printf.sprintf "Usage: let run_status () = if not (dir_exists repo_dir) then msg ("No directory at " ^ repo_dir) else begin - match list_of_pipe "git branch --all" with + match list_of_pipe "git branch -a" with | None -> msg ("No git repository at " ^ repo_dir) | Some all_branches -> let known = List.fold_left @@ -689,7 +694,8 @@ let run_update () = let _ = List.iter (fun st -> match st with - | Import_ignored | Import_failed _ -> () + | Import_ignored rationale -> msg rationale + | Import_failed errmsg -> err errmsg | Imported br -> msg (Printf.sprintf "Pushing %s to mirror ..." br); match Git.push br with -- cgit v1.2.3