Moved svn 1.6 version check into VCSUtils::isSVNVersion16OrNewer()
Reviewed by Eric Seidel.
* Scripts/VCSUtils.pm:
(@EXPORT): Added &isSVNVersion16OrNewer.
(svnVersion): Added. Internal method that gets the SVN version
and caches it.
(isSVNVersion16OrNewer): Added. Method that does the SVN 1.6
version check.
* Scripts/prepare-ChangeLog: Switched to use new
isSVNVersion16OrNewer() method.
* Scripts/resolve-ChangeLogs: Ditto.
* Scripts/svn-create-patch: Ditto.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47970 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 76ca3c8..2a3d670 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,5 +1,22 @@
2009-09-02 David Kilzer <ddkilzer@apple.com>
+ Moved svn 1.6 version check into VCSUtils::isSVNVersion16OrNewer()
+
+ Reviewed by Eric Seidel.
+
+ * Scripts/VCSUtils.pm:
+ (@EXPORT): Added &isSVNVersion16OrNewer.
+ (svnVersion): Added. Internal method that gets the SVN version
+ and caches it.
+ (isSVNVersion16OrNewer): Added. Method that does the SVN 1.6
+ version check.
+ * Scripts/prepare-ChangeLog: Switched to use new
+ isSVNVersion16OrNewer() method.
+ * Scripts/resolve-ChangeLogs: Ditto.
+ * Scripts/svn-create-patch: Ditto.
+
+2009-09-02 David Kilzer <ddkilzer@apple.com>
+
Clean up VCSUtils.pm
Reviewed by Eric Seidel.
diff --git a/WebKitTools/Scripts/VCSUtils.pm b/WebKitTools/Scripts/VCSUtils.pm
index a8f0314..5223c92 100644
--- a/WebKitTools/Scripts/VCSUtils.pm
+++ b/WebKitTools/Scripts/VCSUtils.pm
@@ -49,6 +49,7 @@
&isGitDirectory
&isSVN
&isSVNDirectory
+ &isSVNVersion16OrNewer
&makeFilePathRelative
&pathRelativeToSVNRepositoryRootForPath
&svnRevisionForDirectory
@@ -64,6 +65,7 @@
my $isGit;
my $isGitBranchBuild;
my $isSVN;
+my $svnVersion;
sub isGitDirectory($)
{
@@ -121,6 +123,24 @@
return $isSVN;
}
+sub svnVersion()
+{
+ return $svnVersion if defined $svnVersion;
+
+ if (!isSVN()) {
+ $svnVersion = 0;
+ } else {
+ chomp($svnVersion = `svn --version --quiet`);
+ }
+ return $svnVersion;
+}
+
+sub isSVNVersion16OrNewer()
+{
+ my $version = svnVersion();
+ return eval "v$version" ge v1.6;
+}
+
sub chdirReturningRelativePath($)
{
my ($directory) = @_;
diff --git a/WebKitTools/Scripts/prepare-ChangeLog b/WebKitTools/Scripts/prepare-ChangeLog
index 19842bc..1f79081 100755
--- a/WebKitTools/Scripts/prepare-ChangeLog
+++ b/WebKitTools/Scripts/prepare-ChangeLog
@@ -151,8 +151,6 @@
my $SVN = "svn";
my $GIT = "git";
-my $svnVersion = `svn --version --quiet` if $isSVN;
-
# Find the list of modified files
my @changed_files;
my $changed_files_string;
@@ -1438,7 +1436,7 @@
if ($isSVN) {
my $matches;
- if (eval "v$svnVersion" ge v1.6) {
+ if (isSVNVersion16OrNewer()) {
$matches = /^([ ACDMR])([ CM]).{5} (.+?)[\r\n]*$/;
$status = $1;
$propertyStatus = $2;
diff --git a/WebKitTools/Scripts/resolve-ChangeLogs b/WebKitTools/Scripts/resolve-ChangeLogs
index 0d136cd..db497f9 100755
--- a/WebKitTools/Scripts/resolve-ChangeLogs
+++ b/WebKitTools/Scripts/resolve-ChangeLogs
@@ -64,8 +64,6 @@
my $SVN = "svn";
my $GIT = "git";
-my $svnVersion = `svn --version --quiet` if $isSVN;
-
my $fixMerged;
my $gitRebaseContinue = 0;
my $printWarnings = 1;
@@ -256,7 +254,7 @@
if ($isSVN) {
my $matches;
my $file;
- if (eval "v$svnVersion" ge v1.6) {
+ if (isSVNVersion16OrNewer()) {
$matches = /^([C]).{6} (.+?)[\r\n]*$/;
$file = $2;
} else {
diff --git a/WebKitTools/Scripts/svn-create-patch b/WebKitTools/Scripts/svn-create-patch
index 6e61164..e91f00d 100755
--- a/WebKitTools/Scripts/svn-create-patch
+++ b/WebKitTools/Scripts/svn-create-patch
@@ -77,7 +77,6 @@
$ENV{'LC_ALL'} = 'C';
my $showHelp;
-my $svnVersion = `svn --version --quiet`;
my $devNull = File::Spec->devnull();
my $result = GetOptions(
@@ -292,7 +291,7 @@
$line =~ s/[\r\n]+$//g;
my $stat;
my $path;
- if (eval "v$svnVersion" ge v1.6) {
+ if (isSVNVersion16OrNewer()) {
$stat = substr($line, 0, 8);
$path = substr($line, 8);
} else {