Simple trigger that logs sizes of submitted changelists.
Invoke with
python3 SizeLogger.py <config> <change>
where config is the filename of a config file containing the following two sections:
--------------
[P4]
port=1666
user=tom
password=A154ABF11F094B5D288CA0BE9F6F1086
[Log]
logfile=mylogfile.log
--------------
The P4 connection will use the standard defaults for any parameters not defined (such P4PORT, P4USER)
The default log file is called 'sizes.log'
Since this trigger is based on the standard P4Triggers.py, it will also create a separate log file (p4triggers.log) for any errors
that occur from a connection failure or other exception thrown.
Install this trigger like this in the triggers table:
You need to have P4Triggers.py in the same path as the SizeLogger.py file.
---------
This trigger uses 'p4 describe' to collect all files in the change, filters out any files that do not have 'add' or 'edit' action, and
then sums up the remaining file sizes - so branches and renames are ignored.
The output in the log file is in JSON format for easy parsing.
---------
I also updated P4Triggers.py to add size and digest to the internal stored change