Changeset 140674 in webkit


Ignore:
Timestamp:
Jan 24, 2013 4:19:37 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Adding "has-landed" command to webkit-patch which compares a
committed patch to the changes which exist locally (ignoring the
ChangeLog file).

https://bugs.webkit.org/show_bug.cgi?id=106402

Patch by Tim 'mithro' Ansell <mithro@mithis.com> on 2013-01-24
Reviewed by Eric Seidel.

  • Scripts/webkitpy/common/checkout/diff_parser.py:

(git_diff_to_svn_diff):

  • Scripts/webkitpy/common/net/bugzilla/bug.py:

(Bug.commit_revision):

  • Scripts/webkitpy/common/net/bugzilla/bug_unittest.py:

(BugTest.test_is_in_comments):
(BugTest):
(BugTest.test_commit_revision):

  • Scripts/webkitpy/tool/commands/upload.py:

(HasLanded):

  • Scripts/webkitpy/tool/steps/init.py:
  • Scripts/webkitpy/tool/steps/haslanded.py: Added.

(HasLanded):
(HasLanded.convert_to_svn):
(HasLanded.strip_change_log):
(run):

  • Scripts/webkitpy/common/net/bugzilla/bug.py:

(Bug.commit_revision):

  • Scripts/webkitpy/common/net/bugzilla/bug_unittest.py:

(BugTest.test_is_in_comments):
(BugTest):
(BugTest.test_commit_revision):

  • Scripts/webkitpy/tool/commands/upload.py:

(HasLanded):

  • Scripts/webkitpy/tool/steps/init.py:
  • Scripts/webkitpy/tool/steps/haslanded.py: Added.

(HasLanded):
(HasLanded.convert_to_svn):
(HasLanded.strip_change_log):
(HasLanded.diff_diff):
(HasLanded.run):

  • Scripts/webkitpy/tool/steps/haslanded_unittest.py: Added.

(HasLandedTest):
(HasLandedTest.test_run):
(test_convert_to_svn_and_strip_change_log):

