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.
7 mr - a Multiple Repository management tool
11 B<mr> [options] checkout
13 B<mr> [options] update
15 B<mr> [options] status
17 B<mr> [options] commit [-m "message"]
23 B<mr> [options] register [repository]
25 B<mr> [options] config section ["parameter=[value]" ...]
27 B<mr> [options] action [params ...]
31 B<mr> is a Multiple Repository management tool. It can checkout, update, or
32 perform other actions on a set of repositories as if they were one combined
33 respository. It supports any combination of subversion, git, cvs, mecurial,
34 bzr and darcs repositories, and support for other revision control systems can
37 B<mr> cds into and operates on all registered repositories at or below your
38 working directory. Or, if you are in a subdirectory of a repository that
39 contains no other registered repositories, it will stay in that directory,
40 and work on only that repository,
42 These predefined commands should be fairly familiar to users of any revision
47 =item checkout (or co)
49 Checks out any repositories that are not already checked out.
53 Updates each repository from its configured remote repository.
55 If a repository isn't checked out yet, it will first check it out.
59 Displays a status report for each repository, showing what
60 uncommitted changes are present in the repository.
64 Commits changes to each repository. (By default, changes are pushed to the
65 remote repository too, when using distributed systems like git.)
67 The optional -m parameter allows specifying a commit message.
71 Show a diff of uncommitted changes.
79 These commands are also available:
85 List the repositories that mr will act on.
89 Register an existing repository in a mrconfig file. By default, the
90 repository in the current directory is registered, or you can specify a
91 directory to register.
93 The mrconfig file that is modified is chosen by either the -c option, or by
94 looking for the closest known one at or below the current directory.
98 Adds, modifies, removes, or prints a value from a mrconfig file. The next
99 parameter is the name of the section the value is in. To add or modify
100 values, use one or more instances of "parameter=value". Use "parameter=" to
101 remove a parameter. Use just "parameter" to get the value of a parameter.
103 For example, to add (or edit) a repository in src/foo:
105 mr config src/foo checkout="svn co svn://example.com/foo/trunk foo"
107 To show the command that mr uses to update the repository in src/foo:
109 mr config src/foo update
111 To see the built-in library of shell functions contained in mr:
113 mr config DEFAULT lib
115 The ~/.mrconfig file is used by default. To use a different config file,
124 Actions can be abbreviated to any unambiguous subsctring, so
125 "mr st" is equivilant to "mr status", and "mr up" is equivilant to "mr
128 Additional parameters can be passed to most commands, and are passed on
129 unchanged to the underlying revision control system. This is mostly useful
130 if the repositories mr will act on all use the same revision control
139 Specifies the topmost directory that B<mr> should work in. The default is
140 the current working directory.
144 Use the specified mrconfig file. The default is B<~/.mrconfig>
152 Expand the statistics line displayed at the end to include information
153 about exactly which repositories failed and were skipped, if any.
157 Just operate on the repository for the current directory, do not
158 recurse into deeper repositories.
162 Run the specified number of jobs in parallel. This can greatly speed up
163 operations such as updates. It is not recommended for interactive
170 B<mr> is configured by .mrconfig files. It starts by reading the .mrconfig
171 file in your home directory, and this can in turn chain load .mrconfig files
174 Here is an example .mrconfig file:
177 checkout = svn co svn://svn.example.com/src/trunk src
181 checkout = git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git &&
183 git checkout -b mybranch origin/master
185 The .mrconfig file uses a variant of the INI file format. Lines starting with
186 "#" are comments. Values can be continued to the following line by
187 indenting the line with whitespace.
189 The "DEFAULT" section allows setting default values for the sections that
192 The "ALIAS" section allows adding aliases for actions. Each parameter
193 is an alias, and its value is the action to use.
195 All other sections add repositories. The section header specifies the
196 directory where the repository is located. This is relative to the directory
197 that contains the mrconfig file, but you can also choose to use absolute
200 Within a section, each parameter defines a shell command to run to handle a
201 given action. mr contains default handlers for "update", "status",
202 "commit", and other standard actions. Normally you only need to specify what
203 to do for "checkout".
205 Note that these shell commands are run in a "set -e" shell
206 environment, where any additional parameters you pass are available in
207 "$@". The "checkout" command is run in the parent of the repository
208 directory, since the repository isn't checked out yet. All other commands
209 are run inside the repository, though not necessarily at the top of it.
211 The "MR_REPO" environment variable is set to the path to the top of the
212 repository. The "MR_CONFIG" environment variable is set to the .mrconfig file
213 that defines the repo being acted on, or, if the repo is not yet in a config
214 file, the .mrconfig file that should be modified to register the repo.
216 A few parameters have special meanings:
222 If the "skip" parameter is set and its command returns true, then B<mr>
223 will skip acting on that repository. The command is passed the action
226 Here are two examples. The first skips the repo unless
227 mr is run by joey. The second uses the hours_since function
228 (included in mr's built-in library) to skip updating the repo unless it's
229 been at least 12 hours since the last update.
231 skip = test $(whoami) != joey
232 skip = [ "$1" = update ] && ! hours_since "$1" 12
236 The "order" parameter can be used to override the default ordering of
237 repositories. The default order value is 10. Use smaller values to make
238 repositories be processed earlier, and larger values to make repositories
241 Note that if a repository is located in a subdirectory of another
242 repository, ordering it to be processed earlier is not recommended.
246 If the "chain" parameter is set and its command returns true, then B<mr>
247 will try to load a .mrconfig file from the root of the repository. (You
248 should avoid chaining from repositories with untrusted committers.)
252 The "lib" parameter can specify some shell code that will be run before each
253 command, this can be a useful way to define shell functions for other commands
260 Copyright 2007 Joey Hess <joey@kitenet.net>
262 Licensed under the GNU GPL version 2 or higher.
264 http://kitenet.net/~joey/code/mr/
273 use Cwd qw(getcwd abs_path);
283 print STDERR "mr: interrupted\n";
287 $ENV{MR_CONFIG}="$ENV{HOME}/.mrconfig";
288 my $config_overridden=0;
297 my $directory=getcwd();
299 Getopt::Long::Configure("no_permute");
300 my $result=GetOptions(
301 "d|directory=s" => sub { $directory=abs_path($_[1]) },
302 "c|config=s" => sub { $ENV{MR_CONFIG}=$_[1]; $config_overridden=1 },
303 "v|verbose" => \$verbose,
304 "s|stats" => \$stats,
305 "n|no-recurse" => \$no_recurse,
306 "j|jobs=i" => \$jobs,
308 if (! $result || @ARGV < 1) {
309 die("Usage: mr [-d directory] action [params ...]\n".
310 "(Use mr help for man page.)\n");
313 if (! defined $directory) {
314 die("mr: failed to determine working directory\n");
317 # Make sure MR_CONFIG is an absolute path, but don't use abs_path since
318 # the config file might be a symlink to elsewhere, and the directory it's
320 if ($ENV{MR_CONFIG} !~ /^\//) {
321 $ENV{MR_CONFIG}=getcwd()."/".$ENV{MR_CONFIG};
323 # Try to set MR_PATH to the path to the program.
325 use FindBin qw($Bin $Script);
326 $ENV{MR_PATH}=$Bin."/".$Script;
330 loadconfig($ENV{MR_CONFIG});
332 #print Dumper(\%config);
334 # alias expansion and command stemming
335 my $action=shift @ARGV;
336 if (exists $alias{$action}) {
337 $action=$alias{$action};
339 if (! exists $knownactions{$action}) {
340 my @matches = grep { /^\Q$action\E/ }
341 keys %knownactions, keys %alias;
345 elsif (@matches == 0) {
346 die "mr: unknown action \"$action\" (known actions: ".
347 join(", ", sort keys %knownactions).")\n";
350 die "mr: ambiguous action \"$action\" (matches: ".
351 join(", ", @matches).")\n";
355 # commands that do not operate on all repos
356 if ($action eq 'help') {
357 exec($config{''}{DEFAULT}{$action}) || die "exec: $!";
359 elsif ($action eq 'config') {
361 die "mr config: not enough parameters\n";
364 if ($section=~/^\//) {
365 # try to convert to a path relative to the config file
366 my ($dir)=$ENV{MR_CONFIG}=~/^(.*\/)[^\/]+$/;
368 $dir.="/" unless $dir=~/\/$/;
369 if ($section=~/^\Q$dir\E(.*)/) {
375 if (/^([^=]+)=(.*)$/) {
376 $changefields{$1}=$2;
380 foreach my $topdir (sort keys %config) {
381 if (exists $config{$topdir}{$section} &&
382 exists $config{$topdir}{$section}{$_}) {
383 print $config{$topdir}{$section}{$_}."\n";
385 last if $section eq 'DEFAULT';
389 die "mr $action: $section $_ not set\n";
393 modifyconfig($ENV{MR_CONFIG}, $section, %changefields) if %changefields;
396 elsif ($action eq 'register') {
397 if (! $config_overridden) {
398 # Find the closest known mrconfig file to the current
400 $directory.="/" unless $directory=~/\/$/;
401 foreach my $topdir (reverse sort keys %config) {
402 next unless length $topdir;
403 if ($directory=~/^\Q$topdir\E/) {
404 $ENV{MR_CONFIG}=$configfiles{$topdir};
409 my $command="set -e; ".$config{''}{DEFAULT}{lib}."\n".
410 "my_action(){ $config{''}{DEFAULT}{$action}\n }; my_action ".
411 join(" ", map { s/\//\/\//g; s/"/\"/g; '"'.$_.'"' } @ARGV);
412 print STDERR "mr $action: running >>$command<<\n" if $verbose;
413 exec($command) || die "exec: $!";
416 # an ordered list of repos
418 foreach my $topdir (sort keys %config) {
419 foreach my $subdir (sort keys %{$config{$topdir}}) {
423 order => $config{$topdir}{$subdir}{order},
428 $a->{order} <=> $b->{order}
430 $a->{topdir} cmp $b->{topdir}
432 $a->{subdir} cmp $b->{subdir}
435 # work out what repos to act on
438 foreach my $repo (@list) {
439 my $topdir=$repo->{topdir};
440 my $subdir=$repo->{subdir};
442 next if $subdir eq 'DEFAULT';
443 my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir;
445 $dir.="/" unless $dir=~/\/$/;
446 $d.="/" unless $d=~/\/$/;
447 next if $no_recurse && $d ne $dir;
448 next if $dir ne $d && $dir !~ /^\Q$d\E/;
449 push @repos, [$dir, $topdir, $subdir];
452 # fallback to find a leaf repo
453 foreach my $repo (reverse @list) {
454 my $topdir=$repo->{topdir};
455 my $subdir=$repo->{subdir};
457 next if $subdir eq 'DEFAULT';
458 my $dir=($subdir =~/^\//) ? $subdir : $topdir.$subdir;
460 $dir.="/" unless $dir=~/\/$/;
461 $d.="/" unless $d=~/\/$/;
462 if ($d=~/^\Q$dir\E/) {
463 push @repos, [$dir, $topdir, $subdir];
470 # run the action on each repository and print stats
471 my (@ok, @failed, @skipped);
476 foreach my $repo (@repos) {
477 record($repo, action($action, @$repo));
480 if (! @ok && ! @failed && ! @skipped) {
481 die "mr $action: no repositories found to work on\n";
483 print "mr $action: finished (".join("; ",
484 showstat($#ok+1, "ok", "ok"),
485 showstat($#failed+1, "failed", "failed"),
486 showstat($#skipped+1, "skipped", "skipped"),
490 print "mr $action: (skipped: ".join(" ", @skipped).")\n";
493 print STDERR "mr $action: (failed: ".join(" ", @failed).")\n";
499 elsif (! @ok && @skipped) {
505 my ($action, $dir, $topdir, $subdir) = @_;
507 $ENV{MR_CONFIG}=$configfiles{$topdir};
508 my $lib=exists $config{$topdir}{$subdir}{lib} ?
509 $config{$topdir}{$subdir}{lib}."\n" : "";
511 if ($action eq 'checkout') {
513 print "mr $action: $dir already exists, skipping checkout\n" if $verbose;
517 $dir=~s/^(.*)\/[^\/]+\/?$/$1/;
520 print "mr $action: creating parent directory $dir\n" if $verbose;
521 system("mkdir", "-p", $dir);
524 elsif ($action =~ /update/) {
526 return action("checkout", $dir, $topdir, $subdir);
532 if (exists $config{$topdir}{$subdir}{skip}) {
533 my $test="set -e;".$lib.
534 "my_action(){ $config{$topdir}{$subdir}{skip}\n }; my_action '$action'";
535 print "mr $action: running skip test >>$test<<\n" if $verbose;
536 my $ret=system($test);
538 if (($? & 127) == 2) {
539 print STDERR "mr $action: interrupted\n";
543 print STDERR "mr $action: skip test received signal ".($? & 127)."\n";
547 if ($ret >> 8 == 0) {
548 print "mr $action: $dir skipped per config file\n" if $verbose;
553 if (! $nochdir && ! chdir($dir)) {
554 print STDERR "mr $action: failed to chdir to $dir: $!\n";
557 elsif (! exists $config{$topdir}{$subdir}{$action}) {
558 print STDERR "mr $action: no defined $action command for $topdir$subdir, skipping\n";
563 print "mr $action: $topdir$subdir\n";
566 print "mr $action: $topdir$subdir (in subdir $directory)\n";
568 my $command="set -e; ".$lib.
569 "my_action(){ $config{$topdir}{$subdir}{$action}\n }; my_action ".
570 join(" ", map { s/\//\/\//g; s/"/\"/g; '"'.$_.'"' } @ARGV);
571 print STDERR "mr $action: running >>$command<<\n" if $verbose;
572 my $ret=system($command);
574 if (($? & 127) == 2) {
575 print STDERR "mr $action: interrupted\n";
579 print STDERR "mr $action: received signal ".($? & 127)."\n";
582 print STDERR "mr $action: failed ($ret)\n" if $verbose;
583 if ($ret >> 8 != 0) {
584 print STDERR "mr $action: command failed\n";
587 print STDERR "mr $action: command died ($ret)\n";
592 if ($action eq 'checkout' && ! -d $dir) {
593 print STDERR "mr $action: $dir missing after checkout\n";;
602 # run actions on multiple repos, in parallel
609 while (@fhs or @repos) {
610 while ($running < $jobs && @repos) {
612 my $repo = shift @repos;
613 pipe(my $outfh, CHILD_STDOUT);
614 pipe(my $errfh, CHILD_STDERR);
616 unless ($pid = fork) {
617 die "mr $action: cannot fork: $!" unless defined $pid;
618 open(STDOUT, ">&CHILD_STDOUT") || die "mr $action cannot reopen stdout: $!";
619 open(STDERR, ">&CHILD_STDERR") || die "mr $action cannot reopen stderr: $!";
624 exit action($action, @$repo);
628 push @active, [$pid, $repo];
629 push @fhs, [$outfh, $errfh];
632 my ($rin, $rout) = ('','');
634 foreach my $fh (@fhs) {
635 next unless defined $fh;
636 vec($rin, fileno($fh->[0]), 1) = 1 if defined $fh->[0];
637 vec($rin, fileno($fh->[1]), 1) = 1 if defined $fh->[1];
639 $nfound = select($rout=$rin, undef, undef, 1);
640 foreach my $channel (0, 1) {
641 foreach my $i (0..$#fhs) {
642 next unless defined $fhs[$i];
643 my $fh = $fhs[$i][$channel];
644 next unless defined $fh;
645 if (vec($rout, fileno($fh), 1) == 1) {
647 if (sysread($fh, $r, 1024) == 0) {
649 $fhs[$i][$channel] = undef;
650 if (! defined $fhs[$i][0] &&
651 ! defined $fhs[$i][1]) {
652 waitpid($active[$i][0], 0);
653 print STDOUT $out[$i][0];
654 print STDERR $out[$i][1];
655 record($active[$i][1], $? >> 8);
657 splice(@active, $i, 1);
662 $out[$i][$channel] .= $r;
670 my $dir=shift()->[0];
677 elsif ($ret == FAILED) {
681 elsif ($ret == SKIPPED) {
684 elsif ($ret == ABORT) {
688 die "unknown exit status $ret";
697 return "$count ".($count > 1 ? $plural : $singular);
703 sub loadconfig { #{{{
710 if (ref $f eq 'GLOB') {
719 my $absf=abs_path($f);
720 if ($loaded{$absf}) {
725 ($dir)=$f=~/^(.*\/)[^\/]+$/;
726 if (! defined $dir) {
729 $dir=abs_path($dir)."/";
731 if (! exists $configfiles{$dir}) {
732 $configfiles{$dir}=$f;
735 # copy in defaults from first parent
737 while ($parent=~s/^(.*\/)[^\/]+\/?$/$1/) {
738 if ($parent eq '/') {
741 if (exists $config{$parent} &&
742 exists $config{$parent}{DEFAULT}) {
743 $config{$dir}{DEFAULT}={ %{$config{$parent}{DEFAULT}} };
748 print "mr: loading config $f\n" if $verbose;
749 open($in, "<", $f) || die "mr: open $f: $!\n";
760 next if /^\s*\#/ || /^\s*$/;
761 if (/^\[([^\]]*)\]\s*$/) {
764 elsif (/^(\w+)\s*=\s*(.*)/) {
769 while (@lines && $lines[0]=~/^\s(.+)/) {
776 if (! defined $section) {
777 die "$f line $.: parameter ($parameter) not in section\n";
779 if ($section ne 'ALIAS' &&
780 ! exists $config{$dir}{$section} &&
781 exists $config{$dir}{DEFAULT}) {
783 $config{$dir}{$section}={ %{$config{$dir}{DEFAULT}} };
785 if ($section eq 'ALIAS') {
786 $alias{$parameter}=$value;
788 elsif ($parameter eq 'lib') {
789 $config{$dir}{$section}{lib}.=$value."\n";
792 $config{$dir}{$section}{$parameter}=$value;
793 $knownactions{$parameter}=1;
794 if ($parameter eq 'chain' &&
795 length $dir && $section ne "DEFAULT" &&
796 -e $dir.$section."/.mrconfig") {
797 my $ret=system($value);
799 if (($? & 127) == 2) {
800 print STDERR "mr $action: chain test interrupted\n";
804 print STDERR "mr $action: chain test received signal ".($? & 127)."\n";
808 push @toload, $dir.$section."/.mrconfig";
814 die "$f line $line: parse error\n";
823 sub modifyconfig { #{{{
825 # the section to modify or add
826 my $targetsection=shift;
827 # fields to change in the section
828 # To remove a field, set its value to "".
835 open(my $in, "<", $f) || die "mr: open $f: $!\n";
840 my $formatfield=sub {
842 my @value=split(/\n/, shift);
844 return "$field = ".shift(@value)."\n".
845 join("", map { "\t$_\n" } @value);
849 while ($out[$#out] =~ /^\s*$/) {
850 unshift @blanks, pop @out;
852 foreach my $field (sort keys %changefields) {
853 if (length $changefields{$field}) {
854 push @out, "$field = $changefields{$field}\n";
855 delete $changefields{$field};
865 if (/^\s*\#/ || /^\s*$/) {
868 elsif (/^\[([^\]]*)\]\s*$/) {
869 if (defined $section &&
870 $section eq $targetsection) {
878 elsif (/^(\w+)\s*=\s(.*)/) {
883 while (@lines && $lines[0]=~/^\s(.+)/) {
889 if ($section eq $targetsection) {
890 if (exists $changefields{$parameter}) {
891 if (length $changefields{$parameter}) {
892 $value=$changefields{$parameter};
894 delete $changefields{$parameter};
898 push @out, $formatfield->($parameter, $value);
902 if (defined $section &&
903 $section eq $targetsection) {
906 elsif (%changefields) {
907 push @out, "\n[$targetsection]\n";
908 foreach my $field (sort keys %changefields) {
909 if (length $changefields{$field}) {
910 push @out, $formatfield->($field, $changefields{$field});
915 open(my $out, ">", $f) || die "mr: write $f: $!\n";
920 # Finally, some useful actions that mr knows about by default.
921 # These can be overridden in ~/.mrconfig.
937 if [ -z "$1" ] || [ -z "$2" ]; then
938 error "mr: usage: hours_since action num"
940 for dir in .git .svn .bzr CVS .hg _darcs; do
941 if [ -e "$MR_REPO/$dir" ]; then
942 flagfile="$MR_REPO/$dir/.mr_last$1"
946 if [ -z "$flagfile" ]; then
947 error "cannot determine flag filename"
949 delta=$(perl -wle 'print -f shift() ? int((-M _) * 24) : 9999' "$flagfile")
950 if [ "$delta" -lt "$2" ]; then
959 if [ -d "$MR_REPO"/.svn ]; then
961 elif [ -d "$MR_REPO"/.git ]; then
963 git pull -t origin master
967 elif [ -d "$MR_REPO"/.bzr ]; then
969 elif [ -d "$MR_REPO"/CVS ]; then
971 elif [ -d "$MR_REPO"/.hg ]; then
972 hg pull "$@" && hg update "$@"
973 elif [ -d "$MR_REPO"/_darcs ]; then
976 error "unknown repo type"
979 if [ -d "$MR_REPO"/.svn ]; then
981 elif [ -d "$MR_REPO"/.git ]; then
982 git status "$@" || true
983 elif [ -d "$MR_REPO"/.bzr ]; then
985 elif [ -d "$MR_REPO"/CVS ]; then
987 elif [ -d "$MR_REPO"/.hg ]; then
989 elif [ -d "$MR_REPO"/_darcs ]; then
990 darcs whatsnew -ls "$@"
992 error "unknown repo type"
995 if [ -d "$MR_REPO"/.svn ]; then
997 elif [ -d "$MR_REPO"/.git ]; then
998 git commit -a "$@" && git push --all
999 elif [ -d "$MR_REPO"/.bzr ]; then
1000 bzr commit "$@" && bzr push
1001 elif [ -d "$MR_REPO"/CVS ]; then
1003 elif [ -d "$MR_REPO"/.hg ]; then
1004 hg commit -m "$@" && hg push
1005 elif [ -d "$MR_REPO"/_darcs ]; then
1006 darcs commit -m "$@" && darcs push
1008 error "unknown repo type"
1011 if [ -d "$MR_REPO"/.svn ]; then
1013 elif [ -d "$MR_REPO"/.git ]; then
1015 elif [ -d "$MR_REPO"/.bzr ]; then
1017 elif [ -d "$MR_REPO"/CVS ]; then
1019 elif [ -d "$MR_REPO"/.hg ]; then
1021 elif [ -d "$MR_REPO"/_darcs ]; then
1024 error "unknown repo type"
1027 if [ -d "$MR_REPO"/.svn ]; then
1029 elif [ -d "$MR_REPO"/.git ]; then
1031 elif [ -d "$MR_REPO"/.bzr ]; then
1033 elif [ -d "$MR_REPO"/CVS ]; then
1035 elif [ -d "$MR_REPO"/.hg ]; then
1037 elif [ -d "$MR_REPO"/_darcs ]; then
1040 error "unknown repo type"
1043 if [ -n "$1" ]; then
1046 basedir="$(basename $(pwd))"
1047 if [ -d .svn ]; then
1048 url=$(LANG=C svn info . | grep -i ^URL: | cut -d ' ' -f 2)
1049 if [ -z "$url" ]; then
1050 error "cannot determine svn url"
1052 echo "Registering svn url: $url in $MR_CONFIG"
1053 mr -c "$MR_CONFIG" config "$(pwd)" checkout="svn co $url $basedir"
1054 elif [ -d .git ]; then
1055 url=$(LANG=C git-config --get remote.origin.url)
1056 if [ -z "$url" ]; then
1057 error "cannot determine git url"
1059 echo "Registering git url: $url in $MR_CONFIG"
1060 mr -c "$MR_CONFIG" config "$(pwd)" checkout="git clone $url $basedir"
1061 elif [ -d .bzr ]; then
1062 url=$(cat .bzr/branch/parent)
1063 if [ -z "$url" ]; then
1064 error "cannot determine bzr url"
1066 echo "Registering bzr url: $url in $MR_CONFIG"
1067 mr -c "$MR_CONFIG" config "$(pwd)" checkout="bzr clone $url $basedir"
1068 elif [ -d CVS ]; then
1069 repo=$(cat CVS/Repository)
1070 root=$(cat CVS/Root)
1071 if [ -z "$root" ]; then
1072 error "cannot determine cvs root"
1074 echo "Registering cvs repository $repo at root $root"
1075 mr -c "$MR_CONFIG" config "$(pwd)" \
1076 checkout="cvs -d '$root' co -d $basedir $repo"
1077 elif [ -d .hg ]; then
1078 url=$(hg showconfig paths.default)
1079 echo "Registering mercurial repo url: $url in $MR_CONFIG"
1080 mr -c "$MR_CONFIG" config "$(pwd)" \
1081 checkout="hg clone $url $basedir"
1082 elif [ -d _darcs ]; then
1083 url=$(cat _darcs/prefs/defaultrepo)
1084 echo "Registering darcs repository $url in $MR_CONFIG"
1085 mr -c "$MR_CONFIG" config "$(pwd)" \
1086 checkout="darcs get $url $basedir"
1088 error "unable to register this repo type"
1091 if [ ! -e "$MR_PATH" ]; then
1092 error "cannot find program path"
1094 (pod2man -c mr "$MR_PATH" | man -l -) || error "pod2man or man failed"
1098 ed = echo "A horse is a horse, of course, of course.."
1099 T = echo "I pity the fool."
1100 right = echo "Not found."