]> git.madduck.net Git - code/myrepos.git/commitdiff

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
authorJoey Hess <joey@kodama.kitenet.net>
Fri, 12 Oct 2007 20:08:08 +0000 (16:08 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Fri, 12 Oct 2007 20:08:08 +0000 (16:08 -0400)
TODO
mr

diff --git a/TODO b/TODO
index d12dbd21c2bf86d9b007a37c3462f6908c5a31cf..6621db6f90ed9718e838136757f22b7513b8360a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,5 @@
 * more revision control systems
+
 * support for tracking repo renames
 
   It should be possible to tell mr that there used to be a repo at
 
   (Support multple renames of a single repo?)
 
-* repo deletions
-
-  Handling repo deletions might also be possible, but is tricky, since
-  there's no good way to tell if a local checkout of a given repo is clean
-  and really should be deleted. Probably better for mr to just warn that a
-  repo still exists on disk that it is no longer managed.
-
-  [src/foo/baz]
-  deleted = true
-
 * mr register
 
   Idea is you check out a repo and then use mr register to add it to the
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;