diff options
author | QMK Bot <hello@qmk.fm> | 2022-07-26 16:38:06 +0000 |
---|---|---|
committer | QMK Bot <hello@qmk.fm> | 2022-07-26 16:38:06 +0000 |
commit | 61da9286a16fd2ad056316685e6d465801cdb4cd (patch) | |
tree | 374db8644e4db982f1cf4c00ae93b5db8f0cea35 /lib/python/qmk/submodules.py | |
parent | 0534b878c3750d45309dadfbcdceb66cd743e4da (diff) | |
parent | d1434b6d75865d91b6b6626a06b67e24bd81e145 (diff) |
Merge remote-tracking branch 'origin/master' into develop
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 |