X-Git-Url: https://git.madduck.net/code/myrepos.git/blobdiff_plain/06c980d6db1267c9ba3a624162b37c14a5cd1122..080ad719ad774540f7f2f340d14e0bb948c775dc:/mr diff --git a/mr b/mr index 09c388e..856de11 100755 --- a/mr +++ b/mr @@ -70,7 +70,7 @@ Show a diff of uncommitted changes. Show the commit log. -=item list +=item list (or ls) List the repositories that mr will act on. @@ -138,16 +138,16 @@ 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.) The "lib" parameter can specify some shell code that will be run before each -command, this can be a useful way to define shell functions other commands -can use. +command, this can be a useful way to define shell functions for other commands +to use. The "default" section allows setting up default handlers for each action, and is overridden by the contents of other sections. mr contains default handlers for the "update", "status", and "commit" actions, so normally you only need to specify what to do for "checkout". -The "alias" section allows adding aliases for commands. Each parameter -is an alias, and its value is the command to run. +The "alias" section allows adding aliases for actions. Each parameter +is an alias, and its value is the action to use. For example: @@ -323,9 +323,10 @@ sub action { my $command="set -e; ".$lib. "my_action(){ $config{$topdir}{$subdir}{$action} ; }; my_action ". join(" ", map { s/\//\/\//g; s/"/\"/g; '"'.$_.'"' } @ARGV); + print STDERR "mr $action: running $command\n" if $verbose; my $ret=system($command); if ($ret != 0) { - print STDERR "mr $action: failed to run: $command\n" if $verbose; + print STDERR "mr $action: failed ($ret)\n" if $verbose; push @failed, $topdir.$subdir; if ($ret >> 8 != 0) { print STDERR "mr $action: command failed\n"; @@ -466,6 +467,7 @@ __DATA__ [alias] co = checkout ci = commit + ls = list [default] lib = \ error() { \ @@ -477,6 +479,8 @@ update = \ svn update "$@"; \ elif [ -d "$MR_REPO"/.git ]; then \ git pull origin master "$@"; \ + elif [ -d "$MR_REPO"/CVS ]; then \ + cvs update "$@"; \ else \ error "unknown repo type"; \ fi @@ -485,6 +489,8 @@ status = \ svn status "$@"; \ elif [ -d "$MR_REPO"/.git ]; then \ git status "$@" || true; \ + elif [ -d "$MR_REPO"/CVS ]; then \ + cvs status "$@"; \ else \ error "unknown repo type"; \ fi @@ -493,6 +499,8 @@ commit = \ svn commit "$@"; \ elif [ -d "$MR_REPO"/.git ]; then \ git commit -a "$@" && git push --all; \ + elif [ -d "$MR_REPO"/CVS ]; then \ + cvs commit "$@"; \ else \ error "unknown repo type"; \ fi @@ -501,6 +509,8 @@ diff = \ svn diff "$@"; \ elif [ -d "$MR_REPO"/.git ]; then \ git diff "$@"; \ + elif [ -d "$MR_REPO"/CVS ]; then \ + cvs diff "$@"; \ else \ error "unknown repo type"; \ fi @@ -509,6 +519,8 @@ log = \ svn log"$@"; \ elif [ -d "$MR_REPO"/.git ]; then \ git log "$@"; \ + elif [ -d "$MR_REPO"/CVS ]; then \ + cvs log "$@"; \ else \ error "unknown repo type"; \ fi