aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2018-01-17 17:11:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-01-18 12:49:22 +0000
commit4208f1546c92f069e432d1865269ce539db8cea7 (patch)
treeccda7028b7a6f37104ee4db8f5f6fdb41d437298 /scripts
parent3905ae20330f204f3c8997e2d5aaf15dcf5a860c (diff)
downloadopenembedded-core-contrib-4208f1546c92f069e432d1865269ce539db8cea7.tar.gz
buildhistory-diff: add support for colourising the output
Colour value removes in red and additions in green, making it easier to scan the output for relevant changes. This adds a --colour option to specify whether colouring should be on, off, or detected. The default is detected, and depends on whether stdout is a TTY (same behaviour as git). Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/buildhistory-diff9
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/buildhistory-diff b/scripts/buildhistory-diff
index e79cb7ac8d..27974072fc 100755
--- a/scripts/buildhistory-diff
+++ b/scripts/buildhistory-diff
@@ -53,6 +53,10 @@ def get_args_parser():
parser.add_argument('-e', '--exclude-path',
action='append',
help="Exclude path from the output")
+ parser.add_argument('-c', '--colour',
+ choices=('yes', 'no', 'auto'),
+ default="auto",
+ help="Whether to colourise (defaults to auto)")
parser.add_argument('revisions',
default = ['build-minus-1', 'HEAD'],
nargs='*',
@@ -107,10 +111,11 @@ def main():
elif len(args.revisions) == 2:
fromrev, torev = args.revisions
- from oe.buildhistory_analysis import process_changes
-
+ from oe.buildhistory_analysis import init_colours, process_changes
import gitdb
+ init_colours({"yes": True, "no": False, "auto": sys.stdout.isatty()}[args.colour])
+
try:
changes = process_changes(args.buildhistory_dir, fromrev, torev,
args.report_all, args.report_ver, args.sigs,