Skip to content

Commit

Permalink
Merge pull request #272 from maruel/bb_sourcestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
ayust committed Oct 24, 2011
2 parents 7d0ff32 + 9750abc commit da3ee20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions master/buildbot/sourcestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ def _make_ss(cls, ssid, ssdict, master):

sourcestamp.patch = None
if ssdict['patch_body']:
# note that this class does not store the patch_subdir
sourcestamp.patch = (ssdict['patch_level'],
ssdict['patch_body'])
sourcestamp.patch = (ssdict['patch_level'], ssdict['patch_body'],
ssdict.get('patch_subdir'))
sourcestamp.patch_info = (ssdict['patch_author'],
ssdict['patch_comment'])

Expand Down Expand Up @@ -137,7 +136,7 @@ def __init__(self, branch=None, revision=None, patch=None,
return

if patch is not None:
assert len(patch) == 2
assert 2 <= len(patch) <= 3
assert int(patch[0]) != -1
self.branch = branch
self.patch = patch
Expand Down Expand Up @@ -271,8 +270,12 @@ def getSourceStampId(self, master):
# add it to the DB
patch_body = None
patch_level = None
patch_subdir = None
if self.patch:
patch_level, patch_body = self.patch
patch_level = self.patch[0]
patch_body = self.patch[1]
if len(self.patch) > 2:
patch_subdir = self.patch[2]

patch_author = None
patch_comment = None
Expand All @@ -284,7 +287,8 @@ def getSourceStampId(self, master):
repository=self.repository, project=self.project,
patch_body=patch_body, patch_level=patch_level,
patch_author=patch_author, patch_comment=patch_comment,
patch_subdir=None, changeids=[c.number for c in self.changes])
patch_subdir=patch_subdir,
changeids=[c.number for c in self.changes])
def set_ssid(ssid):
self.ssid = ssid
return ssid
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/unit/test_sourcestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def check(ss):
self.assertEqual(ss.ssid, 234)
self.assertEqual(ss.branch, 'trunk')
self.assertEqual(ss.revision, '9284')
self.assertEqual(ss.patch, (3, '-- ++'))
self.assertEqual(ss.patch, (3, '-- ++', '/foo'))
self.assertEqual(ss.patch_info, ('Professor Chaos', 'comment'))
self.assertEqual(ss.changes, ())
self.assertEqual(ss.project, 'world-domination')
Expand Down

0 comments on commit da3ee20

Please sign in to comment.