Allow Subversion inputs to specify a revision number.

This commit is contained in:
Ludovic Courtès 2011-10-04 16:15:22 +00:00
parent 9f9cf7280e
commit 96b4db1e99

View file

@ -157,18 +157,22 @@ sub fetchInputPath {
sub fetchInputSVN { sub fetchInputSVN {
my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_; my ($db, $project, $jobset, $name, $type, $value, $checkout) = @_;
my $uri = $value; # Allow users to specify a revision number next to the URI.
my ($uri, $revision) = split ' ', $value;
my $sha256; my $sha256;
my $storePath; my $storePath;
# First figure out the last-modified revision of the URI.
my @cmd = (["svn", "ls", "-v", "--depth", "empty", $uri],
"|", ["sed", 's/^ *\([0-9]*\).*/\1/']);
my $stdout; my $stderr; my $stdout; my $stderr;
die "Cannot get head revision of Subversion repository at `$uri':\n$stderr"
unless IPC::Run::run(@cmd, \$stdout, \$stderr); unless (defined $revision) {
my $revision = $stdout; chomp $revision; # First figure out the last-modified revision of the URI.
my @cmd = (["svn", "ls", "-v", "--depth", "empty", $uri],
"|", ["sed", 's/^ *\([0-9]*\).*/\1/']);
die "Cannot get head revision of Subversion repository at `$uri':\n$stderr"
unless IPC::Run::run(@cmd, \$stdout, \$stderr);
$revision = $stdout; chomp $revision;
}
die unless $revision =~ /^\d+$/; die unless $revision =~ /^\d+$/;
(my $cachedInput) = $db->resultset('CachedSubversionInputs')->search( (my $cachedInput) = $db->resultset('CachedSubversionInputs')->search(