mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: rfr: print file statistics
Add a listing of changed files after the commit messages similar to how git show --stat would put it. This makes it trivial to see where the changes happened if the commit description doesn't state it. Example from this patch: scripts/rfr | 23 (+20 -3 ) The numbers are padded to a width of three so they line up nicely. Change-Id: Ie62ea6c7d1d3b21446c7447f362d148be3032076 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2020196 GVS: Gerrit_Virtual_Submit Reviewed-by: Philip Elcan <pelcan@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
19f6d90831
commit
05e3be8177
23
scripts/rfr
23
scripts/rfr
@@ -59,7 +59,7 @@ user = os.environ['USER']
|
|||||||
|
|
||||||
# Gerrit query command to obtain the patch URL. The substitution will be the
|
# Gerrit query command to obtain the patch URL. The substitution will be the
|
||||||
# gerrit Change-ID parsed from the git commit message.
|
# gerrit Change-ID parsed from the git commit message.
|
||||||
gr_query_cmd = 'ssh %s@git-master -p 29418 gerrit query --format json %s'
|
gr_query_cmd = 'ssh %s@git-master -p 29418 gerrit query --format json --current-patch-set --files %s'
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
"""
|
"""
|
||||||
@@ -283,7 +283,8 @@ Thanks!
|
|||||||
| {url}
|
| {url}
|
||||||
| Author: {author}
|
| Author: {author}
|
||||||
|
|
||||||
{cmtmsg}"""
|
{cmtmsg}
|
||||||
|
{files}"""
|
||||||
|
|
||||||
cmt_descriptions = ''
|
cmt_descriptions = ''
|
||||||
for c in commits_info:
|
for c in commits_info:
|
||||||
@@ -298,10 +299,26 @@ Thanks!
|
|||||||
|
|
||||||
cmt_verbose = ''
|
cmt_verbose = ''
|
||||||
for c in commits_info:
|
for c in commits_info:
|
||||||
|
# note: x['deletions'] is negative (or zero)
|
||||||
|
files = c['currentPatchSet']['files']
|
||||||
|
width = max([
|
||||||
|
len(x['file']) for x in files if x['file'] != u'/COMMIT_MSG'])
|
||||||
|
file_template = "{name: <{width}} | {sum:<3} (+{adds: <3} -{dels: <3})"
|
||||||
|
files_changed_desc = [file_template.format(
|
||||||
|
name=x['file'],
|
||||||
|
width=width,
|
||||||
|
sum=x['insertions'] - x['deletions'],
|
||||||
|
adds=x['insertions'],
|
||||||
|
dels=-x['deletions'])
|
||||||
|
for x in files
|
||||||
|
if x['file'] != u'/COMMIT_MSG'
|
||||||
|
]
|
||||||
cmt_verbose += cmt_template.format(url=c['url'],
|
cmt_verbose += cmt_template.format(url=c['url'],
|
||||||
author=c['owner']['name'],
|
author=c['owner']['name'],
|
||||||
cmtmsg=indent_lines(
|
cmtmsg=indent_lines(
|
||||||
c['commitMessage'], ' '))
|
c['commitMessage'], ' '),
|
||||||
|
files=' ' + "\n ".join(
|
||||||
|
files_changed_desc))
|
||||||
|
|
||||||
return whole_template.format(cmt_descriptions=cmt_descriptions,
|
return whole_template.format(cmt_descriptions=cmt_descriptions,
|
||||||
extra_message=extra_message,
|
extra_message=extra_message,
|
||||||
|
|||||||
Reference in New Issue
Block a user