Changeset 51030 in webkit
- Timestamp:
- Nov 16, 2009 4:29:21 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r51029 r51030 1 2009-11-16 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Move StyleQueue over to using PatchCollection 6 https://bugs.webkit.org/show_bug.cgi?id=31544 7 8 That's what the class it's for. 9 10 * Scripts/bugzilla-tool: 11 * Scripts/modules/patchcollection.py: 12 * Scripts/modules/patchcollection_unittest.py: 13 1 14 2009-11-16 Eric Seidel <eric@webkit.org> 2 15 -
trunk/WebKitTools/Scripts/bugzilla-tool
r51029 r51030 46 46 from modules.comments import bug_comment_from_commit_text 47 47 from modules.logging import error, log, tee 48 from modules.patchcollection import PatchCollection 48 49 from modules.scm import CommitMessage, detect_scm_system, ScriptError, CheckoutNeedsUpdate 49 50 from modules.buildbot import BuildBot … … 752 753 WebKitLandingScripts.run_and_throw_if_fail(bugzilla_tool_args) 753 754 755 def log_progress(self, patch_ids): 756 log("%s in %s [%s]" % (pluralize('patch', len(patch_ids)), self._name, ", ".join(patch_ids))) 757 754 758 def execute(self, options, args, tool): 755 759 self.options = options … … 798 802 class StyleQueue(AbstractQueue): 799 803 def __init__(self): 800 self.patches = []801 804 AbstractQueue.__init__(self, "style-queue") 802 805 … … 804 807 return None # FIXME: A hack until we come up with a more generic status page. 805 808 809 def begin_work_queue(self): 810 AbstractQueue.begin_work_queue(self) 811 self._patches = PatchCollection(self.tool.bugs) 812 self._patches.add_patches(self.tool.bugs.fetch_patches_from_review_queue(limit=10)) 813 806 814 def next_work_item(self): 807 if not self.patches: 808 self.patches = self.tool.bugs.fetch_patches_from_review_queue(limit=10) 809 if not self.patches: 810 return None 811 patch_ids = map(lambda patch: patch['id'], self.patches) 812 log("%s in review queue [%s]" % (pluralize('patch', len(self.patches)), ", ".join(patch_ids))) 813 return self.patches.pop(0) 815 self.log_progress(self._patches.patch_ids()) 816 return self._patches.next() 814 817 815 818 def should_proceed_with_work_item(self, patch): -
trunk/WebKitTools/Scripts/modules/patchcollection.py
r51026 r51030 34 34 self._patches = [] 35 35 36 def add(self, patch_id): 37 patch = self._bugs.fetch_attachment(patch_id) 38 if not patch: 39 return 40 if self._filter and not self._filter(patch): 41 return 42 self._patches.append(patch) 36 def add(self, patch): 37 self.add_patches([patch]) 43 38 44 def add_all_from_bug(self, bug_id): 45 patches = self._bugs.fetch_patches_from_bug(bug_id) 39 def add_patches(self, patches): 46 40 for patch in patches: 41 if not patch: 42 continue 47 43 if self._filter and not self._filter(patch): 48 44 continue 49 45 self._patches.append(patch) 50 46 47 def add_patches_from_bug(self, bug_id): 48 self.add_patches(self._bugs.fetch_patches_from_bug(bug_id)) 49 51 50 def next(self): 51 if not self._patches: 52 return None 52 53 return self._patches.pop(0) 54 55 def patch_ids(self): 56 return map(lambda patch: patch['id'], self._patches) 53 57 54 58 def __len__(self): -
trunk/WebKitTools/Scripts/modules/patchcollection_unittest.py
r51026 r51030 61 61 patches = PatchCollection(bugs, filter=test_filter) 62 62 self.assertEqual(len(patches), 0) 63 patches.add( 42)63 patches.add(bugs.fetch_attachment(42)) 64 64 self.assertEqual(len(patches), 1) 65 65 patch = patches.next() 66 66 self.assertEqual(patch, MockBugzilla.patch_1) 67 67 self.assertEqual(len(patches), 0) 68 patches.add_ all_from_bug(38)68 patches.add_patches_from_bug(38) 69 69 # Notice that one of the patches gets filtered out. 70 70 self.assertEqual(len(patches), 2) … … 80 80 patches = PatchCollection(bugs, filter=test_filter) 81 81 self.assertEqual(len(patches), 0) 82 patches.add( 42)82 patches.add(bugs.fetch_attachment(42)) 83 83 self.assertEqual(len(patches), 0) 84 patches.add_ all_from_bug(38)84 patches.add_patches_from_bug(38) 85 85 self.assertEqual(len(patches), 0) 86 87 def test_add_patches(self): 88 patches = PatchCollection(None) 89 self.assertEqual(patches.patch_ids(), []) 90 patches.add_patches([{'id': 42}, {'id': 74}]) 91 self.assertEqual(len(patches), 2) 92 self.assertEqual(patches.patch_ids(), [42, 74]) 93 94 def test_patch_ids(self): 95 patches = PatchCollection(None) 96 self.assertEqual(patches.patch_ids(), []) 97 patches.add({'id': 42}) 98 patches.add({'id': 74}) 99 self.assertEqual(patches.patch_ids(), [42, 74]) 100 101 def test_empty(self): 102 patches = PatchCollection(None) 103 self.assertEqual(patches.next(), None) 86 104 87 105 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.