Compare commits

..

No commits in common. "0824d02cd6555dbeb754683e71ff77873ba77cae" and "0c3ddea197c20d3ba27f3688d9b0c3e0888e21dd" have entirely different histories.

46
gitdch
View file

@ -7,7 +7,6 @@ import logging
import os import os
import re import re
import sys import sys
import textwrap
import git import git
@ -70,18 +69,6 @@ parser.add_argument(
help='Generated Debian changelog output path (default: stdout)', help='Generated Debian changelog output path (default: stdout)',
) )
parser.add_argument(
'-A',
'--append',
action='store_true',
dest='append',
help=(
'Append mode: if the output changelog file already exists, append '
'generated changelog lines at the begining of the file (optional, '
'default: overwriting the file)'
)
)
parser.add_argument( parser.add_argument(
'-n', '-n',
'--package-name', '--package-name',
@ -149,17 +136,6 @@ parser.add_argument(
help='Specify an optional Markdown release notes output path' help='Specify an optional Markdown release notes output path'
) )
parser.add_argument(
'--revision',
type=str,
dest='revision',
help=(
'Specify the revision to use to generate the changelog (see '
'git-rev-parse for viable options, optional, default: generate the '
'changelog with all commits of the current branch) '
),
default=None
)
options = parser.parse_args() options = parser.parse_args()
@ -237,7 +213,7 @@ version = (
) )
) )
messages = [] messages = []
for commit in repo.iter_commits(rev=options.revision): for commit in repo.iter_commits():
if version_commit is None: if version_commit is None:
version_commit = commit version_commit = commit
log.debug('Commit %s', commit) log.debug('Commit %s', commit)
@ -268,17 +244,11 @@ for version in versions:
) )
) )
for message in version['messages']: # pylint: disable=consider-using-f-string
for idx, line in enumerate( changelog_lines.extend([
textwrap.wrap(message, 76, break_long_words=True) ' * {0}\n'.format(message)
): for message in version['messages']
# pylint: disable=consider-using-f-string ])
changelog_lines.append(
'{0}{1}\n'.format(
' * ' if not idx else ' ',
line
)
)
# pylint: disable=consider-using-f-string # pylint: disable=consider-using-f-string
changelog_lines.append( changelog_lines.append(
@ -296,10 +266,6 @@ for version in versions:
if options.output: if options.output:
log.info('Write generated Debian changelog in file %s', options.output) log.info('Write generated Debian changelog in file %s', options.output)
if options.append and os.path.exists(options.output):
with open(options.output, 'r', encoding='utf8') as fd:
changelog_lines += [""]
changelog_lines += fd.readlines()
with open(options.output, 'w', encoding='utf8') as fd: with open(options.output, 'w', encoding='utf8') as fd:
fd.writelines(changelog_lines) fd.writelines(changelog_lines)
else: else: