aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-03-21 22:43:42 +0100
committerGuido Günther <agx@sigxcpu.org>2012-03-21 23:25:54 +0100
commitffbff853e59ae5409cd1d170603b036c8e6feb2a (patch)
tree064098e4a643bdac1af03f6ff1679365d4efe402
parentfa1431071e5e3bb28b97900fae213601acc6d6f3 (diff)
gbp-create-remote-repo: move option parsing to separate function
Git-Dch: Ignore
-rw-r--r--gbp/scripts/create_remote_repo.py56
1 files changed, 40 insertions, 16 deletions
diff --git a/gbp/scripts/create_remote_repo.py b/gbp/scripts/create_remote_repo.py
index d1a36c6..c26551b 100644
--- a/gbp/scripts/create_remote_repo.py
+++ b/gbp/scripts/create_remote_repo.py
@@ -225,28 +225,52 @@ def push_branches(remote, branches):
gitPush([remote['url'], '--tags'])
-def main(argv):
- retval = 0
- changelog = 'debian/changelog'
- cmd = []
-
+def parse_args(argv):
parser = GbpOptionParserDebian(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [options] - create a remote repository')
- branch_group = GbpOptionGroup(parser, "branch options", "branch layout and tracking options")
- branch_group.add_config_file_option(option_name="remote-url-pattern", dest="remote_url")
+ usage='%prog [options] - '
+ 'create a remote repository')
+ branch_group = GbpOptionGroup(parser,
+ "branch options",
+ "branch layout and tracking options")
+ branch_group.add_config_file_option(option_name="remote-url-pattern",
+ dest="remote_url")
parser.add_option_group(branch_group)
- branch_group.add_config_file_option(option_name="upstream-branch", dest="upstream_branch")
- branch_group.add_config_file_option(option_name="debian-branch", dest="debian_branch")
- branch_group.add_boolean_config_file_option(option_name="pristine-tar", dest="pristine_tar")
- branch_group.add_boolean_config_file_option(option_name="track", dest='track')
- parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False,
+ branch_group.add_config_file_option(option_name="upstream-branch",
+ dest="upstream_branch")
+ branch_group.add_config_file_option(option_name="debian-branch",
+ dest="debian_branch")
+ branch_group.add_boolean_config_file_option(option_name="pristine-tar",
+ dest="pristine_tar")
+ branch_group.add_boolean_config_file_option(option_name="track",
+ dest='track')
+ parser.add_option("-v", "--verbose",
+ action="store_true",
+ dest="verbose",
+ default=False,
help="verbose command execution")
- parser.add_config_file_option(option_name="color", dest="color", type='tristate')
- parser.add_option("--remote-name", dest="name", default="origin",
+ parser.add_config_file_option(option_name="color",
+ dest="color",
+ type='tristate')
+ parser.add_option("--remote-name",
+ dest="name",
+ default="origin",
help="The name of the remote, default is 'origin'")
- parser.add_config_file_option(option_name="template-dir", dest="template_dir")
+ parser.add_config_file_option(option_name="template-dir",
+ dest="template_dir")
+ parser.add_config_file_option(option_name="remote-template",
+ dest="remote_template")
(options, args) = parser.parse_args(argv)
+
+ return options, args
+
+
+def main(argv):
+ retval = 0
+ changelog = 'debian/changelog'
+ cmd = []
+
+ options, args = parse_args(argv)
gbp.log.setup(options.color, options.verbose)
try: