Permalink
Browse files

layer_vcs: add fine grained information about the age of the lines

  • Loading branch information...
1 parent 6c35bb7 commit a358bccbecdb4b4a7ae404a0ef8fb38052cfbfbd @aryx aryx committed Jan 21, 2011
Showing with 28 additions and 18 deletions.
  1. +3 −1 Makefile
  2. +16 −13 h_program-visual/layer_vcs.ml
  3. +5 −2 main_codemap.ml
  4. +1 −0 visual/ui_layers.ml
  5. +3 −2 visual/view2.ml
View
@@ -590,7 +590,7 @@ website:
# Developer rules
##############################################################################
-.PHONY:: tags visual db
+.PHONY:: tags db layers visual
tags:
@@ -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 \
@@ -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 ->
@@ -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;
View
@@ -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
View
@@ -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
View
@@ -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

0 comments on commit a358bcc

Please sign in to comment.