]> git.madduck.net Git - code/myrepos.git/blobdiff - mr

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

improve home directory checkout command
[code/myrepos.git] / mr
diff --git a/mr b/mr
index b35a3b72d80d3ad0cd3820970e0eb05ee97a3b92..04a5cbf72f8c55bde7d5c05f839f0411eb72c6f0 100755 (executable)
--- 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=~/\/$/;
@@ -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";
                        }