summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2015-07-16 11:58:15 +1200
committerRobert Collins <rbtcollins@hp.com>2015-07-16 11:58:15 +1200
commit898f71374ad1fb23a874e7240aa6e85d25e82619 (patch)
tree48ced3cfc4d469b76b0b160d7273bd8c111f5d58
parent5b46cb85740ab8b5d8e8577b75dd9f4f6df29db5 (diff)
downloadpbr-898f71374ad1fb23a874e7240aa6e85d25e82619.tar.gz
Show how long the git querying takes
We get complaints on timing from time to time. Change-Id: I51bb69f413721197dc37e974b596bae4e8b2bce2
-rw-r--r--pbr/git.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pbr/git.py b/pbr/git.py
index ac9ccb1..b4ae300 100644
--- a/pbr/git.py
+++ b/pbr/git.py
@@ -22,6 +22,7 @@ import io
import os
import re
import subprocess
+import time
import pkg_resources
@@ -221,6 +222,7 @@ def _iter_log_inner(git_dir):
def write_git_changelog(git_dir=None, dest_dir=os.path.curdir,
option_dict=dict(), changelog=None):
"""Write a changelog based on the git changelog."""
+ start = time.time()
if not changelog:
changelog = _iter_log_oneline(git_dir=git_dir, option_dict=option_dict)
if changelog:
@@ -236,6 +238,8 @@ def write_git_changelog(git_dir=None, dest_dir=os.path.curdir,
with io.open(new_changelog, "w", encoding="utf-8") as changelog_file:
for release, content in changelog:
changelog_file.write(content)
+ stop = time.time()
+ log.info('[pbr] ChangeLog complete (%0.1fs)' % (stop - start))
def generate_authors(git_dir=None, dest_dir='.', option_dict=dict()):
@@ -244,6 +248,7 @@ def generate_authors(git_dir=None, dest_dir='.', option_dict=dict()):
'SKIP_GENERATE_AUTHORS')
if should_skip:
return
+ start = time.time()
old_authors = os.path.join(dest_dir, 'AUTHORS.in')
new_authors = os.path.join(dest_dir, 'AUTHORS')
# If there's already an AUTHORS file and it's not writable, just use it
@@ -278,3 +283,5 @@ def generate_authors(git_dir=None, dest_dir='.', option_dict=dict()):
new_authors_fh.write(old_authors_fh.read())
new_authors_fh.write(('\n'.join(authors) + '\n')
.encode('utf-8'))
+ stop = time.time()
+ log.info('[pbr] AUTHORS complete (%0.1fs)' % (stop - start))