summaryrefslogtreecommitdiffstats
path: root/git-hooks/gerrit-bot
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-21 15:10:25 +0100
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-26 17:23:23 +0100
commit5453e0fb3133cd2e0a10d2b056f5873343a42e6d (patch)
treec239286d5a0aeafc8e3ca1c598e444e61c077644 /git-hooks/gerrit-bot
parent04d2f7cbdb87ef3a4d44d88bb363669d75047e49 (diff)
add multi-instance support to sanity bot
allows specifying a group to get config data from. Change-Id: I80e8816e73d4690634fc558390cb3601a255f255 Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Diffstat (limited to 'git-hooks/gerrit-bot')
-rwxr-xr-xgit-hooks/gerrit-bot10
1 files changed, 7 insertions, 3 deletions
diff --git a/git-hooks/gerrit-bot b/git-hooks/gerrit-bot
index 0812cc1..226e077 100755
--- a/git-hooks/gerrit-bot
+++ b/git-hooks/gerrit-bot
@@ -13,9 +13,10 @@ use POSIX;
use JSON;
use File::Path;
-# Usage:
+# Usage: $0 [instance]
+# - default instance is 'sanitybot'
# - configure ssh: Host, Port, User, IdentityFile
-# - configure git: git config --global sanitybot.<option> <value>
+# - configure git: git config --global <instance>}.<option> <value>
# Valid options are:
# gerrithost (mandatory)
# Target host. The identification is done via SSH.
@@ -41,6 +42,9 @@ use File::Path;
# - Make inviteonly actually work beyond the initial startup.
# See http://code.google.com/p/gerrit/issues/detail?id=1200
+my $instance = 'sanitybot';
+$instance = $ARGV[0] if ($#ARGV > -1);
+
# Doing this is less expensive than calling git repeatedly.
my %config = ();
for (`git config -l`) {
@@ -51,7 +55,7 @@ for (`git config -l`) {
sub getcfg($;$)
{
my ($key, $def) = @_;
- my $fkey = 'sanitybot.'.$key;
+ my $fkey = $instance.'.'.$key;
if (defined $config{$fkey}) {
return $config{$fkey};
} elsif (defined $def) {