Changeset 51026 in webkit


Ignore:
Timestamp:
Nov 16, 2009 3:47:56 AM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-11-16 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

Implement PatchCollection
https://bugs.webkit.org/show_bug.cgi?id=31541

This class holds a set of patches and lets clients iterate through
them. Optionally, clients can install a filter.

  • Scripts/modules/patchcollection.py: Added.
  • Scripts/modules/patchcollection_unittest.py: Added.
  • Scripts/run-webkit-unittests:
Location:
trunk/WebKitTools
Files:
1 added
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r51025 r51026  
     12009-11-16  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Implement PatchCollection
     6        https://bugs.webkit.org/show_bug.cgi?id=31541
     7
     8        This class holds a set of patches and lets clients iterate through
     9        them.  Optionally, clients can install a filter.
     10
     11        * Scripts/modules/patchcollection.py: Added.
     12        * Scripts/modules/patchcollection_unittest.py: Added.
     13        * Scripts/run-webkit-unittests:
     14
    1152009-11-16  Eric Seidel  <eric@webkit.org>
    216
  • trunk/WebKitTools/Scripts/modules/patchcollection.py

    • Property svn:executable deleted
    r51025 r51026  
    11#!/usr/bin/env python
    2 # Copyright (c) 2009 Google Inc. All rights reserved.
     2# Copyright (c) 2009, Google Inc. All rights reserved.
    33#
    44# Redistribution and use in source and binary forms, with or without
     
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
    30 import unittest
     30class PatchCollection:
     31    def __init__(self, bugs, filter=None):
     32        self._bugs = bugs
     33        self._filter = filter
     34        self._patches = []
    3135
    32 from modules.bugzilla_unittest import *
    33 from modules.buildbot_unittest import *
    34 from modules.changelogs_unittest import *
    35 from modules.committers_unittest import *
    36 from modules.cpp_style_unittest import *
    37 from modules.diff_parser_unittest import *
    38 from modules.logging_unittest import *
    39 from modules.scm_unittest import *
    40 from modules.workqueue_unittest import *
     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)
    4143
    42 if __name__ == "__main__":
    43     unittest.main()
     44    def add_all_from_bug(self, bug_id):
     45        patches = self._bugs.fetch_patches_from_bug(bug_id)
     46        for patch in patches:
     47            if self._filter and not self._filter(patch):
     48                continue
     49            self._patches.append(patch)
     50
     51    def next(self):
     52        return self._patches.pop(0)
     53
     54    def __len__(self):
     55        return len(self._patches)
  • trunk/WebKitTools/Scripts/run-webkit-unittests

    r51018 r51026  
    3737from modules.diff_parser_unittest import *
    3838from modules.logging_unittest import *
     39from modules.patchcollection_unittest import *
    3940from modules.scm_unittest import *
    4041from modules.workqueue_unittest import *
Note: See TracChangeset for help on using the changeset viewer.