summaryrefslogtreecommitdiff
path: root/gbp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-06-19 00:25:53 +0200
committerGuido Günther <agx@sigxcpu.org>2013-06-19 14:55:44 +0200
commitfe9f925c3cd4703ecf9409544d8692d677e32ff6 (patch)
tree4faaba554967959e64ca2489715a775975cfbec5 /gbp
parentcaff99cb63b4837eb91d5ee312c2c36663c08c88 (diff)
GbpOptionParser: Make sure we parse the old config sections
For backward compatibility between {gbp,git}-<subcommand> and "gbp <subcommand>" make sure we parse the former sections if using the later.
Diffstat (limited to 'gbp')
-rw-r--r--gbp/config.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/gbp/config.py b/gbp/config.py
index 16faab1..f61ebc5 100644
--- a/gbp/config.py
+++ b/gbp/config.py
@@ -311,6 +311,15 @@ class GbpOptionParser(OptionParser):
parser.read(self.config_files)
self.config = dict(parser.defaults())
+ if not (self.command.startswith('gbp-') or
+ self.command.startswith('git-')):
+ # Invoked as gbp <subcommand> syntax, so parse the old sections
+ # of {gbp.git}-<subcommand> for backward compatibility:
+ for prefix in ['gbp', 'git']:
+ oldcmd = '%s-%s' % (prefix, self.command)
+ if parser.has_section(oldcmd):
+ self.config.update(dict(parser.items(oldcmd, raw=True)))
+
if parser.has_section(self.command):
self.config.update(dict(parser.items(self.command, raw=True)))