Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Commit

Permalink
layer_vcs: add fine grained information about the age of the lines
Browse files Browse the repository at this point in the history
  • Loading branch information
pad committed Jan 21, 2011
1 parent 6c35bb7 commit a358bcc
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 18 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ website:
# Developer rules
##############################################################################

.PHONY:: tags visual db
.PHONY:: tags db layers visual


tags:
Expand All @@ -600,6 +600,8 @@ db:
layers:
./pfff_db_heavy -gen_age_layer /home/pad/local/pfff-for-layers \
layer_age.marshall
./pfff_db_heavy -gen_age_layer /home/pad/local/pfff-for-layers \
layer_age.json

visual:
./codemap -profile -ss 2 \
Expand Down
29 changes: 16 additions & 13 deletions h_program-visual/layer_vcs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,12 @@ let gen_age_layer dir ~output =
*)
+> List.tl
in
let now_dmy =
Common.today ()
+> Common.floattime_to_unixtime +> Common.unixtime_to_dmy
in

let property =
let max_age =
match annots with
| [] -> "no info"
| xs ->
Expand All @@ -185,28 +189,27 @@ let gen_age_layer dir ~output =
+> List.map (fun (_version, Lib_vcs.Author _, date_dmy) -> date_dmy)
+> Common.maximum_dmy
in
pr2_gen max_date_dmy;
let now_dmy =
Common.today ()
+> Common.floattime_to_unixtime +> Common.unixtime_to_dmy
in

let age_in_days =
Common.rough_days_between_dates max_date_dmy now_dmy
in
pr2_gen max_date_dmy;
pr2_gen age_in_days;

property_of_age age_in_days
in

readable_file,
{ Layer_code.
(* don't display anything at the line microlevel for now.
* could display the age of each line.
*)
micro_level = [];

macro_level = [property, 1.];
micro_level =
annots +> Common.index_list_1 +> List.map
(fun ((_version, Lib_vcs.Author _, date_dmy), i) ->
let age_in_days =
Common.rough_days_between_dates date_dmy now_dmy
in
i, property_of_age age_in_days
);

macro_level = [max_age, 1.];
}
);
kinds = properties_age;
Expand Down
7 changes: 5 additions & 2 deletions main_codemap.ml
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,11 @@ let main_action xs =
Layer_code.build_index_of_layers
~root
(match layers with
| [layer] -> [layer, true]
| _ -> layers +> List.map (fun x -> x, false)
| [layer] ->
(* not active by default. it causes some problems *)
[layer, false]
| _ ->
layers +> List.map (fun x -> x, false)
)
in

Expand Down
1 change: 1 addition & 0 deletions visual/ui_layers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ open Model2
(*****************************************************************************)

let choose_layer ~root layer_title_opt dw_ref =
pr2 "choose_layer()";
let dw = !dw_ref in

let original_layers = dw.M.layers.L.layers +> List.map fst in
Expand Down
5 changes: 3 additions & 2 deletions visual/view2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ let mk_gui ~screen_size test_mode (root, model, dw, dbfile_opt) =
let layers =
!dw.layers.Layer_code.layers +> List.map (fun (layer, active) ->
(layer.Layer_code.title, active, (fun b ->
Ui_layers.choose_layer ~root:(root_orig())
(Some layer.Layer_code.title) dw;
if b then
Ui_layers.choose_layer ~root:(root_orig())
(Some layer.Layer_code.title) dw;
))
)
in
Expand Down

0 comments on commit a358bcc

Please sign in to comment.