diff options
-rw-r--r-- | docs/chapters/import.sgml | 7 | ||||
-rw-r--r-- | docs/manpages/git-import-orig.sgml | 9 | ||||
-rw-r--r-- | gbp/config.py | 3 | ||||
-rwxr-xr-x | git-import-orig | 17 |
4 files changed, 28 insertions, 8 deletions
diff --git a/docs/chapters/import.sgml b/docs/chapters/import.sgml index 3da7bd35..079ea334 100644 --- a/docs/chapters/import.sgml +++ b/docs/chapters/import.sgml @@ -74,6 +74,13 @@ by version number. (orig.tar.gz) from &git; you should also specify the <option>--pristine-tar</option> option. This is recommended. </para> + <para>To customize the commit message used by &git-import-orig; use + the <option>--import-msg</option> option. This string is a standard + python format string, into which the + <replaceable>version</replaceable> variable is interpolated. (i.e., + use <replaceable>%(version)s</replaceable> in your message to get + the imported upstream version). + </para> </sect1> <sect1 id="gbp.import.convert"> diff --git a/docs/manpages/git-import-orig.sgml b/docs/manpages/git-import-orig.sgml index 84811b48..102f3831 100644 --- a/docs/manpages/git-import-orig.sgml +++ b/docs/manpages/git-import-orig.sgml @@ -119,6 +119,15 @@ </listitem> </varlistentry> <varlistentry> + <term><option>--import-msg=</option><replaceable>msg-format</replaceable> + </term> + <listitem> + <para>use this format string for the commit message when + importing upstream versions, default is <replaceable>Imported + Upstream version %(version)s</replaceable></para> + </listitem> + </varlistentry> + <varlistentry> <term><option>--filter=</option><replaceable>pattern</replaceable> </term> <listitem> diff --git a/gbp/config.py b/gbp/config.py index b72b1296..8c4bf369 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -39,6 +39,7 @@ class GbpOptionParser(OptionParser): 'postimport' : '', 'debian-tag' : 'debian/%(version)s', 'upstream-tag' : 'upstream/%(version)s', + 'import-msg' : 'Imported Upstream version %(version)s', 'filter' : [], 'snapshot-number' : 'snapshot + 1', 'git-log' : '--no-merges', @@ -69,6 +70,8 @@ class GbpOptionParser(OptionParser): "sign tags, default is '%(sign-tags)s'", 'keyid': "GPG keyid to sign tags with, default is '%(keyid)s'", + 'import-msg': + "format string for commit message, default is '%(import-msg)s'", 'pristine-tar': "use pristine-tar to create .orig.tar.gz, default is '%(pristine-tar)s'", 'filter-pristine-tar': diff --git a/git-import-orig b/git-import-orig index 8cc78658..6ee6228b 100755 --- a/git-import-orig +++ b/git-import-orig @@ -72,15 +72,14 @@ def symlink_orig(archive, pkg, version): return archive -def upstream_import_commit_msg(version): - return "Imported Upstream version %s" % version +def upstream_import_commit_msg(options, version): + return options.import_msg % dict(version=version) - -def import_upstream_tree(repo, src_dir, version, filters, verbose): +def import_upstream_tree(repo, src_dir, version, options, verbose): """import the upstream tree to the current branch""" try: - if repo.replace_tree(src_dir, filters, verbose=True): - gbpc.GitCommitAll(verbose=verbose)(msg=upstream_import_commit_msg(version)) + if repo.replace_tree(src_dir, options.filters, verbose=True): + gbpc.GitCommitAll(verbose=verbose)(msg=upstream_import_commit_msg(options, version)) else: raise GbpNothingImported except gbpc.CommandExecFailed: @@ -104,7 +103,7 @@ def fast_import_upstream_tree(repo, tarball, version, options): if options.verbose: print "Starting fastimport of %s" % tarball fastimport.start_commit(options.upstream_branch, name, email, now, - upstream_import_commit_msg(version)) + upstream_import_commit_msg(options, version)) fastimport.do_deleteall() for item in tar: @@ -192,6 +191,8 @@ def main(argv): dest="pristine_tar") import_group.add_boolean_config_file_option(option_name="filter-pristine-tar", dest="filter_pristine_tar") + import_group.add_config_file_option(option_name="import-msg", + dest="import_msg") cmd_group.add_config_file_option(option_name="postimport", dest="postimport", help="hook run after a successful import, default is '%(postimport)s'") @@ -295,7 +296,7 @@ on howto create it otherwise use --upstream-branch to specify it. if options.fast_import: fast_import_upstream_tree(repo, pristine_orig, version, options) else: - import_upstream_tree(repo, orig_dir, version, options.filters, verbose=not is_empty) + import_upstream_tree(repo, orig_dir, version, options, verbose=not is_empty) if options.pristine_tar: upstream_branch = [ options.upstream_branch, 'master' ][is_empty] |