2010-09-04 Daniel Bates <dbates@rim.com>
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Sep 2010 01:12:17 +0000 (01:12 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Sep 2010 01:12:17 +0000 (01:12 +0000)
        Reviewed by Martin Robinson.

        Teach svn-apply/unapply about svn:mergeinfo
        https://bugs.webkit.org/show_bug.cgi?id=45236

        Recognize the svn:mergeinfo property and ignore it for now.

        Currently, svn-apply/unapply recognize only '+' and '-'
        property changes within a diff. We should add support
        to recognize "Merged" and "Reverse-merged" changes as well.
        Because svn:mergeinfo is metadata that is used only by SVN
        and tends to be error-prone and/or nuisance (*), we will ignore
        it for now.
        (*) See "Parting Thoughts" of <http://www.collab.net/community/subversion/articles/merge-info.html>.

        * Scripts/VCSUtils.pm:
          - Modified parseSvnProperty() to recognize "Merged" and
            "Reverse-merged" as the start of a property value.
        * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl:
          - Added the following unit tests:
            "simple: add svn:mergeinfo"
            "simple: delete svn:mergeinfo"
            "simple: modified svn:mergeinfo"
        * Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl:
          - Added the following unit tests:
            "simple: add svn:mergeinfo"
            "simple: delete svn:mergeinfo"
            "simple: modified svn:mergeinfo"
            "simple: modified svn:mergeinfo using SVN 1.4 syntax"
            "'Merged' change followed by 'Merged' change"
            "'Reverse-merged' change followed by 'Reverse-merged' change"
        * Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl:
          - Added the following unit tests:
            "'Merged' change"
            "'Reverse-merged' change"
            "'Reverse-merged' change followed by 'Merge' change"
            "'Merged' change followed by 'Merge' change"
            "'Reverse-merged' change followed by 'Reverse-merged' change"
            "'Reverse-merged' change followed by 'Reverse-merged' change followed by 'Merged' change"

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@66800 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Scripts/VCSUtils.pm
WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl
WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl
WebKitTools/Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl

index 35bd577..c0e0240 100644 (file)
@@ -1,3 +1,45 @@
+2010-09-04  Daniel Bates  <dbates@rim.com>
+
+        Reviewed by Martin Robinson.
+
+        Teach svn-apply/unapply about svn:mergeinfo
+        https://bugs.webkit.org/show_bug.cgi?id=45236
+
+        Recognize the svn:mergeinfo property and ignore it for now.
+
+        Currently, svn-apply/unapply recognize only '+' and '-'
+        property changes within a diff. We should add support
+        to recognize "Merged" and "Reverse-merged" changes as well.
+        Because svn:mergeinfo is metadata that is used only by SVN
+        and tends to be error-prone and/or nuisance (*), we will ignore
+        it for now.
+        (*) See "Parting Thoughts" of <http://www.collab.net/community/subversion/articles/merge-info.html>.
+
+        * Scripts/VCSUtils.pm:
+          - Modified parseSvnProperty() to recognize "Merged" and
+            "Reverse-merged" as the start of a property value.
+        * Scripts/webkitperl/VCSUtils_unittest/parseSvnDiffFooter.pl:
+          - Added the following unit tests:
+            "simple: add svn:mergeinfo"
+            "simple: delete svn:mergeinfo"
+            "simple: modified svn:mergeinfo"
+        * Scripts/webkitperl/VCSUtils_unittest/parseSvnProperty.pl:
+          - Added the following unit tests:
+            "simple: add svn:mergeinfo"
+            "simple: delete svn:mergeinfo"
+            "simple: modified svn:mergeinfo"
+            "simple: modified svn:mergeinfo using SVN 1.4 syntax"
+            "'Merged' change followed by 'Merged' change"
+            "'Reverse-merged' change followed by 'Reverse-merged' change"
+        * Scripts/webkitperl/VCSUtils_unittest/parseSvnPropertyValue.pl:
+          - Added the following unit tests:
+            "'Merged' change"
+            "'Reverse-merged' change"
+            "'Reverse-merged' change followed by 'Merge' change"
+            "'Merged' change followed by 'Merge' change"
+            "'Reverse-merged' change followed by 'Reverse-merged' change"
+            "'Reverse-merged' change followed by 'Reverse-merged' change followed by 'Merged' change"
+
 2010-09-04  Lucas De Marchi  <lucas.demarchi@profusion.mobi>
 
         Reviewed by Kenneth Rohde Christiansen.
index 05d7bd8..dd08baa 100644 (file)
@@ -94,7 +94,7 @@ my $gitDiffStartRegEx = qr#^diff --git (\w/)?(.+) (\w/)?([^\r\n]+)#;
 my $svnDiffStartRegEx = qr#^Index: ([^\r\n]+)#;
 my $svnPropertiesStartRegEx = qr#^Property changes on: ([^\r\n]+)#; # $1 is normally the same as the index path.
 my $svnPropertyStartRegEx = qr#^(Modified|Name|Added|Deleted): ([^\r\n]+)#; # $2 is the name of the property.
-my $svnPropertyValueStartRegEx = qr#^   (\+|-) ([^\r\n]+)#; # $2 is the start of the property's value (which may span multiple lines).
+my $svnPropertyValueStartRegEx = qr#^   (\+|-|Merged|Reverse-merged) ([^\r\n]+)#; # $2 is the start of the property's value (which may span multiple lines).
 
 # This method is for portability. Return the system-appropriate exit
 # status of a child process.
@@ -1037,9 +1037,9 @@ sub parseSvnProperty($$)
     }
 
     my $propertyChangeDelta;
