On Fri, Dec 18, 2009 at 05:33:23PM +0100, Matthijs Kooijman wrote:
> Fixed version of this patch, I missed that parse_commit was used twice
> on my first try. Sorry for that.
I've already applied the other one. Could you please diff against
current git.

[..snip..] 
>  def guess_snapshot_commit(cp, repo, options):
> @@ -371,25 +379,39 @@ def main(argv):
>          else:
>              add_section = False
>  
> -        if add_section:
> -            if commits:
> -                first_commit = commits[0]
> -                commits = commits[1:]
> -                commit_msg, (commit_author, commit_email) = 
> parse_commit(repo, first_commit, options)
> +        for c in commits:
> +            parsed = parse_commit(repo, c, options)
> +            if not parsed:
> +                # Some commits can be ignored
> +                continue
> +
> +            commit_msg, (commit_author, commit_email) = parsed
> +            if add_section:
> +                # Add a section containing just this message (we can't
> +                # add an empty section with dch).
> +                add_changelog_section(distribution="UNRELEASED", 
> msg=commit_msg,
> +                                      version=options.new_version, 
> author=commit_author,
> +                                      email=commit_email)
> +                # Adding a section only needs to happen once.
> +                add_section = False
>              else:
> -                commit_msg = "UNRELEASED"
> -                commit_author = None
> -                commit_email = None
> -            add_changelog_section(distribution="UNRELEASED", msg=commit_msg,
> -                                  version=options.new_version, 
> author=commit_author,
> -                                  email=commit_email)
> -
> -        if commits:
> -            shortlog_to_dch(repo, commits, options)
> -            fixup_trailer(repo, git_author=options.git_author)
> -        elif not first_commit:
> +                add_changelog_entry(commit_msg, commit_author, commit_email)
> +
> +
> +        # Show a message if there were no commits (not even ignored
> +        # commits).
> +        if not commits:
>              print "No changes detected from %s to %s." % (since, until)
>  
> +        if add_section:
> +            # If we end up here, then there were no commits to include,
> +            # so we put a dummy message in the new section.
> +            commit_msg = "UNRELEASED"
> +            add_changelog_section(distribution="UNRELEASED", 
> msg="UNRELEASED",
> +                                  version=options.new_version)
> +
> +        fixup_trailer(repo, git_author=options.git_author)
> +
The only change here is that you loop over the commits until you find a
commit that is not ignored.
Wouldn't it be simpler and much short to loop in:

if add_section:
        ....

until you find a valid commit?
Cheers,
 -- Guido




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to