rcs_getctime and rcs_getmtime take relative filenames

There was some confusion about whether the filename was
relative to srcdir or not. Some test cases, and the bzr
plugin assumed it was relative to the srcdir. Most everything else
assumed it was absolute.

Changed it to relative, for consistency with the rest
of the rcs_ functions.
master
Joey Hess 2010-06-23 19:32:53 -04:00
parent ecdfd1b864
commit d8e4b51a41
7 changed files with 12 additions and 16 deletions

View File

@ -459,7 +459,7 @@ sub rcs_diff ($) {
}
sub rcs_getctime ($) {
my $file=shift;
my $file=$config{srcdir}."/".shift();
my $cvs_log_infoline=qr/^date: (.+);\s+author/;

View File

@ -396,14 +396,11 @@ sub rcs_getctime ($) {
eval q{use XML::Simple};
local $/=undef;
my $filer=substr($file, length($config{srcdir}));
$filer =~ s:^[/]+::;
my $child = open(LOG, "-|");
if (! $child) {
exec("darcs", "changes", "--xml", "--reverse",
"--repodir", $config{srcdir}, $filer)
|| error("'darcs changes $filer' failed to run");
"--repodir", $config{srcdir}, $file)
|| error("'darcs changes $file' failed to run");
}
my $data;
@ -418,7 +415,7 @@ sub rcs_getctime ($) {
my $datestr = $log->{patch}[0]->{local_date};
if (! defined $datestr) {
warn "failed to get ctime for $filer";
warn "failed to get ctime for $file";
return 0;
}

View File

@ -658,9 +658,6 @@ sub findtimes ($$) {
my $file=shift;
my $id=shift; # 0 = mtime ; 1 = ctime
# Remove srcdir prefix
$file =~ s/^\Q$config{srcdir}\E\/?//;
if (! keys %time_cache) {
my $date;
foreach my $line (run_or_die('git', 'log',

View File

@ -237,7 +237,7 @@ sub rcs_getctime ($) {
my ($file) = @_;
my @cmdline = ("hg", "-R", $config{srcdir}, "log", "-v",
"--style", "default", $file);
"--style", "default", "$config{srcdir}/$file");
open (my $out, "-|", @cmdline);
my @log = (mercurial_log($out));

View File

@ -366,7 +366,7 @@ sub findtimes ($) {
my $child = open(SVNLOG, "-|");
if (! $child) {
exec("svn", "log", $file) || error("svn log $file failed to run");
exec("svn", "log", "$config{srcdir}/$file") || error("svn log failed to run");
}
my ($cdate, $mdate);
@ -376,10 +376,10 @@ sub findtimes ($) {
$mdate=$1 unless defined $mdate;
}
}
close SVNLOG || error "svn log $file exited $?";
close SVNLOG || error "svn log exited $?";
if (! defined $cdate) {
error "failed to parse svn log for $file\n";
error "failed to parse svn log for $file";
}
eval q{use Date::Parse};

View File

@ -374,7 +374,7 @@ sub find_new_files ($) {
}
eval {
my $ctime=rcs_getctime("$config{srcdir}/$file");
my $ctime=rcs_getctime($file);
if ($ctime > 0) {
$pagectime{$page}=$ctime;
}
@ -384,7 +384,7 @@ sub find_new_files ($) {
}
my $mtime;
eval {
$mtime=rcs_getmtime("$config{srcdir}/$file");
$mtime=rcs_getmtime($file);
};
if ($@) {
print STDERR $@;

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ ikiwiki (3.20100624) UNRELEASED; urgency=low
* API: Add new optional field usershort to rcs_recentchanges.
* API: rcs_commit and rcs_commit_staged are now passed named
parameters.
* Fixed some confusion and bugginess about whether
rcs_getctime/rcs_getmtime were passed absolute or relative filenames.
-- Joey Hess <joeyh@debian.org> Wed, 23 Jun 2010 15:30:04 -0400