Ticket #261: buildbot_branch_deletions.diff
| File buildbot_branch_deletions.diff, 5.0 kB (added by nhemingway, 7 months ago) |
|---|
-
old-buildbot_pristine/buildbot/changes/svnpoller.py
old new 402 402 branches = {} 403 403 pathlist = el.getElementsByTagName("paths")[0] 404 404 for p in pathlist.getElementsByTagName("path"): 405 action = p.getAttribute("action") 405 406 path = "".join([t.data for t in p.childNodes]) 406 407 # the rest of buildbot is certaily not yet ready to handle 407 408 # unicode filenames, because they get put in RemoteCommands … … 411 412 if path.startswith("/"): 412 413 path = path[1:] 413 414 where = self._transform_path(path) 415 414 416 # if 'where' is None, the file was outside any project that 415 417 # we care about and we should ignore it 416 418 if where: 417 419 branch, filename = where 418 420 if not branch in branches: 419 branches[branch] = [] 420 branches[branch].append(filename) 421 branches[branch] = { 'files': []} 422 branches[branch]['files'].append(filename) 423 424 if not branches[branch].has_key('action'): 425 branches[branch]['action'] = action 426 427 for branch in branches.keys(): 428 action = branches[branch]['action'] 429 files = branches[branch]['files'] 430 number_of_files_changed = len(files) 421 431 422 for branch in branches: 423 c = Change(who=author, 424 files=branches[branch], 425 comments=comments, 426 revision=revision, 427 branch=branch) 428 changes.append(c) 432 if action == u'D' and number_of_files_changed == 1 and files[0] == '': 433 log.msg("Ignoring deletion of branch '%s'" % branch) 434 else: 435 c = Change(who=author, 436 files=files, 437 comments=comments, 438 revision=revision, 439 branch=branch) 440 changes.append(c) 429 441 430 442 return changes 431 443 -
old-buildbot_pristine/buildbot/test/test_svnpoller.py
old new 117 117 # output from svn log on .../SVN-Repository/sample 118 118 # (so it includes trunk and branches) 119 119 sample_base = "file:///usr/home/warner/stuff/Projects/BuildBot/trees/misc/_trial_temp/test_vc/repositories/SVN-Repository/sample" 120 sample_logentries = [None] * 4 120 sample_logentries = [None] * 6 121 122 sample_logentries[5] = """\ 123 <logentry 124 revision="6"> 125 <author>warner</author> 126 <date>2006-10-01T19:35:16.165664Z</date> 127 <paths> 128 <path 129 action="D">/sample/branch/version.c</path> 130 </paths> 131 <msg>revised_to_2</msg> 132 </logentry> 133 """ 134 135 sample_logentries[4] = """\ 136 <logentry 137 revision="5"> 138 <author>warner</author> 139 <date>2006-10-01T19:35:16.165664Z</date> 140 <paths> 141 <path 142 action="D">/sample/branch</path> 143 </paths> 144 <msg>revised_to_2</msg> 145 </logentry> 146 """ 121 147 122 148 sample_logentries[3] = """\ 123 149 <logentry … … 293 319 self.failUnlessEqual(changes[0].revision, '4') 294 320 self.failUnlessEqual(changes[0].files, ["version.c"]) 295 321 322 # and now pull in r5 (should *not* create a change as it's a 323 # branch deletion 324 doc = s.parse_logs(make_changes_output(5)) 325 newlast, logentries = s._filter_new_logentries(doc, newlast) 326 self.failUnlessEqual(newlast, 5) 327 # so we see revision 5 as being new 328 changes = s.create_changes(logentries) 329 self.failUnlessEqual(len(changes), 0) 330 331 # and now pull in r6 (should create a change as it's not 332 # deleting an entire branch 333 doc = s.parse_logs(make_changes_output(6)) 334 newlast, logentries = s._filter_new_logentries(doc, newlast) 335 self.failUnlessEqual(newlast, 6) 336 # so we see revision 6 as being new 337 changes = s.create_changes(logentries) 338 self.failUnlessEqual(len(changes), 1) 339 self.failUnlessEqual(changes[0].branch, 'branch') 340 self.failUnlessEqual(changes[0].revision, '6') 341 self.failUnlessEqual(changes[0].files, ["version.c"]) 342 296 343 def testFirstTime(self): 297 344 base = "file:///home/warner/stuff/Projects/BuildBot/trees/svnpoller/_trial_temp/test_vc/repositories/SVN-Repository/sample" 298 345 s = SVNPoller(base, split_file=split_file)
![[Buildbot Logo]](/trac/chrome/site/header-text-transparent.png)