summaryrefslogtreecommitdiffstats
path: root/Tools/Scripts/svn-apply
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Scripts/svn-apply')
-rwxr-xr-xTools/Scripts/svn-apply18
1 files changed, 14 insertions, 4 deletions
diff --git a/Tools/Scripts/svn-apply b/Tools/Scripts/svn-apply
index cab7fb4..0c2e5e5 100755
--- a/Tools/Scripts/svn-apply
+++ b/Tools/Scripts/svn-apply
@@ -244,8 +244,6 @@ sub handleGitBinaryChange($$)
my $contents = $diffHashRef->{svnConvertedText};
my ($binaryChunkType, $binaryChunk, $reverseBinaryChunkType, $reverseBinaryChunk) = decodeGitBinaryPatch($contents, $fullPath);
- # FIXME: support "delta" type.
- die "only literal type is supported now" if ($binaryChunkType ne "literal" || $reverseBinaryChunkType ne "literal");
my $isFileAddition = $diffHashRef->{isNew};
my $isFileDeletion = $diffHashRef->{isDeletion};
@@ -257,14 +255,26 @@ sub handleGitBinaryChange($$)
$originalContents = join("", <FILE>);
close FILE;
}
- die "Original content of $fullPath mismatches" if $originalContents ne $reverseBinaryChunk;
+
+ if ($reverseBinaryChunkType eq "literal") {
+ die "Original content of $fullPath mismatches" if $originalContents ne $reverseBinaryChunk;
+ }
if ($isFileDeletion) {
scmRemove($fullPath);
} else {
# Addition or Modification
+ my $out = "";
+ if ($binaryChunkType eq "delta") {
+ $out = applyGitBinaryPatchDelta($binaryChunk, $originalContents);
+ } else {
+ $out = $binaryChunk;
+ }
+ if ($reverseBinaryChunkType eq "delta") {
+ die "Original content of $fullPath mismatches" if $originalContents ne applyGitBinaryPatchDelta($reverseBinaryChunk, $out);
+ }
open FILE, ">", $fullPath or die "Failed to open $fullPath.";
- print FILE $binaryChunk;
+ print FILE $out;
close FILE;
if ($isFileAddition) {
scmAdd($fullPath);