Show git info

Print information about the tested change.

Change-Id: I0f086cbc9e136cfa2245e4b546621f559c315ec8
This commit is contained in:
Andreas Jaeger 2014-05-18 18:39:56 +02:00
parent b62e875bb1
commit 0a5f6a54ca
2 changed files with 25 additions and 0 deletions

View File

@ -97,6 +97,11 @@ sufficient for many of the books.
Release notes
=============
0.15
----
* ``openstack-doc-tools``: Output information about tested patch.
0.14
----

View File

@ -642,6 +642,25 @@ def get_gitroot():
return gitroot
def print_gitinfo():
"""Print information about repository and change."""
try:
git_cmd = ["git", "rev-parse", "--abbrev-ref", "HEAD"]
gitbranch = check_output(git_cmd).rstrip()
git_cmd = ["git", "show", "--format=%s", "-s"]
gitsubject = check_output(git_cmd).rstrip()
git_cmd = ["git", "show", "--format=%an", "-s"]
gitauthor = check_output(git_cmd).rstrip()
except (subprocess.CalledProcessError, OSError) as e:
print("git failed: %s" % e)
sys.exit(1)
print("Testing patch:")
print(" Title: %s" % gitsubject)
print(" Author: %s" % gitauthor)
print(" Branch: %s" % gitbranch)
def get_publish_path():
"""Return path to use of publishing books."""
@ -1378,6 +1397,7 @@ def doctest():
print ("\nOpenStack Doc Checks (using openstack-doc-tools version %s)\n"
% os_doc_tools.__version__)
print_gitinfo()
handle_options()
doc_path = get_gitroot()