summaryrefslogtreecommitdiffstats
path: root/lib/python/qmk/cli/doctor/main.py
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2022-07-26 16:38:06 +0000
committerQMK Bot <hello@qmk.fm>2022-07-26 16:38:06 +0000
commit61da9286a16fd2ad056316685e6d465801cdb4cd (patch)
tree374db8644e4db982f1cf4c00ae93b5db8f0cea35 /lib/python/qmk/cli/doctor/main.py
parent0534b878c3750d45309dadfbcdceb66cd743e4da (diff)
parentd1434b6d75865d91b6b6626a06b67e24bd81e145 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'lib/python/qmk/cli/doctor/main.py')
-rwxr-xr-xlib/python/qmk/cli/doctor/main.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/doctor/main.py b/lib/python/qmk/cli/doctor/main.py
index 2898a9894c..1600ab8dd4 100755
--- a/lib/python/qmk/cli/doctor/main.py
+++ b/lib/python/qmk/cli/doctor/main.py
@@ -11,7 +11,7 @@ from milc.questions import yesno
from qmk import submodules
from qmk.constants import QMK_FIRMWARE, QMK_FIRMWARE_UPSTREAM
from .check import CheckStatus, check_binaries, check_binary_versions, check_submodules
-from qmk.git import git_check_repo, git_get_branch, git_get_tag, git_is_dirty, git_get_remotes, git_check_deviation
+from qmk.git import git_check_repo, git_get_branch, git_get_tag, git_get_last_log_entry, git_get_common_ancestor, git_is_dirty, git_get_remotes, git_check_deviation
from qmk.commands import in_virtualenv
@@ -66,10 +66,32 @@ def git_tests():
if git_branch in ['master', 'develop'] and git_deviation:
cli.log.warning('{fg_yellow}The local "%s" branch contains commits not found in the upstream branch.', git_branch)
status = CheckStatus.WARNING
+ for branch in [git_branch, 'upstream/master', 'upstream/develop']:
+ cli.log.info('- Latest %s: %s', branch, git_get_last_log_entry(branch))
+ for branch in ['upstream/master', 'upstream/develop']:
+ cli.log.info('- Common ancestor with %s: %s', branch, git_get_common_ancestor(branch, 'HEAD'))
return status
+def output_submodule_status():
+ """Prints out information related to the submodule status.
+ """
+ cli.log.info('Submodule status:')
+ sub_status = submodules.status()
+ for s in sub_status.keys():
+ sub_info = sub_status[s]
+ if 'name' in sub_info:
+ sub_name = sub_info['name']
+ sub_shorthash = sub_info['shorthash'] if 'shorthash' in sub_info else ''
+ sub_describe = sub_info['describe'] if 'describe' in sub_info else ''
+ sub_last_log_timestamp = sub_info['last_log_timestamp'] if 'last_log_timestamp' in sub_info else ''
+ if sub_last_log_timestamp != '':
+ cli.log.info(f'- {sub_name}: {sub_last_log_timestamp} -- {sub_describe} ({sub_shorthash})')
+ else:
+ cli.log.error(f'- {sub_name}: <<< missing or unknown >>>')
+
+
@cli.argument('-y', '--yes', action='store_true', arg_only=True, help='Answer yes to all questions.')
@cli.argument('-n', '--no', action='store_true', arg_only=True, help='Answer no to all questions.')
@cli.subcommand('Basic QMK environment checks')
@@ -129,6 +151,8 @@ def doctor(cli):
elif sub_ok == CheckStatus.WARNING and status == CheckStatus.OK:
status = CheckStatus.WARNING
+ output_submodule_status()
+
# Report a summary of our findings to the user
if status == CheckStatus.OK:
cli.log.info('{fg_green}QMK is ready to go')