1
0
Fork 0

Make qmk doctor print out the last log entry for upstream/{master,develop}, including dates (#17713)

This commit is contained in:
Nick Brassel 2022-07-27 02:37:28 +10:00 committed by GitHub
parent 501276a8fd
commit d1434b6d75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 69 additions and 2 deletions

View file

@ -62,6 +62,25 @@ def git_get_tag():
return git_tag.stdout.strip()
def git_get_last_log_entry(branch_name):
"""Retrieves the last log entry for the branch being worked on.
"""
git_lastlog = cli.run(['git', '--no-pager', 'log', '--pretty=format:%ad (%h) -- %s', '--date=iso', '-n1', branch_name])
if git_lastlog.returncode == 0 and git_lastlog.stdout:
return git_lastlog.stdout.strip()
def git_get_common_ancestor(branch_a, branch_b):
"""Retrieves the common ancestor between for the two supplied branches.
"""
git_merge_base = cli.run(['git', 'merge-base', branch_a, branch_b])
git_branchpoint_log = cli.run(['git', '--no-pager', 'log', '--pretty=format:%ad (%h) -- %s', '--date=iso', '-n1', git_merge_base.stdout.strip()])
if git_branchpoint_log.returncode == 0 and git_branchpoint_log.stdout:
return git_branchpoint_log.stdout.strip()
def git_get_remotes():
"""Returns the current remotes for a repo.
"""