Compare commits
No commits in common. "0824d02cd6555dbeb754683e71ff77873ba77cae" and "0c3ddea197c20d3ba27f3688d9b0c3e0888e21dd" have entirely different histories.
0824d02cd6
...
0c3ddea197
1 changed files with 6 additions and 40 deletions
44
gitdch
44
gitdch
|
@ -7,7 +7,6 @@ import logging
|
|||
import os
|
||||
import re
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
import git
|
||||
|
||||
|
@ -70,18 +69,6 @@ parser.add_argument(
|
|||
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(
|
||||
'-n',
|
||||
'--package-name',
|
||||
|
@ -149,17 +136,6 @@ parser.add_argument(
|
|||
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()
|
||||
|
||||
|
@ -237,7 +213,7 @@ version = (
|
|||
)
|
||||
)
|
||||
messages = []
|
||||
for commit in repo.iter_commits(rev=options.revision):
|
||||
for commit in repo.iter_commits():
|
||||
if version_commit is None:
|
||||
version_commit = commit
|
||||
log.debug('Commit %s', commit)
|
||||
|
@ -268,17 +244,11 @@ for version in versions:
|
|||
)
|
||||
)
|
||||
|
||||
for message in version['messages']:
|
||||
for idx, line in enumerate(
|
||||
textwrap.wrap(message, 76, break_long_words=True)
|
||||
):
|
||||
# pylint: disable=consider-using-f-string
|
||||
changelog_lines.append(
|
||||
'{0}{1}\n'.format(
|
||||
' * ' if not idx else ' ',
|
||||
line
|
||||
)
|
||||
)
|
||||
changelog_lines.extend([
|
||||
' * {0}\n'.format(message)
|
||||
for message in version['messages']
|
||||
])
|
||||
|
||||
# pylint: disable=consider-using-f-string
|
||||
changelog_lines.append(
|
||||
|
@ -296,10 +266,6 @@ for version in versions:
|
|||
|
||||
if 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:
|
||||
fd.writelines(changelog_lines)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue