diff options
-rw-r--r-- | docs/manpages/git-import-orig.sgml | 15 | ||||
-rw-r--r-- | gbp.conf | 4 | ||||
-rw-r--r-- | gbp/config.py | 2 | ||||
-rwxr-xr-x | git-import-orig | 23 |
4 files changed, 29 insertions, 15 deletions
diff --git a/docs/manpages/git-import-orig.sgml b/docs/manpages/git-import-orig.sgml index 7c19adf6..84811b48 100644 --- a/docs/manpages/git-import-orig.sgml +++ b/docs/manpages/git-import-orig.sgml @@ -24,7 +24,6 @@ <arg><option>--verbose</option></arg> <arg><option>--upstream-version=</option><replaceable>version</replaceable></arg> <arg><option>--no-merge</option></arg> - <arg><option>--no-dch</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-]sign-tags</option></arg> @@ -33,6 +32,7 @@ <arg><option>--filter=</option><replaceable>pattern</replaceable></arg> <arg><option>--[no-]pristine-tar</option></arg> <arg><option>--[no-]filter-pristine-tar</option></arg> + <arg><option>--postimport=cmd</option></arg> <arg choice="plain"><replaceable>upstream-source</replaceable></arg> </cmdsynopsis> </refsynopsisdiv> @@ -70,12 +70,7 @@ <para>Don't merge the upstream version to the development branch</para> </listitem> </varlistentry> - <varlistentry> - <term><option>--no-dch</option></term> - <listitem> - <para>don't call dch after the import</para> - </listitem> - </varlistentry> + <varlistentry> <term><option>--upstream-branch</option>=<replaceable>branch_name</replaceable> </term> @@ -145,6 +140,12 @@ passed to pristine tar</para> </listitem> </varlistentry> + <varlistentry> + <term><option>--postimport=<replaceable>cmd</replaceable></option></term> + <listitem> + <para>run <replaceable>cmd</replaceable> after the import.</para> + </listitem> + </varlistentry> </variablelist> </refsect1> <refsect1> @@ -39,6 +39,10 @@ #filter = .svn # filter out files from tarball passed to pristine tar #filter-pristine-tar = True +# hook run after the import: +#postimport = git-dch -N%(version)s -S -a +# emulate old behaviour of calling dch: +#postimport = dch -v%(version)s New Upstream Version # Options only affecting git-import-dsc [git-import-dsc] diff --git a/gbp/config.py b/gbp/config.py index 9aec3957..f670ad5e 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -36,6 +36,7 @@ class GbpOptionParser(OptionParser): 'keyid' : '', 'posttag' : '', 'postbuild' : '', + 'postimport' : '', 'debian-tag' : 'debian/%(version)s', 'upstream-tag' : 'upstream/%(version)s', 'filter' : [], @@ -50,7 +51,6 @@ class GbpOptionParser(OptionParser): 'meta-closes' : 'Closes|LP', 'full' : 'False', 'id-length' : '0', - 'no-dch' : 'False', 'git-author' : 'False', } help = { diff --git a/git-import-orig b/git-import-orig index fff88386..63d12f97 100755 --- a/git-import-orig +++ b/git-import-orig @@ -221,13 +221,11 @@ def main(argv): "options related to git tag creation") branch_group = GbpOptionGroup(parser, "version and branch naming options", "version number and branch layout options") + cmd_group = GbpOptionGroup(parser, "external command options", "how and when to invoke external commands and hooks") - for group in [import_group, branch_group, cl_group, tag_group ]: + for group in [import_group, branch_group, cl_group, tag_group, cmd_group ]: parser.add_option_group(group) - cl_group.add_config_file_option(option_name="no-dch", dest='no_dch', - help="don't call dch after the import", action="store_true") - branch_group.add_option("-u", "--upstream-version", dest="version", help="Upstream Version") branch_group.add_config_file_option(option_name="debian-branch", @@ -254,14 +252,24 @@ def main(argv): dest="pristine_tar") import_group.add_boolean_config_file_option(option_name="filter-pristine-tar", dest="filter_pristine_tar") + cmd_group.add_config_file_option(option_name="postimport", dest="postimport", + help="hook run after a successful import, default is '%(postimport)s'") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="verbose command execution") + + # Accepted for compatibility + parser.add_option("--no-dch", dest='no_dch', action="store_true", + default=False, help="deprecated - don't use.") + (options, args) = parser.parse_args(argv[1:]) if options.verbose: gbpc.Command.verbose = True + if options.no_dch: + print >>sys.stderr, "'--no-dch' passed. This is now the default, please remove this option." + if options.filters: turn_off_fastimport(options, "Import filters currently not supported with fastimport.") @@ -369,14 +377,15 @@ on howto create it otherwise use --upstream-branch to specify it. try: gbpc.GitMerge(tag)() except gbpc.CommandExecFailed: - raise GbpError, """Merge failed, please resolve and run "dch -v %s-1".""" % version - if not options.no_dch: + raise GbpError, """Merge failed, please resolve.""" % version + if options.postimport: epoch = '' if os.access('debian/changelog', os.R_OK): cp = parse_changelog('debian/changelog') if has_epoch(cp): epoch = '%s:' % cp['Epoch'] - gbpc.Dch("%s%s-1" % (epoch, version), 'New Upstream Version')() + info = { 'version': "%s%s-1" % (epoch, version) } + cmd = gbpc.Command(options.postimport % info, shell=True)() except gbpc.CommandExecFailed: raise GbpError, "Import of %s failed" % archive except GbpNothingImported, err: |