summaryrefslogtreecommitdiffstats
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:50:37 +0000
commit1c88db7a1c071fa00bcbba14c89e1c54b21c1948 (patch)
tree1c5e8be698d5b643df59e22a101fdc965beb99e3 /scripts
parentc1058ac4f2441e017098a1a4f27bbecb407bb3a8 (diff)
downloadpoky-1c88db7a1c071fa00bcbba14c89e1c54b21c1948.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). (From OE-Core rev: 4208f1546c92f069e432d1865269ce539db8cea7) 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():
53 parser.add_argument('-e', '--exclude-path', 53 parser.add_argument('-e', '--exclude-path',
54 action='append', 54 action='append',
55 help="Exclude path from the output") 55 help="Exclude path from the output")
56 parser.add_argument('-c', '--colour',
57 choices=('yes', 'no', 'auto'),
58 default="auto",
59 help="Whether to colourise (defaults to auto)")
56 parser.add_argument('revisions', 60 parser.add_argument('revisions',
57 default = ['build-minus-1', 'HEAD'], 61 default = ['build-minus-1', 'HEAD'],
58 nargs='*', 62 nargs='*',
@@ -107,10 +111,11 @@ def main():
107 elif len(args.revisions) == 2: 111 elif len(args.revisions) == 2:
108 fromrev, torev = args.revisions 112 fromrev, torev = args.revisions
109 113
110 from oe.buildhistory_analysis import process_changes 114 from oe.buildhistory_analysis import init_colours, process_changes
111
112 import gitdb 115 import gitdb
113 116
117 init_colours({"yes": True, "no": False, "auto": sys.stdout.isatty()}[args.colour])
118
114 try: 119 try:
115 changes = process_changes(args.buildhistory_dir, fromrev, torev, 120 changes = process_changes(args.buildhistory_dir, fromrev, torev,
116 args.report_all, args.report_ver, args.sigs, 121 args.report_all, args.report_ver, args.sigs,