X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/32e2e9fd5f9c46126d09f4d3ef4ce601bd56d470..53d1d56fd9100a36b53467ed049276ecc1f7a09e:/mr?ds=sidebyside diff --git a/mr b/mr index b35a3b7..314de60 100755 --- a/mr +++ b/mr @@ -133,8 +133,10 @@ come after it. The "ALIAS" section allows adding aliases for actions. Each parameter is an alias, and its value is the action to use. -All other sections specify where each repository is located, relative to the -directory that contains the .mrconfig file. +All other sections add repositories. The section header specifies the +directory where the repository is located. This is relative to the directory +that contains the mrconfig file, but you can also choose to use absolute +paths. Within a section, each parameter defines a shell command to run to handle a given action. mr contains default handlers for the "update", "status", and @@ -247,8 +249,11 @@ my $nochdir=0; foreach my $topdir (sort keys %config) { foreach my $subdir (sort keys %{$config{$topdir}}) { next if $subdir eq 'DEFAULT'; - my $dir=$topdir.$subdir; - next if $dir ne $directory && $dir !~ /^\Q$directory\E\//; + my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir; + my $d=$directory; + $dir.="/" unless $dir=~/\/$/; + $d.="/" unless $d=~/\/$/; + next if $dir ne $directory && $dir !~ /^\Q$directory\E/; push @repos, [$dir, $topdir, $subdir]; } } @@ -257,7 +262,7 @@ if (! @repos) { LEAF: foreach my $topdir (reverse sort keys %config) { foreach my $subdir (reverse sort keys %{$config{$topdir}}) { next if $subdir eq 'DEFAULT'; - my $dir=$topdir.$subdir; + my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir; my $d=$directory; $dir.="/" unless $dir=~/\/$/; $d.="/" unless $d=~/\/$/; @@ -318,10 +323,10 @@ sub action { } else { if (! $nochdir) { - print "mr $action: $dir\n"; + print "mr $action: $topdir$subdir\n"; } else { - print "mr $action: $dir (in subdir $directory)\n"; + print "mr $action: $topdir$subdir (in subdir $directory)\n"; } my $command="set -e; ".$lib. "my_action(){ $config{$topdir}{$subdir}{$action} ; }; my_action ". @@ -330,7 +335,7 @@ sub action { my $ret=system($command); if ($ret != 0) { print STDERR "mr $action: failed ($ret)\n" if $verbose; - push @failed, $topdir.$subdir; + push @failed, $dir; if ($ret >> 8 != 0) { print STDERR "mr $action: command failed\n"; }