From: Joey Hess Date: Fri, 12 Oct 2007 20:08:08 +0000 (-0400) Subject: support for tracking repo deletions X-Git-Url: https://git.madduck.net/code/myrepos.git/commitdiff_plain/ef1db305643600d7f7cb21e60d57c01c428e7a4e support for tracking repo deletions --- diff --git a/TODO b/TODO index d12dbd2..6621db6 100644 --- 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 @@ -11,16 +12,6 @@ (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 bed4cac..4243194 100755 --- a/mr +++ b/mr @@ -166,6 +166,14 @@ If the "chain" parameter is set and its command returns nonzero, then B 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 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;