guard against exceptions when commits is None due to extension filtering
This commit is contained in:
parent
6e538ffaa7
commit
a723313691
|
@ -160,6 +160,7 @@ class ChangesThread(threading.Thread):
|
||||||
filtering.set_filtered(commit.sha, "message")):
|
filtering.set_filtered(commit.sha, "message")):
|
||||||
is_filtered = True
|
is_filtered = True
|
||||||
|
|
||||||
|
if commit is not None:
|
||||||
if FileDiff.is_filediff_line(j) and not \
|
if FileDiff.is_filediff_line(j) and not \
|
||||||
filtering.set_filtered(FileDiff.get_filename(j)) and not is_filtered:
|
filtering.set_filtered(FileDiff.get_filename(j)) and not is_filtered:
|
||||||
extensions.add_located(FileDiff.get_extension(j))
|
extensions.add_located(FileDiff.get_extension(j))
|
||||||
|
@ -198,18 +199,14 @@ class Changes(object):
|
||||||
first_hash = ""
|
first_hash = ""
|
||||||
|
|
||||||
for i, entry in enumerate(lines):
|
for i, entry in enumerate(lines):
|
||||||
if i % CHANGES_PER_THREAD == CHANGES_PER_THREAD - 1:
|
|
||||||
entry = entry.decode("utf-8", "replace").strip()
|
entry = entry.decode("utf-8", "replace").strip()
|
||||||
second_hash = entry
|
second_hash = entry
|
||||||
ChangesThread.create(hard, self, first_hash, second_hash, i)
|
ChangesThread.create(hard, self, first_hash, second_hash, i)
|
||||||
|
if i % CHANGES_PER_THREAD == CHANGES_PER_THREAD - 1:
|
||||||
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:
|
|
||||||
entry = entry.decode("utf-8", "replace").strip()
|
|
||||||
second_hash = entry
|
|
||||||
ChangesThread.create(hard, self, first_hash, second_hash, i)
|
|
||||||
|
|
||||||
# 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):
|
||||||
|
@ -220,15 +217,22 @@ class Changes(object):
|
||||||
__thread_lock__.release()
|
__thread_lock__.release()
|
||||||
|
|
||||||
self.commits = [item for sublist in self.commits for item in sublist]
|
self.commits = [item for sublist in self.commits for item in sublist]
|
||||||
|
flatten = lambda l: [item for sublist in l for item in sublist]
|
||||||
|
self.commits = [x for x in flatten(self.commits) if x is not None]
|
||||||
|
|
||||||
if len(self.commits) > 0:
|
if self.commits:
|
||||||
if interval.has_interval() and len(self.commits) > 0:
|
first = self.commits[0]
|
||||||
interval.set_ref(self.commits[-1].sha)
|
last = self.commits[-1]
|
||||||
|
|
||||||
self.first_commit_date = datetime.date(int(self.commits[0].date[0:4]), int(self.commits[0].date[5:7]),
|
if first and last:
|
||||||
int(self.commits[0].date[8:10]))
|
if interval.has_interval() and last:
|
||||||
self.last_commit_date = datetime.date(int(self.commits[-1].date[0:4]), int(self.commits[-1].date[5:7]),
|
interval.set_ref(last.sha)
|
||||||
int(self.commits[-1].date[8:10]))
|
self.first_commit_date = self.get_commit_date(first)
|
||||||
|
self.last_commit_date = self.get_commit_date(last)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get_commit_date(cls, commit):
|
||||||
|
return datetime.date(int(commit.date[0:4]), int(commit.date[5:7]), int(commit.date[8:10]))
|
||||||
|
|
||||||
def __iadd__(self, other):
|
def __iadd__(self, other):
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue