X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/b7a3b1615f17991e400b5fa93c7e8a8cfffd348c..a33fafdabb2ba491a412616aa169404cee56fa05:/mr

diff --git a/mr b/mr
index 41a5362..48c355c 100755
--- a/mr
+++ b/mr
@@ -22,6 +22,8 @@ B<mr> [options] diff
 
 B<mr> [options] log
 
+B<mr> [options] run command [param ...]
+
 B<mr> [options] bootstrap url [directory]
 
 B<mr> [options] register [repository]
@@ -49,7 +51,9 @@ and work on only that repository,
 
 B<mr> is configured by .mrconfig files, which list the repositories. It
 starts by reading the .mrconfig file in your home directory, and this can
-in turn chain load .mrconfig files from repositories.
+in turn chain load .mrconfig files from repositories. It also automatically
+looks for a .mrconfig file in the current directory, or in one of its
+parent directories.
 
 These predefined commands should be fairly familiar to users of any revision
 control system:
@@ -100,6 +104,10 @@ Show a diff of uncommitted changes.
 
 Show the commit log.
 
+=item run command [param ...]
+
+Runs the specified command in each repository.
+
 =back
 
 These commands are also available:
@@ -128,7 +136,7 @@ repository in the current directory is registered, or you can specify a
 directory to register.
 
 The mrconfig file that is modified is chosen by either the -c option, or by
-looking for the closest known one at or below the current directory.
+looking for the closest known one at or in a parent of the current directory.
 
 =item config
 
@@ -149,8 +157,8 @@ To see the built-in library of shell functions contained in mr:
 
   mr config DEFAULT lib
 
-The ~/.mrconfig file is used by default. To use a different config file,
-use the -c option.
+The mrconfig file that is used is chosen by either the -c option, or by
+looking for the closest known one at or in a parent of the current directory.
 
 =item offline
 
@@ -200,14 +208,9 @@ the current working directory.
 
 =item --config mrconfig
 
-Use the specified mrconfig file. The default is B<~/.mrconfig>
-
-=item -p
-
-=item --path
-
-Search in the current directory, and its parent directories and use
-the first B<.mrconfig> found, instead of the default B<~/.mrconfig>.
+Use the specified mrconfig file. The default is to use both B<~/.mrconfig>
+as well as look for a .mrconfig file in the current directory, or in one
+of its parent directories.
 
 =item -v
 
@@ -272,6 +275,12 @@ a good speedup in updates without loading the machine too much.
 Trust all mrconfig files even if they are not listed in ~/.mrtrust.
 Use with caution.
 
+=item -p
+
+=item --path
+
+This obsolete flag is ignored.
+
 =back
 
 =head1 MRCONFIG FILES
@@ -468,7 +477,8 @@ my $no_chdir=0;
 my $jobs=1;
 my $trust_all=0;
 my $directory=getcwd();
-$ENV{MR_CONFIG}="$ENV{HOME}/.mrconfig";
+
+$ENV{MR_CONFIG}=find_mrconfig();
 
 # globals :-(
 my %config;
@@ -1486,7 +1496,7 @@ sub expandaction {
 	return $action;
 }
 
-sub find_nearest_mrconfig {
+sub find_mrconfig {
 	my $dir=getcwd();
 	while (length $dir) {
 		if (-e "$dir/.mrconfig") {
@@ -1494,7 +1504,7 @@ sub find_nearest_mrconfig {
 		}
 		$dir=~s/\/[^\/]*$//;
 	}
-	die "no .mrconfig found in path\n";
+	return "$ENV{HOME}/.mrconfig";
 }
 
 sub getopts {
@@ -1503,7 +1513,7 @@ sub getopts {
 	my $result=GetOptions(
 		"d|directory=s" => sub { $directory=abs_path($_[1]) },
 		"c|config=s" => sub { $ENV{MR_CONFIG}=$_[1]; $config_overridden=1 },
-		"p|path" => sub { $ENV{MR_CONFIG}=find_nearest_mrconfig(); $config_overridden=1 },
+		"p|path" => sub { }, # now default, ignore
 		"v|verbose" => \$verbose,
 		"q|quiet" => \$quiet,
 		"s|stats" => \$stats,
@@ -1563,6 +1573,7 @@ sub main {
 	init();
 
 	startingconfig();
+	loadconfig("$ENV{HOME}/.mrconfig");
 	loadconfig($ENV{MR_CONFIG});
 	#use Data::Dumper; print Dumper(\%config);
 	
@@ -1683,6 +1694,8 @@ darcs_log = darcs changes "$@"
 git_bare_log = git log "$@"
 fossil_log = fossil timeline "$@"
 
+run = "$@"
+
 svn_register =
 	url=`LC_ALL=C svn info . | grep -i '^URL:' | cut -d ' ' -f 2`
 	if [ -z "$url" ]; then