Changeset 63062 in webkit
- Timestamp:
- Jul 11, 2010 11:29:06 PM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r63061 r63062 1 2010-07-11 Daniel Bates <dbates@rim.com> 2 3 Reviewed by David Kilzer. 4 5 Enable executable support for svn-apply and svn-unapply 6 https://bugs.webkit.org/show_bug.cgi?id=39409 7 8 Connect up the Git and SVN executable bit support in parseDiff() so that 9 executable bit changes are propagated via the returned diff hash to the 10 patch function in svn-apply and svn-unapply. 11 12 * Scripts/VCSUtils.pm: 13 - Modified parseDiff() to call parseSvnDiffProperties when 14 it finds the start of an SVN property change diff. 15 - Removed FIXME comment above parseSvnDiffProperties() since 16 it is now being used by parseDiff(). 17 - Export method scmToggleExecutableBit() now that we added the 18 executableBitDelta hash key. (This should have been exported 19 when we added this function in Bug #38423 <https://bugs.webkit.org/show_bug.cgi?id=38423>). 20 * Scripts/webkitperl/VCSUtils_unittest/parseDiff.pl: 21 - Updated results for: 22 "rename (with executable bit change)" 23 - Test value of executableBitDelta (now that we have support). 24 "SVN: binary file (isBinary true)" 25 - Remove the property change diff from svnConvertedText. We plan 26 to remove svnConvertedText in the future. So, we decided 27 against adding such support to any new code, such as the 28 property parsing routines. Therefore, we do not keep SVN 29 converted text for property change diffs. 30 - Added unit tests: 31 "SVN: file change diff with property change diff" 32 "SVN: file change diff, followed by property change diff on different file" 33 "SVN: property diff, followed by file change diff" 34 "SVN: copied file with property change" 35 "SVN: two consecutive property diffs" 36 "SVN: binary file with executable bit change" 37 "SVN: binary file followed by property change on different file" 38 "SVN: binary file followed by file change on different file" 39 "SVN: file change diff with property change, followed by property change diff" 40 "SVN: file change diff with property change, followed by file change diff" 41 1 42 2010-07-11 Maciej Stachowiak <mjs@apple.com> 2 43 -
trunk/WebKitTools/Scripts/VCSUtils.pm
r62755 r63062 69 69 &prepareParsedPatch 70 70 &runPatchCommand 71 &scmToggleExecutableBit 71 72 &setChangeLogDateAndReviewer 72 73 &svnRevisionForDirectory … … 91 92 my $gitDiffStartRegEx = qr#^diff --git (\w/)?(.+) (\w/)?([^\r\n]+)#; 92 93 my $svnDiffStartRegEx = qr#^Index: ([^\r\n]+)#; 94 my $svnPropertiesStartRegEx = qr#^Property changes on: ([^\r\n]+)#; # $1 is normally the same as the index path. 93 95 my $svnPropertyStartRegEx = qr#^(Modified|Name|Added|Deleted): ([^\r\n]+)#; # $2 is the name of the property. 94 96 my $svnPropertyValueStartRegEx = qr#^ (\+|-) ([^\r\n]+)#; # $2 is the start of the property's value (which may span multiple lines). … … 736 738 # copiedFromPath: the path from which the file was copied if the diff 737 739 # is a copy. 740 # executableBitDelta: the value 1 or -1 if the executable bit was added or 741 # removed from the target file, respectively. 738 742 # indexPath: the path of the target file. For SVN-formatted diffs, 739 743 # this is the same as the path in the "Index:" line. … … 755 759 # This subroutine preserves any leading junk encountered before the header. 756 760 # 761 # Composition of an SVN diff 762 # 763 # There are three parts to an SVN diff: the header, the property change, and 764 # the binary contents, in that order. Either the header or the property change 765 # may be ommitted, but not both. If there are binary changes, then you always 766 # have all three. 767 # 757 768 # Args: 758 769 # $fileHandle: a file handle advanced to the first line of the next … … 774 785 775 786 my $headerHashRef; # Last header found, as returned by parseDiffHeader(). 787 my $svnPropertiesHashRef; # Last SVN properties diff found, as returned by parseSvnDiffProperties(). 776 788 my $svnText; 777 789 while (defined($line)) { … … 783 795 } 784 796 797 if ($line =~ $svnPropertiesStartRegEx) { 798 my $propertyPath = $1; 799 if ($svnPropertiesHashRef || $headerHashRef && ($propertyPath ne $headerHashRef->{indexPath})) { 800 # This is the start of the second diff in the while loop, which happens to 801 # be a property diff. If $svnPropertiesHasRef is defined, then this is the 802 # second consecutive property diff, otherwise it's the start of a property 803 # diff for a file that only has property changes. 804 last; 805 } 806 ($svnPropertiesHashRef, $line) = parseSvnDiffProperties($fileHandle, $line); 807 next; 808 } 785 809 if ($line !~ $headerStartRegEx) { 786 810 # Then we are in the body of the diff. … … 790 814 } # Otherwise, we found a diff header. 791 815 792 if ($headerHashRef) { 793 # Then this is the second diff header of this while loop. 816 if ($svnPropertiesHashRef || $headerHashRef) { 817 # Then either we just processed an SVN property change or this 818 # is the start of the second diff header of this while loop. 794 819 last; 795 820 } … … 813 838 $copyHash{indexPath} = $headerHashRef->{indexPath}; 814 839 $copyHash{sourceRevision} = $headerHashRef->{sourceRevision} if $headerHashRef->{sourceRevision}; 840 if ($headerHashRef->{isSvn}) { 841 $copyHash{executableBitDelta} = $svnPropertiesHashRef->{executableBitDelta} if $svnPropertiesHashRef->{executableBitDelta}; 842 } 815 843 push @diffHashRefs, \%copyHash; 816 844 } 817 if (!$headerHashRef->{copiedFromPath} || $headerHashRef->{isCopyWithChanges}) { 845 846 # Note, the order of evaluation for the following if conditional has been explicitly chosen so that 847 # it evaluates to false when there is no headerHashRef (e.g. a property change diff for a file that 848 # only has property changes). 849 if ($headerHashRef->{isCopyWithChanges} || (%$headerHashRef && !$headerHashRef->{copiedFromPath})) { 818 850 # Then add the usual file modification. 819 851 my %diffHash; 820 # FIXME: Add executableBitDelta as a key. 852 # FIXME: We should expand this code to support other properties. In the future, 853 # parseSvnDiffProperties may return a hash whose keys are the properties. 854 if ($headerHashRef->{isSvn}) { 855 # SVN records the change to the executable bit in a separate property change diff 856 # that follows the contents of the diff, except for binary diffs. For binary 857 # diffs, the property change diff follows the diff header. 858 $diffHash{executableBitDelta} = $svnPropertiesHashRef->{executableBitDelta} if $svnPropertiesHashRef->{executableBitDelta}; 859 } elsif ($headerHashRef->{isGit}) { 860 # Git records the change to the executable bit in the header of a diff. 861 $diffHash{executableBitDelta} = $headerHashRef->{executableBitDelta} if $headerHashRef->{executableBitDelta}; 862 } 821 863 $diffHash{indexPath} = $headerHashRef->{indexPath}; 822 864 $diffHash{isBinary} = $headerHashRef->{isBinary} if $headerHashRef->{isBinary}; … … 832 874 # FIXME: Remove the need for svnConvertedText. See the %diffHash 833 875 # code comments above for more information. 834 $diffHash{svnConvertedText} = $svnText; 876 # 877 # Note, we may not always have SVN converted text since we intend 878 # to deprecate it in the future. For example, a property change 879 # diff for a file that only has property changes will not return 880 # any SVN converted text. 881 $diffHash{svnConvertedText} = $svnText if $svnText; 835 882 push @diffHashRefs, \%diffHash; 883 } 884 885 if (!%$headerHashRef && $svnPropertiesHashRef) { 886 # A property change diff for a file that only has property changes. 887 my %propertyChangeHash; 888 $propertyChangeHash{executableBitDelta} = $svnPropertiesHashRef->{executableBitDelta} if $svnPropertiesHashRef->{executableBitDelta}; 889 $propertyChangeHash{indexPath} = $svnPropertiesHashRef->{propertyPath}; 890 $propertyChangeHash{isSvn} = 1; 891 push @diffHashRefs, \%propertyChangeHash; 836 892 } 837 893 … … 860 916 # removed from the target file, respectively. 861 917 # $lastReadLine: the line last read from $fileHandle. 862 #863 # FIXME: This method is unused as of (05/22/2010). We will call this function864 # as part of parsing a diff. See <https://bugs.webkit.org/show_bug.cgi?id=39409>.865 918 sub parseSvnDiffProperties($$) 866 919 { … … 869 922 $_ = $line; 870 923 871 my $svnFooterDiffStartRegEx = qr#Property changes on: ([^\r\n]+)#; # $1 is normally the same as the index path.872 873 924 my %footer; 874 if (/$svn FooterDiffStartRegEx/) {925 if (/$svnPropertiesStartRegEx/) { 875 926 $footer{propertyPath} = $1; 876 927 } else { -
trunk/WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseDiff.pl
r59048 r63062 92 92 svn:mime-type = application/octet-stream 93 93 94 Property changes on: test_file.swf95 ___________________________________________________________________96 Name: svn:mime-type97 + application/octet-stream98 94 99 95 … … 235 231 undef], 236 232 expectedNextLine => undef, 233 }, 234 #### 235 # Property Changes: Simple 236 ## 237 { 238 # New test 239 diffName => "SVN: file change diff with property change diff", 240 inputText => <<'END', 241 Index: Makefile 242 =================================================================== 243 --- Makefile (revision 60021) 244 +++ Makefile (working copy) 245 @@ -1,3 +1,4 @@ 246 + 247 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 248 249 all: 250 251 Property changes on: Makefile 252 ___________________________________________________________________ 253 Name: svn:executable 254 + * 255 END 256 expectedReturn => [ 257 [{ 258 svnConvertedText => <<'END', # Same as input text 259 Index: Makefile 260 =================================================================== 261 --- Makefile (revision 60021) 262 +++ Makefile (working copy) 263 @@ -1,3 +1,4 @@ 264 + 265 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 266 267 all: 268 269 END 270 executableBitDelta => 1, 271 indexPath => "Makefile", 272 isSvn => 1, 273 sourceRevision => "60021", 274 }], 275 undef], 276 expectedNextLine => undef, 277 }, 278 { 279 # New test 280 diffName => "SVN: file change diff, followed by property change diff on different file", 281 inputText => <<'END', 282 Index: Makefile 283 =================================================================== 284 --- Makefile (revision 60021) 285 +++ Makefile (working copy) 286 @@ -1,3 +1,4 @@ 287 + 288 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 289 290 all: 291 292 Property changes on: Makefile.shared 293 ___________________________________________________________________ 294 Name: svn:executable 295 + * 296 END 297 expectedReturn => [ 298 [{ 299 svnConvertedText => <<'END', # Same as input text 300 Index: Makefile 301 =================================================================== 302 --- Makefile (revision 60021) 303 +++ Makefile (working copy) 304 @@ -1,3 +1,4 @@ 305 + 306 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 307 308 all: 309 310 END 311 indexPath => "Makefile", 312 isSvn => 1, 313 sourceRevision => "60021", 314 }], 315 "Property changes on: Makefile.shared\n"], 316 expectedNextLine => "___________________________________________________________________\n", 317 }, 318 { 319 # New test 320 diffName => "SVN: property diff, followed by file change diff", 321 inputText => <<'END', 322 Property changes on: Makefile 323 ___________________________________________________________________ 324 Deleted: svn:executable 325 - * 326 327 Index: Makefile.shared 328 =================================================================== 329 --- Makefile.shared (revision 60021) 330 +++ Makefile.shared (working copy) 331 @@ -1,3 +1,4 @@ 332 + 333 SCRIPTS_PATH ?= ../WebKitTools/Scripts 334 XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()'` $(ARGS) 335 END 336 expectedReturn => [ 337 [{ 338 executableBitDelta => -1, 339 indexPath => "Makefile", 340 isSvn => 1, 341 }], 342 "Index: Makefile.shared\n"], 343 expectedNextLine => "===================================================================\n", 344 }, 345 { 346 # New test 347 diffName => "SVN: copied file with property change", 348 inputText => <<'END', 349 Index: NMakefile 350 =================================================================== 351 --- NMakefile (revision 60021) (from Makefile:60021) 352 +++ NMakefile (working copy) 353 @@ -0,0 +1,1 @@ 354 +MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 355 356 Property changes on: NMakefile 357 ___________________________________________________________________ 358 Added: svn:executable 359 + * 360 END 361 expectedReturn => [ 362 [{ 363 copiedFromPath => "Makefile", 364 executableBitDelta => 1, 365 indexPath => "NMakefile", 366 sourceRevision => "60021", 367 }], 368 undef], 369 expectedNextLine => undef, 370 }, 371 { 372 # New test 373 diffName => "SVN: two consecutive property diffs", 374 inputText => <<'END', 375 Property changes on: Makefile 376 ___________________________________________________________________ 377 Added: svn:executable 378 + * 379 380 381 Property changes on: Makefile.shared 382 ___________________________________________________________________ 383 Added: svn:executable 384 + * 385 END 386 expectedReturn => [ 387 [{ 388 executableBitDelta => 1, 389 indexPath => "Makefile", 390 isSvn => 1, 391 }], 392 "Property changes on: Makefile.shared\n"], 393 expectedNextLine => "___________________________________________________________________\n", 394 }, 395 #### 396 # Property Changes: Binary files 397 ## 398 { 399 # New test 400 diffName => "SVN: binary file with executable bit change", 401 inputText => <<'END', 402 Index: test_file.swf 403 =================================================================== 404 Cannot display: file marked as a binary type. 405 svn:mime-type = application/octet-stream 406 407 Property changes on: test_file.swf 408 ___________________________________________________________________ 409 Name: svn:mime-type 410 + application/octet-stream 411 Name: svn:executable 412 + * 413 414 415 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 416 END 417 expectedReturn => [ 418 [{ 419 svnConvertedText => <<'END', # Same as input text 420 Index: test_file.swf 421 =================================================================== 422 Cannot display: file marked as a binary type. 423 svn:mime-type = application/octet-stream 424 425 426 427 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 428 END 429 executableBitDelta => 1, 430 indexPath => "test_file.swf", 431 isBinary => 1, 432 isSvn => 1, 433 }], 434 undef], 435 expectedNextLine => undef, 436 }, 437 { 438 # New test 439 diffName => "SVN: binary file followed by property change on different file", 440 inputText => <<'END', 441 Index: test_file.swf 442 =================================================================== 443 Cannot display: file marked as a binary type. 444 svn:mime-type = application/octet-stream 445 446 Property changes on: test_file.swf 447 ___________________________________________________________________ 448 Name: svn:mime-type 449 + application/octet-stream 450 451 452 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 453 454 Property changes on: Makefile 455 ___________________________________________________________________ 456 Added: svn:executable 457 + * 458 END 459 expectedReturn => [ 460 [{ 461 svnConvertedText => <<'END', # Same as input text 462 Index: test_file.swf 463 =================================================================== 464 Cannot display: file marked as a binary type. 465 svn:mime-type = application/octet-stream 466 467 468 469 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 470 471 END 472 indexPath => "test_file.swf", 473 isBinary => 1, 474 isSvn => 1, 475 }], 476 "Property changes on: Makefile\n"], 477 expectedNextLine => "___________________________________________________________________\n", 478 }, 479 { 480 # New test 481 diffName => "SVN: binary file followed by file change on different file", 482 inputText => <<'END', 483 Index: test_file.swf 484 =================================================================== 485 Cannot display: file marked as a binary type. 486 svn:mime-type = application/octet-stream 487 488 Property changes on: test_file.swf 489 ___________________________________________________________________ 490 Name: svn:mime-type 491 + application/octet-stream 492 493 494 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 495 496 Index: Makefile 497 =================================================================== 498 --- Makefile (revision 60021) 499 +++ Makefile (working copy) 500 @@ -1,3 +1,4 @@ 501 + 502 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 503 504 all: 505 END 506 expectedReturn => [ 507 [{ 508 svnConvertedText => <<'END', # Same as input text 509 Index: test_file.swf 510 =================================================================== 511 Cannot display: file marked as a binary type. 512 svn:mime-type = application/octet-stream 513 514 515 516 Q1dTBx0AAAB42itg4GlgYJjGwMDDyODMxMDw34GBgQEAJPQDJA== 517 518 END 519 indexPath => "test_file.swf", 520 isBinary => 1, 521 isSvn => 1, 522 }], 523 "Index: Makefile\n"], 524 expectedNextLine => "===================================================================\n", 525 }, 526 #### 527 # Property Changes: File change with property change 528 ## 529 { 530 # New test 531 diffName => "SVN: file change diff with property change, followed by property change diff", 532 inputText => <<'END', 533 Index: Makefile 534 =================================================================== 535 --- Makefile (revision 60021) 536 +++ Makefile (working copy) 537 @@ -1,3 +1,4 @@ 538 + 539 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 540 541 all: 542 543 Property changes on: Makefile 544 ___________________________________________________________________ 545 Added: svn:executable 546 + * 547 548 549 Property changes on: Makefile.shared 550 ___________________________________________________________________ 551 Deleted: svn:executable 552 - * 553 END 554 expectedReturn => [ 555 [{ 556 svnConvertedText => <<'END', # Same as input text 557 Index: Makefile 558 =================================================================== 559 --- Makefile (revision 60021) 560 +++ Makefile (working copy) 561 @@ -1,3 +1,4 @@ 562 + 563 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 564 565 all: 566 567 568 569 END 570 executableBitDelta => 1, 571 indexPath => "Makefile", 572 isSvn => 1, 573 sourceRevision => "60021", 574 }], 575 "Property changes on: Makefile.shared\n"], 576 expectedNextLine => "___________________________________________________________________\n", 577 }, 578 { 579 # New test 580 diffName => "SVN: file change diff with property change, followed by file change diff", 581 inputText => <<'END', 582 Index: Makefile 583 =================================================================== 584 --- Makefile (revision 60021) 585 +++ Makefile (working copy) 586 @@ -1,3 +1,4 @@ 587 + 588 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 589 590 all: 591 592 Property changes on: Makefile 593 ___________________________________________________________________ 594 Name: svn:executable 595 - * 596 597 Index: Makefile.shared 598 =================================================================== 599 --- Makefile.shared (revision 60021) 600 +++ Makefile.shared (working copy) 601 @@ -1,3 +1,4 @@ 602 + 603 SCRIPTS_PATH ?= ../WebKitTools/Scripts 604 XCODE_OPTIONS = `perl -I$(SCRIPTS_PATH) -Mwebkitdirs -e 'print XcodeOptionString()'` $(ARGS) 605 END 606 expectedReturn => [ 607 [{ 608 svnConvertedText => <<'END', # Same as input text 609 Index: Makefile 610 =================================================================== 611 --- Makefile (revision 60021) 612 +++ Makefile (working copy) 613 @@ -1,3 +1,4 @@ 614 + 615 MODULES = JavaScriptCore JavaScriptGlue WebCore WebKit WebKit2 WebKitTools 616 617 all: 618 619 620 END 621 executableBitDelta => -1, 622 indexPath => "Makefile", 623 isSvn => 1, 624 sourceRevision => "60021", 625 }], 626 "Index: Makefile.shared\n"], 627 expectedNextLine => "===================================================================\n", 237 628 }, 238 629 #### … … 452 843 }, 453 844 { 845 executableBitDelta => 1, 454 846 indexPath => "foo_new", 455 847 isGit => 1,
Note: See TracChangeset
for help on using the changeset viewer.