The unified diff between revisions [752f293e..] and [701974ae..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "git.ml"
# from [7278a18d00d1bc0346bd0e613513f13ac01f6053]
# to [1ac29b80d560eea36462e65f6fbcfc3c6715da38]
#
============================================================
--- git.ml 7278a18d00d1bc0346bd0e613513f13ac01f6053
+++ git.ml 1ac29b80d560eea36462e65f6fbcfc3c6715da38
@@ -43,18 +43,18 @@ let fetch_tags git_dir =
with _ -> []
let fetch_tags git_dir =
- fetch_dir_of_ids git_dir "tags"
+ fetch_dir_of_ids git_dir "refs/tags"
let fetch_history base id =
- log "exec" "### exec: Running rev-tree %s'" id ;
+ log "exec" "### exec: Running git-rev-tree %s'" id ;
match Gspawn.sync
~working_directory:base
~flags:[`SEARCH_PATH]
- ["rev-tree"; id] with
+ ["git-rev-tree"; id] with
| Gspawn.EXITSTATUS 0, stdout, _ ->
stdout
| _, _, stderr ->
- Viz_types.errorf "rev-tree invocation failed: '%s'" stderr
+ Viz_types.errorf "git-rev-tree invocation failed: '%s'" stderr
let scan_history data =
@@ -91,14 +91,14 @@ let fetch_commit_object base id =
proc Viz_types.empty_agraph 0
let fetch_commit_object base id =
- log "exec" "### exec: Running 'cat-file commit %s'" id ;
+ log "exec" "### exec: Running 'git-cat-file commit %s'" id ;
match Gspawn.sync
~working_directory:base
~flags:[`SEARCH_PATH]
- ["cat-file"; "commit"; id] with
+ ["git-cat-file"; "commit"; id] with
| Gspawn.EXITSTATUS 0, stdout, _ -> stdout
| _, _, stderr ->
- Viz_types.errorf "cat-file invocation failed: '%s'" stderr
+ Viz_types.errorf "git-cat-file invocation failed: '%s'" stderr
let scan_commit_object co =
let tree = ref "" in
@@ -135,14 +135,14 @@ let fetch_changeset base old_id new_id =
let fetch_changeset base old_id new_id =
- log "exec" "### exec: Running 'diff-tree %s %s'" old_id new_id ;
+ log "exec" "### exec: Running 'git-diff-tree -r %s %s'" old_id new_id ;
let tmp_file = Filename.temp_file "git-viz_" ".diff-tree" in
match
Gspawn.sync
~working_directory:base
~flags:[]
["/bin/sh"; "-c";
- Printf.sprintf "diff-tree '%s' '%s' > %s" old_id new_id (Filename.quote tmp_file) ]
+ Printf.sprintf "git-diff-tree -r '%s' '%s' > %s" old_id new_id (Filename.quote tmp_file) ]
with
| Gspawn.EXITSTATUS 0, _, _ ->
let stdout = with_file_in input_channel tmp_file in
@@ -150,7 +150,7 @@ let fetch_changeset base old_id new_id =
stdout
| _, _, stderr ->
Sys.remove tmp_file ;
- Viz_types.errorf "diff-tree invocation failed:\n'%s'" stderr
+ Viz_types.errorf "git-diff-tree invocation failed:\n'%s'" stderr
let scan_change_linus l =
let b = Scanf.Scanning.from_string l in
@@ -167,10 +167,38 @@ let scan_change_linus l =
"*%_o->%_o %40[0-9a-f]->%40[0-9a-f] %n"
(fun id1 id2 s -> Revision_types.PATCH (string_slice ~s:(s-1) l, id1, id2))
| _ ->
- failwith "Could not parse changeset"
+ failwith ("Could not parse changeset1 "^l)
let scan_change_pasky l =
let a = Array.of_list (string_split '\t' l) in
+ let b = Array.of_list (string_split ' ' a.(0)) in
+ (* 0: file
+ 2: symlink
+ 4: dir
+ *)
+ match b.(4).[0] with
+ | 'N' ->
+ begin
+ match b.(1).[1] with
+ | '4' -> Revision_types.ADD_FILE a.(1)
+ | '2' -> Revision_types.ADD_FILE a.(1)
+ | '0' -> Revision_types.ADD_FILE a.(1)
+ | _ -> failwith ("Adding unknown mode "^b.(1))
+ end
+ | 'M' -> Revision_types.PATCH (a.(1), b.(2), b.(3))
+ | 'D' ->
+ begin
+ match b.(0).[2] with
+ | '4' -> Revision_types.DELETE_DIR a.(1)
+ | '2' -> Revision_types.DELETE_FILE a.(1)
+ | '0' -> Revision_types.DELETE_FILE a.(1)
+ | _ -> failwith ("Removing unknown mode "^b.(0))
+ end
+ | _ ->
+ failwith ("Could not parse changeset2 l: "^l^"\nb.(4): "^b.(4))
+
+let scan_change_pasky_orig l =
+ let a = Array.of_list (string_split '\t' l) in
match l.[0] with
| '+' | '-' ->
begin
@@ -183,7 +211,7 @@ let scan_change_pasky l =
| '*' ->
Revision_types.PATCH (a.(3), string_slice ~e:40 a.(2), string_slice ~s:(-40) a.(2))
| _ ->
- failwith "Could not parse changeset"
+ failwith ("Could not parse changeset2 "^l)
let get_changes k base id1 id2 =
let (sep, scan_fun) =
@@ -222,7 +250,7 @@ let open_db db_name =
get_commit = get_commit ;
get_changeset = get_changeset ;
tags = fetch_tags d ;
- branches = fetch_dir_of_ids d "heads"
+ branches = fetch_dir_of_ids d "refs/heads"
}
with Failure _ | Sys_error _ ->
Viz_types.errorf "Not a git db: %s" db_name
@@ -304,12 +332,12 @@ let run_monotone_diff d exe (parent, chi
cb (`SUB_PROC_ERROR "Diffs are not suported with git yet") ;
false))
| `PASKY ->
- let cmd = [ "git"; "diff"; "-r"; parent; "-r"; child] in
+ let cmd = [ "cg-diff"; "-r"; parent^":"^child ] in
log "exec" "### exec: Running '%s'" (String.concat " " cmd) ;
let error fmt =
Printf.kprintf (fun s -> cb (`SUB_PROC_ERROR s)) fmt in
try
- status#push "Running git diff ..." ;
+ status#push "Running cg-diff ..." ;
ignore (
Subprocess.spawn_out
~working_directory:d.base
@@ -319,10 +347,10 @@ let run_monotone_diff d exe (parent, chi
if status <> 0 then
if stderr = ""
then
- error "git diff exited with status %d:\n%s" status
+ error "cg-diff exited with status %d:\n%s" status
(String.concat "\n" (List.map Printexc.to_string exceptions))
else
- error "git diff error:\n%s" stderr
+ error "cg-diff error:\n%s" stderr
else
cb (`DIFF stdout)))
with Gspawn.Error (_, msg) ->