Bug 1308932 - Truncate commit message comments before adding to DB r=Callek
MozReview-Commit-ID: 2xhAEgaOTkQ
--- a/changes/hgpoller.py
+++ b/changes/hgpoller.py
@@ -353,17 +353,17 @@ class BaseHgPoller(BasePoller):
if self.mergePushChanges:
# Collect all the files for this push
c['files'].extend(change['files'])
# Keep the comments and revision of the last change of this push.
# We're going through the changes in reverse order, so we
# should use the comments and revision of the first change
# in this loop
if c['node'] is None:
- c['desc'] = change['desc']
+ c['desc'] = change['desc'][:500]
c['node'] = change['node']
title = change['desc'].split('\n', 1)[0]
if len(title) > 100:
trim_pos = title.rfind(' ', 0, 100)
if trim_pos == -1:
trim_pos = 100
title = title[:trim_pos]
@@ -375,17 +375,17 @@ class BaseHgPoller(BasePoller):
if c['commit_titles_total_length'] + len(title) + 5 <= 800:
c['commit_titles_total_length'] += len(title) + 5 # for json encoding like , " etc.
c['commit_titles'].append(title)
else:
c = dict(
user=push['user'],
date=push['date'],
files=change['files'],
- desc=change['desc'],
+ desc=change['desc'][:500],
node=change['node'],
branch=change['branch'],
)
change_list.append(c)
if too_many and self.mergePushChanges:
# Add a dummy change to indicate we had too many changes
c['files'].extend(['overflow'])