]> 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:

support for tracking repo deletions
[code/myrepos.git] / mr
diff --git a/mr b/mr
index bed4cacf13dfd52ed95b3a0f4e031c42b108910f..4243194e84b506e9f8caff635e8fe38c32e61ed5 100755 (executable)
--- a/mr
+++ b/mr
@@ -166,6 +166,14 @@ If the "chain" parameter is set and its command returns nonzero, then B<mr>
 will try to load a .mrconfig file from the root of the repository. (You
 should avoid chaining from repositories with untrusted committers.)
 
+=item deleted
+
+If the "deleted" parameter is set and its command returns nonzero, then
+B<mr> will treat the repository as deleted. It won't ever actually delete
+the repository, but it will warn if it sees the repsoitory's directory.
+This is useful when one mrconfig file is shared amoung multiple machines,
+to keep track of and remember to delete old repositories.
+
 =item lib
 
 The "lib" parameter can specify some shell code that will be run before each
@@ -286,6 +294,22 @@ sub action {
        my $lib= exists $config{$topdir}{$subdir}{lib} ?
                        $config{$topdir}{$subdir}{lib}."\n" : "";
 
+       if (exists $config{$topdir}{$subdir}{deleted}) {
+               if (! -d $dir) {
+                       next;
+               }
+               else {
+                       my $test="set -e;".$lib.$config{$topdir}{$subdir}{deleted};
+                       print "mr $action: running deleted test >>$test<<\n" if $verbose;
+                       my $ret=system($test);
+                       if ($ret >> 8 == 0) {
+                               print STDERR "mr error: $dir should be deleted yet still exists\n\n";
+                               push @failed, $dir;
+                               return;
+                       }
+               }
+       }
+
        if ($action eq 'checkout') {
                if (-d $dir) {
                        print "mr $action: $dir already exists, skipping checkout\n" if $verbose;