X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/8b4f49ea7f031b0374df3fc2dcb4700be8ab13ce..09af48cd838965e18f3b408d931fd0c8c44a16aa:/mr diff --git a/mr b/mr index 1923506..23178a5 100755 --- a/mr +++ b/mr @@ -212,6 +212,13 @@ Use the specified mrconfig file. The default is to use both F<~/.mrconfig> as well as look for a F<.mrconfig> file in the current directory, or in one of its parent directories. +=item -f + +=item --force + +Force mr to act on repositories that would normally be skipped due to their +configuration. + =item -v =item --verbose @@ -367,7 +374,7 @@ been at least 12 hours since the last update. Another way to use skip is for a lazy checkout. This makes mr skip operating on a repo unless it already exists. To enable the -repo, you have to explicitly check it out (using "mr -d foo checkout"). +repo, you have to explicitly check it out (using "mr --force -d foo checkout"). [foo] checkout = ... @@ -530,6 +537,7 @@ my $config_overridden=0; my $verbose=0; my $quiet=0; my $stats=0; +my $force=0; my $insecure=0; my $interactive=0; my $max_depth; @@ -538,6 +546,7 @@ my $jobs=1; my $trust_all=0; my $directory=getcwd(); +my $HOME_MR_CONFIG = "$ENV{HOME}/.mrconfig"; $ENV{MR_CONFIG}=find_mrconfig(); # globals :-( @@ -618,7 +627,7 @@ sub vcs_test { } next; } - my $vcs=$vcs_test =~ /(.*)_test/; + my ($vcs)=$vcs_test =~ /(.*)_test/; $test="my_$vcs_test() {\n$config{$topdir}{$subdir}{$vcs_test}\n}\n".$test; $test.="if my_$vcs_test; then echo $vcs; fi\n"; } @@ -693,6 +702,8 @@ sub action { $ENV{MR_ACTION}=$action; foreach my $testname ("skip", "deleted") { + next if $force && $testname eq "skip"; + my $testcommand=findcommand($testname, $dir, $topdir, $subdir, $is_checkout); if (defined $testcommand) { @@ -1092,14 +1103,14 @@ sub is_trusted_config { my $config=shift; # must be abs_pathed already # We always trust ~/.mrconfig. - return 1 if $config eq abs_path("$ENV{HOME}/.mrconfig"); + return 1 if $config eq abs_path($HOME_MR_CONFIG); return 1 if $trust_all; my $trustfile=$ENV{HOME}."/.mrtrust"; if (! %trusted) { - $trusted{"$ENV{HOME}/.mrconfig"}=1; + $trusted{$HOME_MR_CONFIG}=1; if (open (TRUST, "<", $trustfile)) { while () { chomp; @@ -1722,7 +1733,7 @@ sub find_mrconfig { } $dir=~s/\/[^\/]*$//; } - return "$ENV{HOME}/.mrconfig"; + return $HOME_MR_CONFIG; } sub getopts { @@ -1732,6 +1743,7 @@ sub getopts { "d|directory=s" => sub { $directory=abs_path($_[1]) }, "c|config=s" => sub { $ENV{MR_CONFIG}=$_[1]; $config_overridden=1 }, "p|path" => sub { }, # now default, ignore + "f|force" => \$force, "v|verbose" => \$verbose, "q|quiet" => \$quiet, "s|stats" => \$stats, @@ -1791,7 +1803,7 @@ sub main { init(); startingconfig(); - loadconfig("$ENV{HOME}/.mrconfig"); + loadconfig($HOME_MR_CONFIG); loadconfig($ENV{MR_CONFIG}); #use Data::Dumper; print Dumper(\%config); @@ -1848,7 +1860,7 @@ lib = LANG=C bzr info | egrep -q '^Checkout' } lazy() { - if [ "$MR_ACTION" = checkout ] || [ -d "$MR_REPO" ]; then + if [ -d "$MR_REPO" ]; then return 1 else return 0