<arg><option>--git-log=</option><replaceable>git-log-options</replaceable></arg>
<arg><option>--[no-]git-author</option></arg>
<arg><option>--[no-]multimaint-merge</option></arg>
+ <arg><option>--spawn-editor=[always|snapshot|release]</option></arg>
<arg choice="plain"><replaceable>[path1 path2]</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<para>Merge commits by maintainer.</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--spawn-editor=<replaceable>[always|snapshot|release]</replaceable></option>
+ </term>
+ <listitem>
+ <para>Whether to spawn an editor: always, when doing snapshots or
+ when doing a release.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
<refsect1>
'arch' : '',
'interactive' : 'True',
'color' : 'auto',
- 'customizations' : ''
+ 'customizations' : '',
+ 'spawn-editor' : 'release',
}
help = {
'debian-branch':
"Run command interactive, default is '%(interactive)s'",
'color':
"color output, default is '%(color)s'",
+ 'spawn-editor':
+ "Wether to spawn an editor after adding the changelog entry, default is '%(spawn-editor)s'",
}
config_files = [ '/etc/git-buildpackage/gbp.conf',
os.path.expanduser('~/.gbp.conf'),
return dch_options
+def process_editor_option(options, parser):
+ # Determine Editor and check if we need it
+ states = ['always']
+
+ if options.snapshot:
+ states.append("snapshot")
+ elif options.release:
+ states.append("release")
+
+ if options.spawn_editor in states:
+ return "sensible-editor"
+ else:
+ return None
+
+
def main(argv):
ret = 0
changelog = 'debian/changelog'
help="Ignore commit lines matching regex, default is '%(ignore-regex)s'")
commit_group.add_boolean_config_file_option(option_name="multimaint", dest="multimaint")
commit_group.add_boolean_config_file_option(option_name="multimaint-merge", dest="multimaint_merge")
+ commit_group.add_config_file_option(option_name="spawn-editor", dest="spawn_editor")
help_msg = 'Load Python code from CUSTOMIZATION_FILE. At the moment,' \
+ ' the only useful thing the code can do is define a custom' \
(options, args) = parser.parse_args(argv[1:])
gbp.log.setup(options.color, options.verbose)
dch_options = process_options(options, parser)
+ editor_cmd = process_editor_option(options, parser)
try:
try:
(snap, version) = do_snapshot(changelog, repo, options.snapshot_number)
gbp.log.info("Changelog has been prepared for snapshot #%d at %s" % (snap, version))
+ if editor_cmd:
+ gbpc.Command(editor_cmd, ["debian/changelog"])()
+
except (GbpError, GitRepositoryError, NoChangelogError), err:
if len(err.__str__()):
gbp.log.err(err)