-    if ($propertyValueType eq '+') {
+    if ($propertyValueType eq "+" || $propertyValueType eq "Merged") {
         $propertyChangeDelta = 1;
-    } elsif ($propertyValueType eq '-') {
+    } elsif ($propertyValueType eq "-" || $propertyValueType eq "Reverse-merged") {
         $propertyChangeDelta = -1;
     } else {
         die("Not reached.");
@@ -1093,7 +1093,7 @@ sub parseSvnPropertyValue($$)
         $propertyValue = $2; # Does not include the end-of-line character(s).
         $eol = $POSTMATCH;
     } else {
-        die("Failed to find property value beginning with '+' or '-': \"$_\".");
+        die("Failed to find property value beginning with '+', '-', 'Merged', or 'Reverse-merged': \"$_\".");
     }
 
     while (<$fileHandle>) {
index e305484..4f05431 100644 (file)
@@ -60,6 +60,55 @@ undef],
 },
 {
     # New test
+    diffName => "simple: add svn:mergeinfo",
+    inputText => <<'END',
+Property changes on: Makefile
+___________________________________________________________________
+Added: svn:mergeinfo
+   Merged /trunk/Makefile:r33020
+END
+    expectedReturn => [
+{
+    propertyPath => "Makefile",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "simple: delete svn:mergeinfo",
+    inputText => <<'END',
+Property changes on: Makefile
+___________________________________________________________________
+Deleted: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+END
+    expectedReturn => [
+{
+    propertyPath => "Makefile",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "simple: modified svn:mergeinfo",
+    inputText => <<'END',
+Property changes on: Makefile
+___________________________________________________________________
+Modified: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile:r41697
+END
+    expectedReturn => [
+{
+    propertyPath => "Makefile",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
     diffName => "simple: delete svn:executable",
     inputText => <<'END',
 Property changes on: FileA
index bdca1ab..6914051 100644 (file)
@@ -73,11 +73,77 @@ END
 undef],
     expectedNextLine => undef,
 },
+{
+    # New test
+    diffName => "simple: add svn:mergeinfo",
+    inputText => <<'END',
+Added: svn:mergeinfo
+   Merged /trunk/Makefile:r33020
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => 1,
+    value => "/trunk/Makefile:r33020",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "simple: delete svn:mergeinfo",
+    inputText => <<'END',
+Deleted: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => -1,
+    value => "/trunk/Makefile:r33020",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "simple: modified svn:mergeinfo",
+    inputText => <<'END',
+Modified: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile:r41697
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => 1,
+    value => "/trunk/Makefile:r41697",
+},
+undef],
+    expectedNextLine => undef,
+},
 ####
 # Using SVN 1.4 syntax
 ##
 {
     # New test
+    diffName => "simple: modified svn:mergeinfo using SVN 1.4 syntax",
+    inputText => <<'END',
+Name: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile:r41697
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => 1,
+    value => "/trunk/Makefile:r41697",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
     diffName => "simple: delete svn:executable using SVN 1.4 syntax",
     inputText => <<'END',
 Name: svn:executable
@@ -459,6 +525,40 @@ END
 "Added: svn:executable\n"],
     expectedNextLine => "   + *\n",
 },
+{
+    # New test
+    diffName => "'Merged' change followed by 'Merged' change",
+    inputText => <<'END',
+Added: svn:mergeinfo
+   Merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile.shared:r58350
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => 1,
+    value => "/trunk/Makefile.shared:r58350",
+},
+undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "'Reverse-merged' change followed by 'Reverse-merged' change",
+    inputText => <<'END',
+Deleted: svn:mergeinfo
+   Reverse-merged /trunk/Makefile:r33020
+   Reverse-merged /trunk/Makefile.shared:r58350
+END
+    expectedReturn => [
+{
+    name => "svn:mergeinfo",
+    propertyChangeDelta => -1,
+    value => "/trunk/Makefile.shared:r58350",
+},
+undef],
+    expectedNextLine => undef,
+},
 ####
 # Property values with trailing new lines.
 ##
index 5fc2ff1..2de8ae3 100644 (file)
@@ -58,6 +58,24 @@ END
 },
 {
     # New test
+    diffName => "'Merged' change",
+    inputText => <<'END',
+   Merged /trunk/Makefile:r33020
+END
+    expectedReturn => ["/trunk/Makefile:r33020", undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "'Reverse-merged' change",
+    inputText => <<'END',
+   Reverse-merged /trunk/Makefile:r33020
+END
+    expectedReturn => ["/trunk/Makefile:r33020", undef],
+    expectedNextLine => undef,
+},
+{
+    # New test
     diffName => "single-line '-' change followed by empty line with Unix line endings",
     inputText => <<'END',
    - *
@@ -152,6 +170,47 @@ END
     expectedReturn => ["A\nlong sentence that spans\nmultiple lines.", "   + Another\n"],
     expectedNextLine => "long sentence that spans\n",
 },
+{
+    # New test
+    diffName => "'Reverse-merged' change followed by 'Merge' change",
+    inputText => <<'END',
+   Reverse-merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile:r41697
+END
+    expectedReturn => ["/trunk/Makefile:r33020", "   Merged /trunk/Makefile:r41697\n"],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "'Merged' change followed by 'Merge' change",
+    inputText => <<'END',
+   Merged /trunk/Makefile:r33020
+   Merged /trunk/Makefile.shared:r58350
+END
+    expectedReturn => ["/trunk/Makefile:r33020", "   Merged /trunk/Makefile.shared:r58350\n"],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "'Reverse-merged' change followed by 'Reverse-merged' change",
+    inputText => <<'END',
+   Reverse-merged /trunk/Makefile:r33020
+   Reverse-merged /trunk/Makefile.shared:r58350
+END
+    expectedReturn => ["/trunk/Makefile:r33020", "   Reverse-merged /trunk/Makefile.shared:r58350\n"],
+    expectedNextLine => undef,
+},
+{
+    # New test
+    diffName => "'Reverse-merged' change followed by 'Reverse-merged' change followed by 'Merged' change",
+    inputText => <<'END',
+   Reverse-merged /trunk/Makefile:r33020
+   Reverse-merged /trunk/Makefile.shared:r58350
+   Merged /trunk/ChangeLog:r64190
+END
+    expectedReturn => ["/trunk/Makefile:r33020", "   Reverse-merged /trunk/Makefile.shared:r58350\n"],
+    expectedNextLine => "   Merged /trunk/ChangeLog:r64190\n",
+},
 );
 
 my $testCasesCount = @testCaseHashRefs;