Hi Linn,
On Fri, Sep 23, 2016 at 03:04:21PM -0600, Linn Crosetto wrote:
> Package: git-buildpackage
> Version: 0.8.3
> Severity: normal
> Tags: patch
> 
> When using gbp dch in snapshot mode, a section is added without checking
> whether the distribution is set to UNRELEASED. If the distribution is
> UNRELEASED, the version will be incremented but the current section will be
> edited, resulting in a skipped version in the changelog. 
> 
> For example, after gbp dch -S -a:
> 
> -git-buildpackage (0.8.3+nmu1) UNRELEASED; urgency=medium
> +git-buildpackage (0.8.3+nmu2~1.gbp74f785) UNRELEASED; urgency=medium
> +
> +  ** SNAPSHOT build @74f785ef4ed2e450abc97d882284651e968b7683 **
> 
>    * Non-maintainer upload.
> +  * UNRELEASED
> 
> - -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 18:51:37 +0000
> + -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 14:46:07 -0600
> 
>  git-buildpackage (0.8.3) unstable; urgency=medium
> 
> 
> Then after gbp dch --release:
> 
> 
> -git-buildpackage (0.8.3+nmu1) UNRELEASED; urgency=medium
> +git-buildpackage (0.8.3+nmu2) unstable; urgency=medium
> 
>    * Non-maintainer upload.
> +  * dch: avoid adding section in snapshot mode if distribution is UNRELEASED
> 
> - -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 18:51:37 +0000
> + -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 14:47:01 -0600
> 
> 
> I have included a patch to changing this behavior to add a new section in
> snapshot mode only if the distribution is not set to UNRELEASED.
> 
> An example of the new behavior, after gbp dch -S -a:
> 
> 
> -git-buildpackage (0.8.3+nmu1) UNRELEASED; urgency=medium
> +git-buildpackage (0.8.3+nmu1~1.gbp74f785) UNRELEASED; urgency=medium
> +
> +  ** SNAPSHOT build @74f785ef4ed2e450abc97d882284651e968b7683 **
>  
>    * Non-maintainer upload.
> 
> 
> Then after gbp dch --release:
> 
> 
> -git-buildpackage (0.8.3+nmu1) UNRELEASED; urgency=medium
> +git-buildpackage (0.8.3+nmu1) unstable; urgency=medium
>  
>    * Non-maintainer upload.
> +  * dch: avoid adding section in snapshot mode if distribution is UNRELEASED
>  
> - -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 18:51:37 +0000
> + -- Linn Crosetto <l...@hpe.com>  Fri, 23 Sep 2016 20:56:40 +0000
>  
>  git-buildpackage (0.8.3) unstable; urgency=medium
> 
> 
> Thanks.

> >From 8f6ae69c2e1a432d8c4e26d5997eddc5bc7ae162 Mon Sep 17 00:00:00 2001
> From: Linn Crosetto <l...@hpe.com>
> Date: Wed, 21 Sep 2016 15:59:00 -0600
> Subject: [PATCH] dch: avoid adding section in snapshot mode if distribution is
>  UNRELEASED
> 
> When using git-dch in snapshot mode, a section is added without checking
> whether the distribution is set to UNRELEASED. If the distribution is
> UNRELEASED, the version will be incremented but a new section will not be
> added, resulting in a skipped version in the changelog.
> 
> Change this behavior to add a new section in snapshot mode only if the
> distribution is not set to UNRELEASED.
> 
> Signed-off-by: Linn Crosetto <l...@hpe.com>
> ---
>  gbp/scripts/dch.py | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py
> index 2ccbacb..f9f60c0 100644
> --- a/gbp/scripts/dch.py
> +++ b/gbp/scripts/dch.py
> @@ -483,12 +483,13 @@ def main(argv):
>                  version_change['version'] = options.new_version
>              # the user wants to force a new version
>              add_section = True
> -        elif cp['Distribution'] != "UNRELEASED" and not 
> found_snapshot_banner and commits:
> -            # the last version was a release and we have pending commits
> -            add_section = True
> -        elif options.snapshot and not found_snapshot_banner:
> -            # the user want to switch to snapshot mode
> -            add_section = True
> +        elif cp['Distribution'] != "UNRELEASED" and not 
> found_snapshot_banner:
> +            if commits:
> +                # the last version was a release and we have pending commits
> +                add_section = True
> +            if options.snapshot:
> +                # the user want to switch to snapshot mode
> +                add_section = True
>          else:
>              add_section = False

This makes sense. Can you add a test to 11_test_dch_main.py to make sure
we don't break this again in the future?
Cheers,
 -- Guido

Reply via email to