From 4503a4b01c83e4a7750b4e832dd5a0756a25cda6 Mon Sep 17 00:00:00 2001 From: lethee Date: Tue, 21 Jul 2020 10:29:48 +0900 Subject: [PATCH] add hide_merge_commit for less content add hide_merge_commit in git_changelog for less content --- sphinx_git/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sphinx_git/__init__.py b/sphinx_git/__init__.py index 958e189..8ae092a 100644 --- a/sphinx_git/__init__.py +++ b/sphinx_git/__init__.py @@ -118,6 +118,7 @@ class GitChangelog(GitDirectiveBase): 'hide_author': bool, 'hide_date': bool, 'hide_details': bool, + 'hide_merge_commit': bool, 'repo-dir': six.text_type, } @@ -168,6 +169,9 @@ def _filter_commits_on_filenames(self, commits): def _build_markup(self, commits): list_node = nodes.bullet_list() for commit in commits: + if self.options.get('hide_merge_commit') and len(commit.parents) > 1: + continue + date_str = datetime.fromtimestamp(commit.authored_date) if '\n' in commit.message: message, detailed_message = commit.message.split('\n', 1)