Commit 4ec44f54 authored by Steve McIntyre's avatar Steve McIntyre

Cope with being called from directories other than the webwml root

Added extra directory handling code to allow for this where it makes
sense. This should now work for all public APIs, except:

 * cache_file()
 * cache_repo()
 * path_info()
 * get_topdir()

The first two are almost internal anyway, and the last doesn't take
any arguments to allow for anything to work *except* when the caller
is somewhere within the webwml repo. path_info() is *hard* to change
here, and all the callers I can find are already expecting to be in
webwml anyway. I've added checks in each of these to at least complain
clearly when expectations are not met.

These changes might slow things down slightly due to repeated chdir()
calls, but meh.

Also added some extra tests for this in the vcs-test.pl script.
parent 688cde2d
This diff is collapsed.
......@@ -13,6 +13,7 @@ use Local::Cvsinfo;
use Local::VCS;
use Webwml::TransCheck;
use Webwml::Langs;
use Cwd qw/cwd/;
my $file = "english/CD/faq/index.wml";
my $rev1;
......@@ -96,6 +97,33 @@ if (!defined $ret) {
}
print "4. (old, new) returned $ret\n";
##########################################################
print "#############################\n";
print "VCS->cmp_rev::: from another directory\n";
my $startdir = cwd;
chdir "/tmp";
$ret = $VCS->cmp_rev("$startdir/$file", , ,);
if (!defined $ret) {
$ret = "<undef>";
}
print "1. (no revs specified) returned $ret\n";
$ret = $VCS->cmp_rev("$startdir/english/../english/CD/faq/index.wml", $rev1, $rev1);
if (!defined $ret) {
$ret = "<undef>";
}
print "2. (equal revs) returned $ret\n";
$ret = $VCS->cmp_rev("$startdir/english/CD/faq/index.wml", $rev1, $rev2);
if (!defined $ret) {
$ret = "<undef>";
}
print "3. (new, old) returned $ret\n";
$ret = $VCS->cmp_rev("$startdir/english/CD/faq/index.wml", $rev2, $rev1);
if (!defined $ret) {
$ret = "<undef>";
}
print "4. (old, new) returned $ret\n";
chdir "$startdir";
##########################################################
print "#############################\n";
print "VCS->count_changes:::\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment