<arg><option>--[no-]merge</option></arg>
<arg><option>--upstream-branch=</option><replaceable>branch_name</replaceable></arg>
<arg><option>--debian-branch=</option><replaceable>branch_name</replaceable></arg>
+ <arg><option>--[no-]create-missing-branches</option></arg>
<arg><option>--upstream-vcs-tag=</option><replaceable>tag_name</replaceable></arg>
<arg><option>--[no-]sign-tags</option></arg>
<arg><option>--keyid=</option><replaceable>gpg-keyid</replaceable></arg>
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>--[no-]create-missing-branches</option>
+ </term>
+ <listitem>
+ <para>
+ Create missing upstream branch if it does not exist.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>--upstream-vcs-tag</option>=<replaceable>tag_name</replaceable>
</term>
<listitem>
no_upstream_branch_msg = """
Repository does not have branch '%s' for upstream sources. If there is none see
file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.CONVERT
-on howto create it otherwise use --upstream-branch to specify it.
+on howto create it or check the --create-missing-branches option. Otherwise,
+use --upstream-branch to specify it.
"""
def expand_path(option, opt, value):
branch_group.add_option("--upstream-vcs-tag", dest="vcs_tag",
help="Upstream VCS tag add to the merge commit")
branch_group.add_boolean_config_file_option(option_name="merge", dest="merge")
+ branch_group.add_boolean_config_file_option(
+ option_name="create-missing-branches",
+ dest="create_missing_branches")
tag_group.add_boolean_config_file_option(option_name="sign-tags",
dest="sign_tags")
is_empty = False if initial_branch else True
if not repo.has_branch(options.upstream_branch) and not is_empty:
- raise GbpError(no_upstream_branch_msg % options.upstream_branch)
+ if options.create_missing_branches:
+ gbp.log.info("Will create missing branch '%s'" %
+ options.upstream_branch)
+ else:
+ raise GbpError(no_upstream_branch_msg % options.upstream_branch)
(sourcepackage, version) = detect_name_and_version(repo, source, options)
parents = None
commit = repo.commit_dir(source.unpacked,
- msg=msg,
- branch=import_branch,
- other_parents=parents,
- )
+ msg=msg,
+ branch=import_branch,
+ other_parents=parents,
+ create_missing_branch=options.create_missing_branches)
if options.pristine_tar:
if pristine_orig: