Changeset 173253 in webkit
- Timestamp:
- Sep 3, 2014 11:46:42 PM (10 years ago)
- Location:
- trunk/Websites/bugs.webkit.org
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Websites/bugs.webkit.org/ChangeLog
r164642 r173253 1 2014-09-03 David Kilzer <ddkilzer@apple.com> 2 3 Make images work with patches created using svn 1.7 4 <http://webkit.org/b/136507> 5 6 Reviewed by Darin Adler. 7 8 * PrettyPatch/PrettyPatch.rb: 9 (PrettyPatch.prettify): Delete redundant patches that claim 10 newly added images are actually removed. 11 (PrettyPatch.SVN_BINARY_FILE_MARKER_FORMAT): Rename from 12 BINARY_FILE_MARKER_FORMAT. 13 (PrettyPatch.SVN_IMAGE_FILE_MARKER_FORMAT): Rename from 14 IMAGE_FILE_MARKER_FORMAT. 15 (PrettyPatch.SVN_PROPERTY_CHANGES_FORMAT): Add. Used to find 16 and ignore property changes in svn 1.7 patches. 17 (PrettyPatch.SVN_START_OF_BINARY_DATA_FORMAT): Rename from 18 START_OF_BINARY_DATA_FORMAT. 19 (FileDiff.filename): Add read-only accessor. 20 (FileDiff.image): Add read-only accessor. 21 (FileDiff.image_url): Add read-only accessor. 22 (FileDiff.initialize): Add special case for svn-1.7 image 23 patches that add a file. Update various regex constants per 24 above. 25 1 26 2014-02-25 Jozsef Berta <jberta.u-szeged@partner.samsung.com> 2 27 -
trunk/Websites/bugs.webkit.org/PrettyPatch/PrettyPatch.rb
r164642 r173253 33 33 fileDiffs = FileDiff.parse(string) 34 34 35 # Newly added images get two diffs with svn 1.7; toss the first one. 36 deleteIndices = [] 37 for i in 1...fileDiffs.length 38 prev = i - 1 39 if fileDiffs[prev].image and not fileDiffs[prev].image_url and fileDiffs[i].image and fileDiffs[i].image_url and fileDiffs[prev].filename == fileDiffs[i].filename 40 deleteIndices.unshift(prev) 41 end 42 end 43 deleteIndices.each{ |i| fileDiffs.delete_at(i) } 44 35 45 $last_prettify_file_count = fileDiffs.length 36 46 str << fileDiffs.collect{ |diff| diff.to_html }.join … … 64 74 RENAME_FROM = /^rename from (.*)/ 65 75 66 BINARY_FILE_MARKER_FORMAT = /^Cannot display: file marked as a binary type.$/ 67 68 IMAGE_FILE_MARKER_FORMAT = /^svn:mime-type = image\/png$/ 76 SVN_BINARY_FILE_MARKER_FORMAT = /^Cannot display: file marked as a binary type.$/ 77 78 SVN_IMAGE_FILE_MARKER_FORMAT = /^svn:mime-type = image\/png$/ 79 80 SVN_PROPERTY_CHANGES_FORMAT = /^Property changes on: (.*)/ 69 81 70 82 GIT_INDEX_MARKER_FORMAT = /^index ([0-9a-f]{40})\.\.([0-9a-f]{40})/ … … 78 90 GIT_DELTA_FORMAT = /^delta \d+$/ 79 91 80 S TART_OF_BINARY_DATA_FORMAT = /^[0-9a-zA-Z\+\/=]{20,}/ # Assume 20 chars without a space is base64 binary data.92 SVN_START_OF_BINARY_DATA_FORMAT = /^[0-9a-zA-Z\+\/=]{20,}/ # Assume 20 chars without a space is base64 binary data. 81 93 82 94 START_OF_SECTION_FORMAT = /^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@\s*(.*)/ … … 531 543 532 544 class FileDiff 545 attr_reader :filename 546 attr_reader :image 547 attr_reader :image_url 548 533 549 def initialize(lines) 534 550 @filename = PrettyPatch.filename_from_diff_header(lines[0].chomp) … … 542 558 @to = PrettyPatch.revisionOrDescription(lines[i]) 543 559 startOfSections = i + 1 560 561 # Check for 'property' patch, then image data, since svn 1.7 creates a fake patch for property changes. 562 if /^$/.match(lines[startOfSections]) and SVN_PROPERTY_CHANGES_FORMAT.match(lines[startOfSections + 1]) then 563 startOfSections += 2 564 for x in startOfSections...lines.length 565 next if not /^$/.match(lines[x]) 566 if SVN_START_OF_BINARY_DATA_FORMAT.match(lines[x + 1]) then 567 startOfSections = x + 1 568 @binary = true 569 @image = true 570 break 571 end 572 end 573 end 544 574 break 545 when BINARY_FILE_MARKER_FORMAT575 when SVN_BINARY_FILE_MARKER_FORMAT 546 576 @binary = true 547 if ( IMAGE_FILE_MARKER_FORMAT.match(lines[i + 1]) or PrettyPatch.has_image_suffix(@filename)) then577 if (SVN_IMAGE_FILE_MARKER_FORMAT.match(lines[i + 1]) or PrettyPatch.has_image_suffix(@filename)) then 548 578 @image = true 549 579 startOfSections = i + 2 550 580 for x in startOfSections...lines.length 551 581 # Binary diffs often have property changes listed before the actual binary data. Skip them. 552 if S TART_OF_BINARY_DATA_FORMAT.match(lines[x]) then582 if SVN_START_OF_BINARY_DATA_FORMAT.match(lines[x]) then 553 583 startOfSections = x 554 584 break
Note: See TracChangeset
for help on using the changeset viewer.