OLD | NEW |
1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
2 | 2 |
3 # Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. | 3 # Copyright (C) 2005, 2006, 2007 Apple Inc. All rights reserved. |
4 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 4 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
5 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) | 5 # Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com) |
6 # | 6 # |
7 # Redistribution and use in source and binary forms, with or without | 7 # Redistribution and use in source and binary forms, with or without |
8 # modification, are permitted provided that the following conditions | 8 # modification, are permitted provided that the following conditions |
9 # are met: | 9 # are met: |
10 # | 10 # |
11 # 1. Redistributions of source code must retain the above copyright | 11 # 1. Redistributions of source code must retain the above copyright |
12 # notice, this list of conditions and the following disclaimer. | 12 # notice, this list of conditions and the following disclaimer. |
13 # 2. Redistributions in binary form must reproduce the above copyright | 13 # 2. Redistributions in binary form must reproduce the above copyright |
14 # notice, this list of conditions and the following disclaimer in the | 14 # notice, this list of conditions and the following disclaimer in the |
15 # documentation and/or other materials provided with the distribution. | 15 # documentation and/or other materials provided with the distribution. |
16 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of | 16 # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
17 # its contributors may be used to endorse or promote products derived | 17 # its contributors may be used to endorse or promote products derived |
18 # from this software without specific prior written permission. | 18 # from this software without specific prior written permission. |
19 # | 19 # |
20 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | 20 # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 21 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
23 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 23 # DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 24 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 26 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
27 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 28 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 # "unpatch" script for WebKit Open Source Project, used to remove patches. | 31 # "unpatch" script for WebKit Open Source Project, used to remove patches. |
32 | 32 |
33 # Differences from invoking "patch -p0 -R": | 33 # Differences from invoking "patch -p0 -R": |
34 # | 34 # |
35 # Handles added files (does a svn revert with additional logic to handle local
changes). | 35 # Handles added files (does a svn revert with additional logic to handle local
changes). |
36 # Handles added directories (does a svn revert and a rmdir). | 36 # Handles added directories (does a svn revert and a rmdir). |
37 # Handles removed files (does a svn revert with additional logic to handle loc
al changes). | 37 # Handles removed files (does a svn revert with additional logic to handle loc
al changes). |
38 # Handles removed directories (does a svn revert). | 38 # Handles removed directories (does a svn revert). |
39 # Paths from Index: lines are used rather than the paths on the patch lines, w
hich | 39 # Paths from Index: lines are used rather than the paths on the patch lines, w
hich |
40 # makes patches generated by "cvs diff" work (increasingly unimportant sin
ce we | 40 # makes patches generated by "cvs diff" work (increasingly unimportant sin
ce we |
41 # use Subversion now). | 41 # use Subversion now). |
42 # ChangeLog patches use --fuzz=3 to prevent rejects, and the entry date is res
et in | 42 # ChangeLog patches use --fuzz=3 to prevent rejects, and the entry date is res
et in |
43 # the patch before it is applied (svn-apply sets it when applying a patch)
. | 43 # the patch before it is applied (svn-apply sets it when applying a patch)
. |
44 # Handles binary files (requires patches made by svn-create-patch). | 44 # Handles binary files (requires patches made by svn-create-patch). |
45 # Handles copied and moved files (requires patches made by svn-create-patch). | 45 # Handles copied and moved files (requires patches made by svn-create-patch). |
46 # Handles git-diff patches (without binary changes) created at the top-level d
irectory | 46 # Handles git-diff patches (without binary changes) created at the top-level d
irectory |
47 # | 47 # |
48 # Missing features: | 48 # Missing features: |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 my $patch = shift; | 274 my $patch = shift; |
275 my $newDate; | 275 my $newDate; |
276 sysopen(CHANGELOG, $fullPath, O_RDONLY) or die "Failed to open $fullPath: $!
"; | 276 sysopen(CHANGELOG, $fullPath, O_RDONLY) or die "Failed to open $fullPath: $!
"; |
277 sysseek(CHANGELOG, 0, SEEK_SET); | 277 sysseek(CHANGELOG, 0, SEEK_SET); |
278 my $byteCount = sysread(CHANGELOG, $newDate, 10); | 278 my $byteCount = sysread(CHANGELOG, $newDate, 10); |
279 die "Failed reading $fullPath: $!" if !$byteCount || $byteCount != 10; | 279 die "Failed reading $fullPath: $!" if !$byteCount || $byteCount != 10; |
280 close(CHANGELOG); | 280 close(CHANGELOG); |
281 $patch =~ s/(\n\+)\d{4}-[^-]{2}-[^-]{2}( )/$1$newDate$2/; | 281 $patch =~ s/(\n\+)\d{4}-[^-]{2}-[^-]{2}( )/$1$newDate$2/; |
282 return $patch; | 282 return $patch; |
283 } | 283 } |
OLD | NEW |