Changeset 48622 in webkit


Ignore:
Timestamp:
Sep 22, 2009 2:48:37 AM (15 years ago)
Author:
eric@webkit.org
Message:

2009-09-22 Eric Seidel <eric@webkit.org>

Reviewed by David Kilzer.

svn-apply can't handle single-line binary file additions
https://bugs.webkit.org/show_bug.cgi?id=29100

Fixed the regexp and added a unit test.

  • Scripts/modules/scm_unittest.py:
  • Scripts/svn-apply:
Location:
trunk/WebKitTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r48614 r48622  
     12009-09-22  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by David Kilzer.
     4
     5        svn-apply can't handle single-line binary file additions
     6        https://bugs.webkit.org/show_bug.cgi?id=29100
     7
     8        Fixed the regexp and added a unit test.
     9
     10        * Scripts/modules/scm_unittest.py:
     11        * Scripts/svn-apply:
     12
    1132009-09-11  Eric Seidel  <eric@webkit.org>
    214
  • trunk/WebKitTools/Scripts/modules/scm_unittest.py

    r48320 r48622  
    2828# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2929
     30import base64
    3031import os
    3132import re
     
    198199        self.assertEqual(scm.supports_local_commits(), False)
    199200
     201    def test_apply_small_binary_patch(self):
     202        patch_contents = """Index: test_file.swf
     203===================================================================
     204Cannot display: file marked as a binary type.
     205svn:mime-type = application/octet-stream
     206
     207Property changes on: test_file.swf
     208___________________________________________________________________
     209Name: svn:mime-type
     210   + application/octet-stream
     211
     212
     213Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==
     214"""
     215        expected_contents = base64.b64decode("Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA==")
     216        self._setup_webkittools_scripts_symlink(self.scm)
     217        patch_file = self._create_patch(patch_contents)
     218        self.scm.apply_patch(patch_file)
     219        actual_contents = read_from_path("test_file.swf")
     220        self.assertEqual(actual_contents, expected_contents)
     221
    200222    def test_apply_svn_patch(self):
    201223        scm = detect_scm_system(self.svn_checkout_path)
  • trunk/WebKitTools/Scripts/svn-apply

    r48242 r48622  
    334334{
    335335    my ($fullPath, $contents) = @_;
    336     if ($contents =~ m#((\n[A-Za-z0-9+/]{76})+\n[A-Za-z0-9+/=]{4,76}\n)#) {
     336    # [A-Za-z0-9+/] is the class of allowed base64 characters.
     337    # One or more lines, at most 76 characters in length.
     338    # The last line is allowed to have up to two '=' characters at the end (to signify padding).
     339    if ($contents =~ m#((\n[A-Za-z0-9+/]{76})*\n[A-Za-z0-9+/]{2,74}?[A-Za-z0-9+/=]{2}\n)#) {
    337340        # Addition or Modification
    338341        open FILE, ">", $fullPath or die;
Note: See TracChangeset for help on using the changeset viewer.