Skip to content

Commit 60cf08d

Browse files
issue #67 max len for changed_files (max cell len error in googleapi)
1 parent 3c5290c commit 60cf08d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

commits_parser.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
TIMEDELTA = 0.05
88
TIMEZONE = 'Europe/Moscow'
99
FIELDNAMES = ('repository name', 'author name', 'author login', 'author email', 'date and time', 'changed files', 'commit id', 'branch')
10+
GOOGLE_MAX_CELL_LEN = 50000
11+
1012

1113
def log_commit_to_csv(info, csv_name):
1214
with open(csv_name, 'a', newline='') as file:
@@ -39,8 +41,11 @@ def log_repository_commits(repository: Repository, csv_name, start, finish, bran
3941
continue
4042
if commit.commit is not None:
4143
nvl = lambda val: val or EMPTY_FIELD
44+
changed_files = '; '.join([file.filename for file in commit.files])
45+
if len(changed_files) > GOOGLE_MAX_CELL_LEN:
46+
changed_files = changed_files[:GOOGLE_MAX_CELL_LEN]
4247
commit_data = [repository.full_name, commit.commit.author.name, nvl(commit.author.login), nvl(commit.commit.author.email),
43-
commit.commit.author.date, '; '.join([file.filename for file in commit.files]), commit.commit.sha, branch]
48+
commit.commit.author.date, changed_files, commit.commit.sha, branch]
4449
info = dict(zip(FIELDNAMES, commit_data))
4550

4651
log_commit_to_csv(info, csv_name)

0 commit comments

Comments
 (0)