Index: git-viz-0.1/git.ml
===================================================================
--- git-viz-0.1.orig/git.ml	2005-06-14 02:36:57.000000000 +0200
+++ git-viz-0.1/git.ml	2005-06-17 09:06:57.729027488 +0200
@@ -37,18 +37,18 @@
   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 =
@@ -85,14 +85,14 @@
   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
@@ -129,14 +129,14 @@
 
 
 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
@@ -144,7 +144,7 @@
       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
@@ -161,10 +161,38 @@
 	"*%_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
@@ -177,7 +205,7 @@
   | '*' ->
       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) = 
@@ -216,7 +244,7 @@
       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
@@ -298,10 +326,10 @@
 	cb (`SUB_PROC_ERROR "Diffs are not suported with git yet") ;
 	false))
   | `PASKY ->
-      let cmd = [ "git"; "diff"; parent; child] in
+      let cmd = [ "cg-diff"; "-r"; parent^":"^child ] in
       log "exec" "### exec: Running '%s'" (String.concat " " cmd) ;
       try
-	status#push "Running git diff ..." ;
+	status#push "Running cg-diff ..." ;
 	ignore (
 	Subprocess.spawn_out 
 	  ~working_directory:d.base
@@ -311,10 +339,10 @@
 	    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) ->