Location:
trunk/Tools
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r140668 r140674  
     12013-01-24  Tim 'mithro' Ansell  <mithro@mithis.com>
     2
     3        Adding "has-landed" command to webkit-patch which compares a
     4        committed patch to the changes which exist locally (ignoring the
     5        ChangeLog file).
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=106402
     8
     9        Reviewed by Eric Seidel.
     10
     11        * Scripts/webkitpy/common/checkout/diff_parser.py:
     12        (git_diff_to_svn_diff):
     13        * Scripts/webkitpy/common/net/bugzilla/bug.py:
     14        (Bug.commit_revision):
     15        * Scripts/webkitpy/common/net/bugzilla/bug_unittest.py:
     16        (BugTest.test_is_in_comments):
     17        (BugTest):
     18        (BugTest.test_commit_revision):
     19        * Scripts/webkitpy/tool/commands/upload.py:
     20        (HasLanded):
     21        * Scripts/webkitpy/tool/steps/__init__.py:
     22        * Scripts/webkitpy/tool/steps/haslanded.py: Added.
     23        (HasLanded):
     24        (HasLanded.convert_to_svn):
     25        (HasLanded.strip_change_log):
     26        (run):
     27
     28        * Scripts/webkitpy/common/net/bugzilla/bug.py:
     29        (Bug.commit_revision):
     30        * Scripts/webkitpy/common/net/bugzilla/bug_unittest.py:
     31        (BugTest.test_is_in_comments):
     32        (BugTest):
     33        (BugTest.test_commit_revision):
     34        * Scripts/webkitpy/tool/commands/upload.py:
     35        (HasLanded):
     36        * Scripts/webkitpy/tool/steps/__init__.py:
     37        * Scripts/webkitpy/tool/steps/haslanded.py: Added.
     38        (HasLanded):
     39        (HasLanded.convert_to_svn):
     40        (HasLanded.strip_change_log):
     41        (HasLanded.diff_diff):
     42        (HasLanded.run):
     43        * Scripts/webkitpy/tool/steps/haslanded_unittest.py: Added.
     44        (HasLandedTest):
     45        (HasLandedTest.test_run):
     46        (test_convert_to_svn_and_strip_change_log):
     47
    1482013-01-24  Dan Carney  <dcarney@google.com>
    249
  • trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bug.py

    r96685 r140674  
    2828# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    2929# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30
     31import re
    3032
    3133from .attachment import Attachment
     
    124126        return False
    125127
     128    def commit_revision(self):
     129        # Sort the comments in reverse order as we want the latest committed revision.
     130        r = re.compile("Committed r(?P<svn_revision>\d+)")
     131        for comment in sorted(self.comments(), reverse=True):
     132            rev = r.search(comment['text'])
     133            if rev:
     134                return int(rev.group('svn_revision'))
     135
     136        return None
  • trunk/Tools/Scripts/webkitpy/common/net/bugzilla/bug_unittest.py

    r140510 r140674  
    4646        self.assertTrue(bug.is_in_comments("Message3."))
    4747        self.assertFalse(bug.is_in_comments("Message."))
     48
     49    def test_commit_revision(self):
     50        bug = Bug({"comments": []}, bugzilla=None)
     51        self.assertEqual(bug.commit_revision(), None)
     52
     53        bug = Bug({"comments": [
     54            {"text": "Comment 1"},
     55            {"text": "Comment 2"},
     56            ]}, bugzilla=None)
     57        self.assertEqual(bug.commit_revision(), None)
     58
     59        bug = Bug({"comments": [
     60            {"text": "Committed r138776: <http://trac.webkit.org/changeset/138776>"},
     61            ]}, bugzilla=None)
     62        self.assertEqual(bug.commit_revision(), 138776)
     63
     64        bug = Bug({"comments": [
     65            {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <http://trac.webkit.org/changeset/138776>"},
     66            ]}, bugzilla=None)
     67        self.assertEqual(bug.commit_revision(), 138776)
     68
     69        bug = Bug({"comments": [
     70            {"text": "Comment before"},
     71            {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <http://trac.webkit.org/changeset/138776>"},
     72            {"text": "Comment after"},
     73            ]}, bugzilla=None)
     74        self.assertEqual(bug.commit_revision(), 138776)
     75
     76        bug = Bug({"comments": [
     77            {"text": "Comment before"},
     78            {"text": "(From update of attachment 181269) Clearing flags on attachment: 181269 Committed r138776: <http://trac.webkit.org/changeset/138776>"},
     79            {"text": "Comment Middle"},
     80            {"text": "(From update of attachment 181280) Clearing flags on attachment: 181280 Committed r138976: <http://trac.webkit.org/changeset/138976>"},
     81            {"text": "Comment After"},
     82            ]}, bugzilla=None)
     83        self.assertEqual(bug.commit_revision(), 138976)
  • trunk/Tools/Scripts/webkitpy/tool/commands/upload.py

    r136545 r140674  
    242242
    243243
     244class HasLanded(AbstractPatchUploadingCommand):
     245    name = "has-landed"
     246    help_text = "Check that the current code was successfully landed and no changes remain."
     247    argument_names = "[BUGID]"
     248    steps = [
     249        steps.HasLanded,
     250    ]
     251
     252
    244253class Prepare(AbstractSequencedCommand):
    245254    name = "prepare"
  • trunk/Tools/Scripts/webkitpy/tool/steps/__init__.py

    r139771 r140674  
    4646from webkitpy.tool.steps.ensurebugisopenandassigned import EnsureBugIsOpenAndAssigned
    4747from webkitpy.tool.steps.ensurelocalcommitifneeded import EnsureLocalCommitIfNeeded
     48from webkitpy.tool.steps.haslanded import HasLanded
    4849from webkitpy.tool.steps.obsoletepatches import ObsoletePatches
    4950from webkitpy.tool.steps.options import Options
Note: See TracChangeset for help on using the changeset viewer.