The unified diff between revisions [f9bf0ab9..] and [23b40306..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'unidiff.ml'
#
#
# patch "unidiff.ml"
# from [adba6e0ccf2cd60de8b72a8a1126398839104791]
# to [5b365e84428d582c26bc14e5ae1c4c3f7d62abea]
#
============================================================
--- unidiff.ml adba6e0ccf2cd60de8b72a8a1126398839104791
+++ unidiff.ml 5b365e84428d582c26bc14e5ae1c4c3f7d62abea
@@ -43,11 +43,15 @@ let analyze_diff_output text =
Q.list_fold
(fun q (n, s, len) ->
if is_prefix "--- " text s
+ then Q.push q (HEADER n)
+ else if is_prefix "+++ " text s
then begin
- let filename = String.sub text (s + 4) (len - 4) in
- Q.push_list q [ HEADER n ; FILE (filename, n) ] end
- else if is_prefix "+++ " text s
- then Q.push q (HEADER n)
+ let filename =
+ let re = Str.regexp "[0-9a-f]+/\\(.*\\) (" in
+ if Str.string_match re text (s + 4)
+ then Str.matched_group 1 text
+ else String.sub text (s + 4) (len - 4) in
+ Q.push_list q [ HEADER n ; FILE (filename, n - 1) ] end
else if is_prefix "@@ " text s
then Q.push q (HUNK n)
else if is_prefix "-" text s
@@ -85,7 +89,7 @@ let save_dialog parent text =
let s = GWindow.file_chooser_dialog
~action:`SAVE ~parent
~destroy_with_parent:true
- ~title:"Save monotone diff output" () in
+ ~title:"Save git diff output" () in
s#add_button_stock `CANCEL `CANCEL ;
s#add_select_button_stock `SAVE `SAVE ;
s#set_default_response `SAVE ;
@@ -98,13 +102,13 @@ let save_dialog parent text =
with_file_out
(fun oc -> output_string oc text) f
with Sys_error _ ->
- Viz_types.errorf "Could not write monotone diff output to '%s'" f)) ;
+ Viz_types.errorf "Could not write git diff output to '%s'" f)) ;
s
let view_diff ?parent (junk_end, tags_coords) text orig_text =
let window = GWindow.dialog
~no_separator:true ?parent
- ~title:"Monotone diff output"
+ ~title:"Git diff output"
~type_hint:`NORMAL
~icon:(Lazy.force Icon.monotone) () in
window#add_button_stock `SAVE `SAVE ;
@@ -216,6 +220,6 @@ let view ~parent text =
~buttons:GWindow.Buttons.close
?parent
~destroy_with_parent:true
- ~title:"Monotone diff output" () in
+ ~title:"Git diff output" () in
ignore (d#connect#response (fun _ -> d#destroy ())) ;
d#show ()