Skip to content

Commit

Permalink
p4poller: make the commit message contain only what the user typed in
Browse files Browse the repository at this point in the history
  • Loading branch information
thedylman committed Sep 23, 2015
1 parent b1e00cc commit 6d1c3e5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 32 deletions.
13 changes: 10 additions & 3 deletions master/buildbot/changes/p4poller.py
Expand Up @@ -273,11 +273,18 @@ def _poll(self):
# Convert from the server's timezone to the local timezone.
when = when.replace(tzinfo=self.server_tz)
when = util.datetime2epoch(when)
comments = ''

comment_lines = []
lines.pop(0) # describe header
lines.pop(0) # blank line
while not lines[0].startswith('Affected files'):
comments += lines.pop(0) + '\n'
lines.pop(0) # affected files
if lines[0].startswith('\t'): # comment is indented by one tab
comment_lines.append(lines.pop(0)[1:])
else:
lines.pop(0) # discard non comment line
comments = '\n'.join(comment_lines)

lines.pop(0) # affected files
branch_files = {} # dict for branch mapped to file(s)
while lines:
line = lines.pop(0).strip()
Expand Down
62 changes: 33 additions & 29 deletions master/buildbot/test/unit/test_changes_p4poller.py
Expand Up @@ -40,46 +40,50 @@
"""Change 5 on 2006/04/13 by mpatel@testclient 'first rev'
"""

change_4_log = \
"""Change 4 by mpatel@testclient on 2006/04/13 21:55:39
p4_describe_2 = \
"""Change 2 by slamb@testclient on 2006/04/13 21:46:23
\tshort desc truncated because this is a long description.
"""
\tcreation
change_3_log = \
u"""Change 3 by bob@testclient on 2006/04/13 21:51:39
Affected files ...
\tshort desc truncated because this is a long description.
ASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.
... //depot/myproject/trunk/whatbranch#1 add
... //depot/otherproject/trunk/something#1 add
"""

change_2_log = \
"""Change 2 by slamb@testclient on 2006/04/13 21:46:23
p4_describe_3 = \
u"""Change 3 by bob@testclient on 2006/04/13 21:51:39
\tcreation
"""
\tshort desc truncated because this is a long description.
\tASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.
p4change = {
3: change_3_log +
"""Affected files ...
Affected files ...
... //depot/myproject/branch_b/branch_b_file#1 add
... //depot/myproject/branch_b/whatbranch#1 branch
... //depot/myproject/branch_c/whatbranch#1 branch
""",
2: change_2_log +
"""Affected files ...
"""

... //depot/myproject/trunk/whatbranch#1 add
... //depot/otherproject/trunk/something#1 add
""",
5: change_4_log +
"""Affected files ...
p4_describe_4 = \
"""Change 4 by mpatel@testclient on 2006/04/13 21:55:39
\tThis is a multiline comment with tabs and spaces
\t
\tA list:
\t Item 1
\t\tItem 2
Affected files ...
... //depot/myproject/branch_b/branch_b_file#1 add
... //depot/myproject/branch_b#75 edit
... //depot/myproject/branch_c/branch_c_file#1 add
""",
"""

p4change = {
3: p4_describe_3,
2: p4_describe_2,
5: p4_describe_4,
}


Expand Down Expand Up @@ -170,7 +174,7 @@ def check_second_check(res):
'branch': u'trunk',
'category': None,
'codebase': None,
'comments': u'Change 2 by slamb@testclient on 2006/04/13 21:46:23\n\n\tcreation\n',
'comments': u'creation',
'files': [u'whatbranch'],
'project': '',
'properties': {},
Expand All @@ -184,7 +188,7 @@ def check_second_check(res):
'branch': u'branch_b',
'category': None,
'codebase': None,
'comments': u'Change 3 by bob@testclient on 2006/04/13 21:51:39\n\n\tshort desc truncated because this is a long description.\n ASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.\n',
'comments': u'short desc truncated because this is a long description.\nASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.',
'files': [u'branch_b_file', u'whatbranch'],
'project': '',
'properties': {},
Expand All @@ -198,7 +202,7 @@ def check_second_check(res):
'branch': u'branch_c',
'category': None,
'codebase': None,
'comments': u'Change 3 by bob@testclient on 2006/04/13 21:51:39\n\n\tshort desc truncated because this is a long description.\n ASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.\n',
'comments': u'short desc truncated because this is a long description.\nASDF-GUI-P3-\u2018Upgrade Icon\u2019 disappears sometimes.',
'files': [u'whatbranch'],
'project': '',
'properties': {},
Expand Down Expand Up @@ -319,7 +323,7 @@ def check(res):
'branch': u'branch_c',
'category': None,
'codebase': None,
'comments': u'Change 4 by mpatel@testclient on 2006/04/13 21:55:39\n\n\tshort desc truncated because this is a long description.\n',
'comments': u'This is a multiline comment with tabs and spaces\n\nA list:\n Item 1\n\tItem 2',
'files': [u'branch_c_file'],
'project': '',
'properties': {},
Expand All @@ -333,7 +337,7 @@ def check(res):
'branch': u'branch_b',
'category': None,
'codebase': None,
'comments': u'Change 4 by mpatel@testclient on 2006/04/13 21:55:39\n\n\tshort desc truncated because this is a long description.\n',
'comments': u'This is a multiline comment with tabs and spaces\n\nA list:\n Item 1\n\tItem 2',
'files': [u'branch_b_file'],
'project': '',
'properties': {},
Expand Down
2 changes: 2 additions & 0 deletions master/docs/relnotes/index.rst
Expand Up @@ -34,6 +34,8 @@ Fixes

* :bb:chsrc:`P4Source` no longer relies on the perforce server time to poll for new changes.

* The commit message for a change from :bb:chsrc:`P4Source` now matches what the user typed in.

Deprecations, Removals, and Non-Compatible Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit 6d1c3e5

Please sign in to comment.