diff options
author | Nick Brassel <nick@tzarc.org> | 2022-07-27 02:37:28 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-26 17:37:28 +0100 |
commit | d1434b6d75865d91b6b6626a06b67e24bd81e145 (patch) | |
tree | b8ef6831fab3353de9e460c23592c4c1ecfab430 /lib/python/qmk/submodules.py | |
parent | 501276a8fd4139e56cb256d110ee2c6d250ce669 (diff) |
Make `qmk doctor` print out the last log entry for upstream/{master,develop}, including dates (#17713)
Diffstat (limited to 'lib/python/qmk/submodules.py')
-rw-r--r-- | lib/python/qmk/submodules.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/python/qmk/submodules.py b/lib/python/qmk/submodules.py index 6a272dae50..3cb232a7b5 100644 --- a/lib/python/qmk/submodules.py +++ b/lib/python/qmk/submodules.py @@ -11,7 +11,11 @@ def status(): { 'name': 'submodule_name', 'status': None/False/True, - 'githash': '<sha-1 hash for the submodule> + 'githash': '<sha-1 hash for the submodule>' + 'shorthash': '<short hash for the submodule>' + 'describe': '<output of `git describe --tags`>' + 'last_log_message': 'log message' + 'last_log_timestamp': 'timestamp' } status is None when the submodule doesn't exist, False when it's out of date, and True when it's current @@ -36,6 +40,26 @@ def status(): else: raise ValueError('Unknown `git submodule status` sha-1 prefix character: "%s"' % status) + submodule_logs = cli.run(['git', 'submodule', '-q', 'foreach', 'git --no-pager log --pretty=format:"$sm_path%x01%h%x01%ad%x01%s%x0A" --date=iso -n1']) + for log_line in submodule_logs.stdout.split('\n'): + if not log_line: + continue + + r = log_line.split('\x01') + submodule = r[0] + submodules[submodule]['shorthash'] = r[1] if len(r) > 1 else '' + submodules[submodule]['last_log_timestamp'] = r[2] if len(r) > 2 else '' + submodules[submodule]['last_log_message'] = r[3] if len(r) > 3 else '' + + submodule_tags = cli.run(['git', 'submodule', '-q', 'foreach', 'echo -n "$sm_path "; git describe --tags']) + for log_line in submodule_tags.stdout.split('\n'): + if not log_line: + continue + + r = log_line.split() + submodule = r[0] + submodules[submodule]['describe'] = r[1] if len(r) > 1 else '' + return submodules |