mirror of
https://github.com/ejwa/gitinspector.git
synced 2024-11-10 21:26:57 +01:00
Moved blame.Blame.output_progress to terminal.output_progress.
This enables us to output progress from multiple modules.
This commit is contained in:
parent
6606d8b13c
commit
ce91c4176a
@ -141,19 +141,14 @@ class Blame(object):
|
|||||||
thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), self.blames, row.strip())
|
thread = BlameThread(useweeks, changes, blame_command, FileDiff.get_extension(row), self.blames, row.strip())
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
Blame.output_progress(i, len(lines))
|
|
||||||
|
if format.is_interactive_format():
|
||||||
|
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):
|
||||||
__thread_lock__.acquire()
|
__thread_lock__.acquire()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def output_progress(pos, length):
|
|
||||||
if sys.stdout.isatty() and format.is_interactive_format():
|
|
||||||
terminal.clear_row()
|
|
||||||
print(_(PROGRESS_TEXT).format(100 * pos / length), end="")
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_revision(string):
|
def is_revision(string):
|
||||||
revision = re.search("([0-9a-f]{40})", string)
|
revision = re.search("([0-9a-f]{40})", string)
|
||||||
|
@ -145,3 +145,9 @@ def ljust(string, pad):
|
|||||||
|
|
||||||
def rjust(string, pad):
|
def rjust(string, pad):
|
||||||
return string.rjust(pad - get_excess_column_count(string))
|
return string.rjust(pad - get_excess_column_count(string))
|
||||||
|
|
||||||
|
def output_progress(text, pos, length):
|
||||||
|
if sys.stdout.isatty():
|
||||||
|
clear_row()
|
||||||
|
print(text.format(100 * pos / length), end="")
|
||||||
|
sys.stdout.flush()
|
||||||
|
Loading…
Reference in New Issue
Block a user