summaryrefslogtreecommitdiff
path: root/gbp/scripts/pull.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-01-05 15:15:57 +0100
committerGuido Günther <agx@sigxcpu.org>2014-01-05 15:27:55 +0100
commit7c64575a685edaa4962c811d9d9321a615e7d22a (patch)
tree3c0f73ebf9df74549f2d9dbabb0c4f39edc4144d /gbp/scripts/pull.py
parent78f36734be1b2ff1979ca14bd18cbd065093175b (diff)
downloadgit-buildpackage-7c64575a685edaa4962c811d9d9321a615e7d22a.tar.gz
git-buildpackage-7c64575a685edaa4962c811d9d9321a615e7d22a.tar.bz2
git-buildpackage-7c64575a685edaa4962c811d9d9321a615e7d22a.zip
Avoid backtrace on config file parse errors
"gbp buildpackage" did this already but others didn't Closes: #733759
Diffstat (limited to 'gbp/scripts/pull.py')
-rwxr-xr-xgbp/scripts/pull.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/gbp/scripts/pull.py b/gbp/scripts/pull.py
index d0a74422..03be9fc7 100755
--- a/gbp/scripts/pull.py
+++ b/gbp/scripts/pull.py
@@ -1,6 +1,6 @@
# vim: set fileencoding=utf-8 :
#
-# (C) 2009 Guido Guenther <agx@sigxcpu.org>
+# (C) 2009,2013 Guido Guenther <agx@sigxcpu.org>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@@ -19,6 +19,7 @@
#
"""fast forward debian, upstream and pristine-tar branch"""
+import ConfigParser
import sys
import os, os.path
from gbp.command_wrappers import (Command, CommandExecFailed)
@@ -67,12 +68,14 @@ def fast_forward_branch(branch, repo, options):
msg="gbp: forward %s to %s" % (branch, remote))
return update
-def main(argv):
- retval = 0
- current = None
-
- parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
+def parse_args(argv):
+ try:
+ parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
usage='%prog [options] - safely update a repository from remote')
+ except ConfigParser.ParsingError as err:
+ gbp.log.err(err)
+ return None, None
+
branch_group = GbpOptionGroup(parser, "branch options", "branch update and layout options")
parser.add_option_group(branch_group)
branch_group.add_boolean_config_file_option(option_name = "ignore-branch", dest="ignore_branch")
@@ -90,9 +93,17 @@ def main(argv):
parser.add_config_file_option(option_name="color", dest="color", type='tristate')
parser.add_config_file_option(option_name="color-scheme",
dest="color_scheme")
+ return parser.parse_args(argv)
- (options, args) = parser.parse_args(argv)
+def main(argv):
+ retval = 0
+ current = None
+
+ (options, args) = parse_args(argv)
+ if not options:
+ return 1
+
gbp.log.setup(options.color, options.verbose, options.color_scheme)
try: