Reviewed by Adam.
Make svn-apply and svn-unapply work with git-diff formatted patches.
* Scripts/svn-apply: Apply a filter to the input if we find a git-diff marker before a patch.
(gitdiff2svndiff): Added.
* Scripts/svn-unapply: Ditto.
(gitdiff2svndiff): Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25751
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-09-25 David Kilzer <ddkilzer@webkit.org>
+
+ Reviewed by Adam.
+
+ Make svn-apply and svn-unapply work with git-diff formatted patches.
+
+ * Scripts/svn-apply: Apply a filter to the input if we find a git-diff marker before a patch.
+ (gitdiff2svndiff): Added.
+ * Scripts/svn-unapply: Ditto.
+ (gitdiff2svndiff): Added.
+
2007-09-25 Adam Roben <aroben@apple.com>
Pull advapi32.lib into WebKitInitializer
#!/usr/bin/perl -w
-# Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+# Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# the patch to today's date using $changeLogTimeZone.
# Handles binary files (requires patches made by svn-create-patch).
# Handles copied and moved files (requires patches made by svn-create-patch).
+# Handles git-diff patches (without binary changes) created at the top-level directory
#
# Missing features:
#
# Notice a patch that's being applied at the "wrong level" and make it work anyway.
# Do a dry run on the whole patch and don't do anything if part of the patch is
# going to fail (probably too strict unless we exclude ChangeLog).
+# Handle git-diff patches with binary changes
use strict;
use warnings;
sub applyPatch($$;$);
sub checksum($);
sub fixChangeLogPatch($);
+sub gitdiff2svndiff($);
sub handleBinaryChange($$);
sub isDirectoryEmptyForRemoval($);
sub patch($);
my %versions;
my $copiedFromPath;
+my $filter;
my $indexPath;
my $patch;
while (<>) {
s/\r//g;
chomp;
+ if (!defined($indexPath) && m#^diff --git a/#) {
+ $filter = \&gitdiff2svndiff;
+ }
+ $_ = &$filter($_) if $filter;
if (/^Index: (.+)/) {
$indexPath = $1;
if ($patch) {
return $newPatch;
}
+sub gitdiff2svndiff($)
+{
+ $_ = shift @_;
+ if (m#^diff --git a/(.+) b/(.+)#) {
+ return "Index: $1";
+ } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
+ return "===================================================================";
+ } elsif (m#^--- a/(.+)#) {
+ return "--- $1";
+ } elsif (m#^\+\+\+ b/(.+)#) {
+ return "+++ $1";
+ }
+ return $_;
+}
+
sub handleBinaryChange($$)
{
my ($fullPath, $contents) = @_;
#!/usr/bin/perl -w
-# Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
+# Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# the patch before it is applied (svn-apply sets it when applying a patch).
# Handles binary files (requires patches made by svn-create-patch).
# Handles copied and moved files (requires patches made by svn-create-patch).
+# Handles git-diff patches (without binary changes) created at the top-level directory
#
# Missing features:
#
# Notice a patch that's being unapplied at the "wrong level" and make it work anyway.
# Do a dry run on the whole patch and don't do anything if part of the patch is
# going to fail (probably too strict unless we exclude ChangeLog).
+# Handle git-diff patches with binary changes
use strict;
use warnings;
sub checksum($);
sub fixChangeLogPatch($);
+sub gitdiff2svndiff($);
sub patch($);
sub revertDirectories();
sub svnStatus($);
my %directoriesToCheck;
my $copiedFromPath;
+my $filter;
my $indexPath;
my $patch;
while (<>) {
s/\r//g;
chomp;
+ if (!defined($indexPath) && m#^diff --git a/#) {
+ $filter = \&gitdiff2svndiff;
+ }
+ $_ = &$filter($_) if $filter;
if (/^Index: (.*)/) {
$indexPath = $1;
if ($patch) {
return $newPatch;
}
+sub gitdiff2svndiff($)
+{
+ $_ = shift @_;
+ if (m#^diff --git a/(.+) b/(.+)#) {
+ return "Index: $1";
+ } elsif (m#^index [0-9a-f]{7}\.\.[0-9a-f]{7} [0-9]{6}#) {
+ return "===================================================================";
+ } elsif (m#^--- a/(.+)#) {
+ return "--- $1";
+ } elsif (m#^\+\+\+ b/(.+)#) {
+ return "+++ $1";
+ }
+ return $_;
+}
+
sub patch($)
{
my ($patch) = @_;