Skip to content

Commit 8789975

Browse files
authored
Merge pull request tobami#212 from mwatts15/master
Adding b'' literals for py3 compat. Handling git tag error
2 parents ea5c52a + dd9794a commit 8789975

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

codespeed/commits/git.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,20 @@ def getlogs(endrev, startrev):
6262
raise CommitLogError("%s returned %s: %s" % (
6363
" ".join(cmd), p.returncode, stderr))
6464
logs = []
65-
for log in filter(None, stdout.split("\x1e")):
65+
for log in filter(None, stdout.split(b'\x1e')):
6666
(short_commit_id, commit_id, date_t, author_name, author_email,
67-
subject, body) = log.split("\x00", 7)
67+
subject, body) = log.split(b'\x00', 7)
6868

6969
tag = ""
7070

7171
cmd = ["git", "describe", "--tags", commit_id]
72-
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, cwd=working_copy)
72+
Popen(cmd, stdout=PIPE, stderr=PIPE, cwd=working_copy)
7373

74-
stdout, stderr = p.communicate()
74+
try:
75+
stdout, stderr = p.communicate()
76+
except ValueError:
77+
stdout = b''
78+
stderr = b''
7579

7680
if p.returncode == 0:
7781
tag = stdout
@@ -81,6 +85,7 @@ def getlogs(endrev, startrev):
8185

8286
logs.append({'date': date, 'message': subject, 'commitid': commit_id,
8387
'author': author_name, 'author_email': author_email,
84-
'body': body, 'short_commit_id': short_commit_id, 'tag': tag})
88+
'body': body, 'short_commit_id': short_commit_id,
89+
'tag': tag})
8590

8691
return logs

0 commit comments

Comments
 (0)