Add --revision parameter to allow to control the commits used to generate the changelog

This commit is contained in:
Benjamin Renard 2022-12-12 11:19:08 +01:00
parent e71611f17a
commit 5c5481ea57

13
gitdch
View file

@ -148,6 +148,17 @@ 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()
@ -225,7 +236,7 @@ version = (
) )
) )
messages = [] messages = []
for commit in repo.iter_commits(): for commit in repo.iter_commits(rev=options.revision):
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)