Progress output now includes repository name (#24).
The name of the repository is only printed when multiple repositories are specified. Otherwise, gitinspector falls back to the previous behavior
This commit is contained in:
parent
7dda8d34b5
commit
9ada057d81
|
@ -121,13 +121,17 @@ class BlameThread(threading.Thread):
|
||||||
PROGRESS_TEXT = N_("Checking how many rows belong to each author (2 of 2): {0:.0f}%")
|
PROGRESS_TEXT = N_("Checking how many rows belong to each author (2 of 2): {0:.0f}%")
|
||||||
|
|
||||||
class Blame(object):
|
class Blame(object):
|
||||||
def __init__(self, hard, useweeks, changes):
|
def __init__(self, repo, hard, useweeks, changes):
|
||||||
self.blames = {}
|
self.blames = {}
|
||||||
ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
|
ls_tree_r = subprocess.Popen(["git", "ls-tree", "--name-only", "-r", interval.get_ref()], bufsize=1,
|
||||||
stdout=subprocess.PIPE).stdout
|
stdout=subprocess.PIPE).stdout
|
||||||
lines = ls_tree_r.readlines()
|
lines = ls_tree_r.readlines()
|
||||||
ls_tree_r.close()
|
ls_tree_r.close()
|
||||||
|
|
||||||
|
progress_text = _(PROGRESS_TEXT)
|
||||||
|
if repo != None:
|
||||||
|
progress_text = "[%s] " % repo.name + progress_text
|
||||||
|
|
||||||
for i, row in enumerate(lines):
|
for i, row in enumerate(lines):
|
||||||
row = row.strip().decode("unicode_escape", "ignore")
|
row = row.strip().decode("unicode_escape", "ignore")
|
||||||
row = row.encode("latin-1", "replace")
|
row = row.encode("latin-1", "replace")
|
||||||
|
@ -142,7 +146,7 @@ class Blame(object):
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
||||||
if format.is_interactive_format():
|
if format.is_interactive_format():
|
||||||
terminal.output_progress(_(PROGRESS_TEXT), i, len(lines))
|
terminal.output_progress(progress_text, i, len(lines))
|
||||||
|
|
||||||
# Make sure all threads have completed.
|
# Make sure all threads have completed.
|
||||||
for i in range(0, NUM_THREADS):
|
for i in range(0, NUM_THREADS):
|
||||||
|
|
|
@ -181,7 +181,7 @@ class Changes(object):
|
||||||
authors_by_email = {}
|
authors_by_email = {}
|
||||||
emails_by_author = {}
|
emails_by_author = {}
|
||||||
|
|
||||||
def __init__(self, hard):
|
def __init__(self, repo, hard):
|
||||||
self.commits = []
|
self.commits = []
|
||||||
git_log_hashes_r = subprocess.Popen(filter(None, ["git", "rev-list", "--reverse", "--no-merges",
|
git_log_hashes_r = subprocess.Popen(filter(None, ["git", "rev-list", "--reverse", "--no-merges",
|
||||||
interval.get_since(), interval.get_until(), "HEAD"]), bufsize=1,
|
interval.get_since(), interval.get_until(), "HEAD"]), bufsize=1,
|
||||||
|
@ -190,6 +190,10 @@ class Changes(object):
|
||||||
git_log_hashes_r.close()
|
git_log_hashes_r.close()
|
||||||
|
|
||||||
if len(lines) > 0:
|
if len(lines) > 0:
|
||||||
|
progress_text = _(PROGRESS_TEXT)
|
||||||
|
if repo != None:
|
||||||
|
progress_text = "[%s] " % repo.name + progress_text
|
||||||
|
|
||||||
self.commits = [None] * (len(lines) // CHANGES_PER_THREAD + 1)
|
self.commits = [None] * (len(lines) // CHANGES_PER_THREAD + 1)
|
||||||
first_hash = ""
|
first_hash = ""
|
||||||
|
|
||||||
|
@ -201,7 +205,7 @@ class Changes(object):
|
||||||
first_hash = entry + ".."
|
first_hash = entry + ".."
|
||||||
|
|
||||||
if format.is_interactive_format():
|
if format.is_interactive_format():
|
||||||
terminal.output_progress(_(PROGRESS_TEXT), i, len(lines))
|
terminal.output_progress(progress_text, i, len(lines))
|
||||||
else:
|
else:
|
||||||
entry = entry.decode("utf-8", "replace").strip()
|
entry = entry.decode("utf-8", "replace").strip()
|
||||||
second_hash = entry
|
second_hash = entry
|
||||||
|
|
|
@ -66,8 +66,9 @@ class Runner(object):
|
||||||
|
|
||||||
for repo in repos:
|
for repo in repos:
|
||||||
os.chdir(repo.location)
|
os.chdir(repo.location)
|
||||||
changes = Changes(self.hard)
|
repo = repo if len(repos) > 1 else None
|
||||||
summed_blames = Blame(self.hard, self.useweeks, changes) + summed_blames
|
changes = Changes(repo, self.hard)
|
||||||
|
summed_blames = Blame(repo, self.hard, self.useweeks, changes) + summed_blames
|
||||||
summed_changes = changes + summed_changes
|
summed_changes = changes + summed_changes
|
||||||
|
|
||||||
if self.include_metrics:
|
if self.include_metrics:
|
||||||
|
|
Loading…
Reference in New Issue