RESOLVED FIXED Bug 38320
svn-apply: Add an "isBinary" property to the hashes returned by parseDiff() and parseDiffHeader()
https://bugs.webkit.org/show_bug.cgi?id=38320
Summary svn-apply: Add an "isBinary" property to the hashes returned by parseDiff() a...
Chris Jerdonek
Reported 2010-04-29 04:43:24 PDT
This will allow us to address part of this FIXME in both svn-apply and svn-unapply: > # FIXME: This information should be extracted from the diff file as > # part of the parsing stage, i.e. the call to parsePatch(). > $addition = 1 if ($patch =~ /\n--- .+\(revision 0\)\r?\n/ || $patch =~ /\n@@ -0,0 .* @@/) && !exists($copiedFiles{$fullPath}); > $deletion = 1 if $patch =~ /\n@@ .* \+0,0 @@/; > $isBinary = 1 if $patch =~ /\nCannot display: file marked as a binary type\./; > $isGitBinary = 1 if $patch =~ /\nGIT binary patch\n/; This can be fixed by adjusting this area of VCSUtils's parseDiffHeader(): > } elsif (s/^\+\+\+ \S+/+++ $indexPath/ || > /^Cannot display: file marked as a binary type.$/ || # SVN binary > /^GIT binary patch$/) { > # +++ > $foundHeaderEnding = 1; > }
Attachments
Proposed patch (16.49 KB, patch)
2010-05-05 13:50 PDT, Chris Jerdonek
no flags
Chris Jerdonek
Comment 1 2010-05-05 13:50:06 PDT
Created attachment 55153 [details] Proposed patch
Chris Jerdonek
Comment 2 2010-05-05 13:52:39 PDT
I didn't know until now that svn-unapply didn't support binary files in Git diffs. How is the commit-queue, etc. able to get away with that?
Eric Seidel (no email)
Comment 3 2010-05-05 19:56:19 PDT
The commit-queue does not use svn-unapply. svn-unapply is basically quilt-like functionality which Darin Adler and others built in WebKit to work around SVN's short-commings.
Daniel Bates
Comment 4 2010-05-06 16:57:03 PDT
How did you come to the decision to remove scmFormat and instead use two different keys isSvn and isGit? I take it to get rid of doing a string comparison.
Chris Jerdonek
Comment 5 2010-05-06 18:40:08 PDT
(In reply to comment #4) > How did you come to the decision to remove scmFormat and instead use two > different keys isSvn and isGit? I take it to get rid of doing a string > comparison. Yes, more or less. I originally thought that a single key-value for the type would be simplest. But in the end the code turned out to be cleaner with two key-value pairs isGit and isSvn.
Chris Jerdonek
Comment 6 2010-05-06 18:50:05 PDT
(In reply to comment #5) > (In reply to comment #4) > > How did you come to the decision to remove scmFormat and instead use two > > different keys isSvn and isGit? I take it to get rid of doing a string > > comparison. > > Yes, more or less. I originally thought that a single key-value for the type > would be simplest. But in the end the code turned out to be cleaner with two > key-value pairs isGit and isSvn. Also, I'm now convinced that using "key not present" is acceptable and even desirable to represent false for our diffHash-related objects. Otherwise, each time we add a specialized property we would have to update every unit test, which isn't scalable. Given that "key not present" is acceptable, having two key-values isGit and isSvn becomes more acceptable since then only one would ever have to be set.
Daniel Bates
Comment 7 2010-05-06 19:33:24 PDT
Comment on attachment 55153 [details] Proposed patch Looks good to me. By the way, I've noticed that we interchange between "SVN", "Svn", and "svn" throughout VCSUtils. Similarly, we interchange between "git" and "Git". We should consider standardizing around one. This does not need to be addressed in this patch, just wanted to point it out.
Chris Jerdonek
Comment 8 2010-05-06 19:54:21 PDT
Comment on attachment 55153 [details] Proposed patch Clearing flags on attachment: 55153 Committed r58929: <http://trac.webkit.org/changeset/58929>
Chris Jerdonek
Comment 9 2010-05-06 19:54:27 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.