diff options
Diffstat (limited to 'lib/python')
-rwxr-xr-x | lib/python/qmk/cli/doctor/main.py | 7 | ||||
-rw-r--r-- | lib/python/qmk/commands.py | 8 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/doctor/main.py b/lib/python/qmk/cli/doctor/main.py index ed20f46d3..2e5e221e8 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 | |||
11 | from qmk import submodules | 11 | from qmk import submodules |
12 | from qmk.constants import QMK_FIRMWARE, QMK_FIRMWARE_UPSTREAM | 12 | from qmk.constants import QMK_FIRMWARE, QMK_FIRMWARE_UPSTREAM |
13 | from .check import CheckStatus, check_binaries, check_binary_versions, check_submodules | 13 | from .check import CheckStatus, check_binaries, check_binary_versions, check_submodules |
14 | from qmk.commands import git_check_repo, git_get_branch, git_is_dirty, git_get_remotes, git_check_deviation, in_virtualenv | 14 | from qmk.commands import git_check_repo, git_get_branch, git_get_tag, git_is_dirty, git_get_remotes, git_check_deviation, in_virtualenv |
15 | 15 | ||
16 | 16 | ||
17 | def os_tests(): | 17 | def os_tests(): |
@@ -47,6 +47,11 @@ def git_tests(): | |||
47 | git_branch = git_get_branch() | 47 | git_branch = git_get_branch() |
48 | if git_branch: | 48 | if git_branch: |
49 | cli.log.info('Git branch: %s', git_branch) | 49 | cli.log.info('Git branch: %s', git_branch) |
50 | |||
51 | repo_version = git_get_tag() | ||
52 | if repo_version: | ||
53 | cli.log.info('Repo version: %s', repo_version) | ||
54 | |||
50 | git_dirty = git_is_dirty() | 55 | git_dirty = git_is_dirty() |
51 | if git_dirty: | 56 | if git_dirty: |
52 | cli.log.warning('{fg_yellow}Git has unstashed/uncommitted changes.') | 57 | cli.log.warning('{fg_yellow}Git has unstashed/uncommitted changes.') |
diff --git a/lib/python/qmk/commands.py b/lib/python/qmk/commands.py index 5a0194377..90a68ca3c 100644 --- a/lib/python/qmk/commands.py +++ b/lib/python/qmk/commands.py | |||
@@ -295,6 +295,14 @@ def git_get_branch(): | |||
295 | return git_branch.stdout.strip() | 295 | return git_branch.stdout.strip() |
296 | 296 | ||
297 | 297 | ||
298 | def git_get_tag(): | ||
299 | """Returns the current tag for a repo, or None. | ||
300 | """ | ||
301 | git_tag = cli.run(['git', 'describe', '--abbrev=0', '--tags']) | ||
302 | if git_tag.returncode == 0: | ||
303 | return git_tag.stdout.strip() | ||
304 | |||
305 | |||
298 | def git_is_dirty(): | 306 | def git_is_dirty(): |
299 | """Returns 1 if repo is dirty, or 0 if clean | 307 | """Returns 1 if repo is dirty, or 0 if clean |
300 | """ | 308 | """ |