use strict;
use Getopt::Long;
use Cwd qw(getcwd abs_path);
+use File::Basename;
# things that can happen when mr runs a command
use constant {
}
print "$actionmsg\n" unless $quiet || $minimal;
- my $hookret=hook("pre_$action", $topdir, $subdir);
+ my ($hookret, $hook_out)=hook("pre_$action", $topdir, $subdir);
return $hookret if $hookret != OK;
my ($ret, $out)=runsh $action, $topdir, $subdir,
return FAILED;
}
}
- my $ret=hook("fixups", $topdir, $subdir);
+ my ($ret, $hook_out)=hook("fixups", $topdir, $subdir);
return $ret if $ret != OK;
}
my @toload;
my $in;
+ my $absf=abs_path($f);
my $trusted;
if (ref $f eq 'GLOB') {
$dir="";
$trusted=1;
}
else {
- my $absf=abs_path($f);
if ($loaded{$absf}) {
return;
}
}
$dir=abs_path($dir)."/";
-
+
+ if (chdir($dir)) {
+ $f=basename($f);
+ }
+
if (! exists $configfiles{$dir}) {
$configfiles{$dir}=$f;
}
if ($parent eq '/') {
$parent="";
}
+ loadconfig($parent);
if (exists $config{$parent} &&
exists $config{$parent}{DEFAULT}) {
$config{$dir}{DEFAULT}={ %{$config{$parent}{DEFAULT}} };
return;
}
- print "mr: loading config $f\n" if $verbose;
+ if ($f =~ /\//) {
+ print "mr: loading config $f\n" if $verbose;
+ } else {
+ print "mr: loading config $f (from ".getcwd().")\n" if $verbose;
+ }
+
open($in, "<", $f) || die "mr: open $f: $!\n";
}
my @lines=<$in>;
"this can allow arbitrary code execution!)\n";
}
else {
- die "mr: $msg in untrusted $f line $lineno\n".
+ die "mr: $msg in untrusted $absf line $lineno\n".
"(To trust this file, list it in ~/.mrtrust.)\n";
}
};
git_svn_grep = git grep "$@"
git_grep = git grep "$@"
bzr_grep = ack-grep "$@"
+darcs_grep = ack-grep "$@"
run = "$@"