]> 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:

Add support for suffixing parameters with '_append', and corresponding docs.
authorAdam Spiers <mr@adamspiers.org>
Tue, 29 Nov 2011 22:41:04 +0000 (22:41 +0000)
committerJoey Hess <joey@kitenet.net>
Sun, 4 Dec 2011 20:54:57 +0000 (16:54 -0400)
This allows the option of constructing parameter values accumulatively
rather than overriding existing parameter values.
(cherry picked from commit aa3caf53a9cb35ee3d0e4173ed44e964c6b8b5ab)

mr

diff --git a/mr b/mr
index b503fa710b16cfb1f8c176aa044f34df311a5ebf..ba0cf0a8ac6ba4dc78a0b4f384ac29ecf89fe468 100755 (executable)
--- a/mr
+++ b/mr
@@ -415,9 +415,14 @@ to keep track of and remember to delete old repositories.
 
 =item lib
 
 
 =item lib
 
-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 for other commands
-to use.
+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 for other commands to use.  Unlike most other parameters,
+this can be specified multiple times, in which case the chunks of
+shell code are accumulatively concatenated together.  This is
+particularly useful because it allows the user to build a library of
+shell functions defined in the [DEFAULT] section scattered across
+various mr modules (files referenced by an C<include> directive).
 
 =item fixups
 
 
 =item fixups
 
@@ -447,6 +452,11 @@ the action that is performed for a given version control system, you can
 override these VCS specific actions. To add a new version control system,
 you can just add VCS specific actions for it.
 
 override these VCS specific actions. To add a new version control system,
 you can just add VCS specific actions for it.
 
+As with the C<lib> parameter, if a parameter is suffixed with
+C<_append>, its value is concatenated to the existing value of the
+parameter for that config block, rather than overwriting it.  In this
+way, actions such as C<fixup> can be constructed accumulatively.
+
 =head1 UNTRUSTED MRCONFIG FILES
 
 Since mrconfig files can contain arbitrary shell commands, they can do
 =head1 UNTRUSTED MRCONFIG FILES
 
 Since mrconfig files can contain arbitrary shell commands, they can do
@@ -1287,8 +1297,8 @@ sub loadconfig {
                        if ($section eq 'ALIAS') {
                                $alias{$parameter}=$value;
                        }
                        if ($section eq 'ALIAS') {
                                $alias{$parameter}=$value;
                        }
-                       elsif ($parameter eq 'lib') {
-                               $config{$dir}{$section}{lib}.=$value."\n";
+                       elsif ($parameter eq 'lib' or $parameter =~ s/_append$//) {
+                               $config{$dir}{$section}{$parameter}.="\n".$value."\n";
                        }
                        else {
                                $config{$dir}{$section}{$parameter}=$value;
                        }
                        else {
                                $config{$dir}{$section}{$parameter}=$value;