diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebKitTools/Scripts/svn-apply | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebKitTools/Scripts/svn-apply')
-rwxr-xr-x | WebKitTools/Scripts/svn-apply | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/WebKitTools/Scripts/svn-apply b/WebKitTools/Scripts/svn-apply index 0373aa5..f586211 100755 --- a/WebKitTools/Scripts/svn-apply +++ b/WebKitTools/Scripts/svn-apply @@ -2,6 +2,7 @@ # Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> +# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -116,10 +117,9 @@ my %removeDirectoryIgnoreList = ( '_svn' => 1, ); -my $globalExitCode = 0; +my $globalExitStatus = 0; -my $pathScriptWasRunFrom = Cwd::getcwd(); -my $pathForRepositoryRoot = determineVCSRoot(); +my $repositoryRootPath = determineVCSRoot(); my %checkedDirectories; my %copiedFiles; @@ -133,7 +133,7 @@ my $patch; while (<>) { s/([\n\r]+)$//mg; my $eol = $1; - if (!defined($indexPath) && m#^diff --git a/#) { + if (!defined($indexPath) && m#^diff --git \w/#) { $filter = \&gitdiff2svndiff; } $_ = &$filter($_) if $filter; @@ -193,7 +193,7 @@ for $patch (@patches) { removeDirectoriesIfNeeded(); -exit $globalExitCode; +exit $globalExitStatus; sub addDirectoriesIfNeeded($) { @@ -224,25 +224,22 @@ sub addDirectoriesIfNeeded($) } } +# Args: +# $patch: a patch string. +# $pathRelativeToRoot: the path of the file to be patched, relative to the +# repository root. This should normally be the path +# found in the patch's "Index:" line. +# $options: a reference to an array of options to pass to the patch command. sub applyPatch($$;$) { - my ($patch, $fullPath, $options) = @_; - chdir $pathForRepositoryRoot; - $options = [] if (! $options); - push @{$options}, "--force" if $force; - my $command = "patch " . join(" ", "-p0", @{$options}); - open PATCH, "| $command" or die "Failed to patch $fullPath\n"; - print PATCH $patch; - close PATCH; - chdir $pathScriptWasRunFrom; - - my $exitCode = $? >> 8; - if ($exitCode) { - if (!$force) { - print "$command \"$fullPath\" returned $exitCode. Pass --force to ignore patch failures.\n"; - exit $exitCode; - } - $globalExitCode = $exitCode; + my ($patch, $pathRelativeToRoot, $options) = @_; + + my $optionalArgs = {options => $options, ensureForce => $force}; + + my $exitStatus = runPatchCommand($patch, $repositoryRootPath, $pathRelativeToRoot, $optionalArgs); + + if ($exitStatus) { + $globalExitStatus = $exitStatus; } } |