Changeset 46236 in webkit
- Timestamp:
- Jul 22, 2009 1:32:35 PM (15 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r46235 r46236 1 2009-07-22 Peter Kasting <pkasting@google.com> 2 3 Reviewed by David Kilzer. 4 5 https://bugs.webkit.org/show_bug.cgi?id=27323 6 Factor svn-create-patch's "determineSvnRoot()" into a function in 7 VCSUtils.pm so commit-log-editor can use it too. 8 9 * Scripts/VCSUtils.pm: Add determineSVNRoot(). 10 * Scripts/commit-log-editor: Use determineSVNRoot() instead of old 11 code (which didn't work as well). 12 * Scripts/svn-create-patch: Remove determineSvnRoot() (moved). 13 1 14 2009-07-22 Jakob Petsovits <jakob.petsovits@torchmobile.com> 2 15 -
trunk/WebKitTools/Scripts/VCSUtils.pm
r42308 r46236 37 37 $VERSION = 1.00; 38 38 @ISA = qw(Exporter); 39 @EXPORT = qw(&isGitDirectory &isGit &isSVNDirectory &isSVN & makeFilePathRelative);39 @EXPORT = qw(&isGitDirectory &isGit &isSVNDirectory &isSVN &determineSVNRoot &makeFilePathRelative); 40 40 %EXPORT_TAGS = ( ); 41 41 @EXPORT_OK = (); … … 105 105 } 106 106 107 sub determineSVNRoot() 108 { 109 my $devNull = File::Spec->devnull(); 110 my $last = ''; 111 my $path = '.'; 112 my $parent = '..'; 113 my $repositoryUUID; 114 while (1) { 115 my $thisUUID; 116 # Ignore error messages in case we've run past the root of the checkout. 117 open INFO, "svn info '$path' 2> $devNull |" or die; 118 while (<INFO>) { 119 if (/^Repository UUID: (.+)/) { 120 $thisUUID = $1; 121 { local $/ = undef; <INFO>; } # Consume the rest of the input. 122 } 123 } 124 close INFO; 125 126 # It's possible (e.g. for developers of some ports) to have a WebKit 127 # checkout in a subdirectory of another checkout. So abort if the 128 # repository UUID suddenly changes. 129 last if !$thisUUID; 130 if (!$repositoryUUID) { 131 $repositoryUUID = $thisUUID; 132 } 133 last if $thisUUID ne $repositoryUUID; 134 135 $last = $path; 136 $path = File::Spec->catdir($parent, $path); 137 } 138 139 return File::Spec->rel2abs($last); 140 } 141 107 142 sub svnRevisionForDirectory($) 108 143 { -
trunk/WebKitTools/Scripts/commit-log-editor
r45993 r46236 180 180 return dirname($gitDir); 181 181 } elsif (isSVN()) { 182 open(INFO, "-|", qw(svn info)) or die; 183 my ($root, $url); 184 while (my $line = <INFO>) { 185 if ($line =~ /^Repository Root: (.*)$/) { 186 $root = $1; 187 } elsif ($line =~ /^URL: (.*)$/) { 188 $url = $1; 189 } 190 } 191 close(INFO); 192 193 my $path = $url; 194 $path =~ s/^\Q$root\E//; 195 $path =~ s/^\/?(branches\/[^\/]*|trunk)\/?//; 196 return File::Spec->rel2abs(File::Spec->catdir(map { ".." } File::Spec->splitdir($path))); 182 return determineSVNRoot(); 197 183 } 198 184 } -
trunk/WebKitTools/Scripts/svn-create-patch
r46134 r46236 45 45 46 46 use Config; 47 use Cwd ;47 use Cwd qw(); # "qw()" prevents warnings if we later (indirectly) "use POSIX;". 48 48 use File::Basename; 49 49 use File::Spec; 50 50 use File::stat; 51 use FindBin; 51 52 use Getopt::Long; 53 use lib $FindBin::Bin; 52 54 use MIME::Base64; 53 55 use POSIX qw(:errno_h); 54 56 use Time::gmtime; 57 use VCSUtils; 55 58 56 59 sub binarycmp($$); 57 60 sub canonicalizePath($); 58 61 sub chdirAndGetDifference($); 59 sub determineSvnRoot();60 62 sub findBaseUrl($); 61 63 sub findMimeType($;$); … … 98 100 } 99 101 100 my $svnRoot = determineS vnRoot();102 my $svnRoot = determineSVNRoot(); 101 103 my $prefix = chdirAndGetDifference($svnRoot); 102 104 … … 468 470 return File::Spec->abs2rel($before, $after); 469 471 } 470 471 sub determineSvnRoot()472 {473 my $last = '';474 my $path = '.';475 my $parent = '..';476 my $repositoryUUID;477 while (1) {478 my $thisUUID;479 # Ignore error messages in case we've run past the root of the checkout.480 open INFO, "svn info '$path' 2> $devNull |" or die;481 while (<INFO>) {482 if (/^Repository UUID: (.+)/) {483 $thisUUID = $1;484 { local $/ = undef; <INFO>; } # Consume the rest of the input.485 }486 }487 close INFO;488 489 # It's possible (e.g. for developers of some ports) to have a WebKit490 # checkout in a subdirectory of another checkout. So abort if the491 # repository UUID suddenly changes.492 last if !$thisUUID;493 if (!$repositoryUUID) {494 $repositoryUUID = $thisUUID;495 }496 last if $thisUUID ne $repositoryUUID;497 498 $last = $path;499 $path = File::Spec->catdir($parent, $path);500 }501 502 return File::Spec->rel2abs($last);503 }
Note: See TracChangeset
for help on using the changeset viewer.