2727
2828from collections import OrderedDict
2929
30+ from datetime import datetime
31+
3032import click
3133import simplejson
3234
@@ -63,15 +65,20 @@ def print_version(ctx, param, value):
6365 click .echo ('DeltaCode version ' + __version__ )
6466 ctx .exit ()
6567
66- def print_summary (new ,old ,deltas_count ):
68+ def print_summary (deltacode , new , old , deltas_count , start_timestamp , end_timestamp ):
6769 click .echo (click .style ('Delta check done.' , fg = 'green' ))
6870 if deltas_count == 0 :
6971 click .echo ('Summary: The two codebases are identical.' )
7072 else :
7173 click .echo ('Summary: The two codebases differ.' )
7274 click .echo ('New file: {}' .format (new ))
7375 click .echo ('Old file: {}' .format (old ))
74- click .echo ('Deltas count: {}' .format (deltas_count ))
76+ click .echo ('Delta counts: ' )
77+ for st in deltacode .stats .to_dict ():
78+ click .echo (' {}: {}' .format (str (st ),deltacode .stats .to_dict ()[st ]))
79+ click .echo ('Timings: ' )
80+ click .echo (' delta_start: {}' .format (start_timestamp ))
81+ click .echo (' delta_end: {}' .format (end_timestamp ))
7582 click .echo (click .style ('For more information check out the json file.' , fg = 'green' ))
7683
7784@click .command ()
@@ -96,12 +103,18 @@ def cli(new, old, json_file, all_delta_types):
96103 ('--all-delta-types' , all_delta_types )
97104 ])
98105
106+ # get time before delta
107+ start_timestamp = datetime .now ()
108+
99109 # do the delta
100110 deltacode = DeltaCode (new , old , options )
101111
112+ # get time after delta
113+ end_timestamp = datetime .now ()
114+
102115 # generate JSON output
103116 write_json (deltacode , json_file , all_delta_types )
104117
105118 # show limited delta status
106119 deltas_count = len ([d for d in deltas (deltacode , all_delta_types )])
107- print_summary (new ,old ,deltas_count )
120+ print_summary (deltacode , new , old , deltas_count , start_timestamp , end_timestamp )
0 commit comments