Skip to content

Commit

Permalink
Update page.py
Browse files Browse the repository at this point in the history
Copy strict flag behavior from mkdocs-git-revision-date-localized-plugin on handling INFO vs WARNING errors
  • Loading branch information
polymorcodeus authored and timvink committed Jun 8, 2023
1 parent ddec01f commit f59b6d0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions mkdocs_git_authors_plugin/git/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Page(AbstractRepoObject):
modified by that commit.
"""

def __init__(self, repo: Repo, path: Path):
def __init__(self, repo: Repo, path: Path, strict: bool):
"""
Instantiate a Page object
Expand All @@ -31,13 +31,21 @@ def __init__(self, repo: Repo, path: Path):
self._sorted = False
self._total_lines = 0
self._authors: List[dict] = list()
self._strict = strict

try:
self._process_git_blame()
except GitCommandError:
logger.warning(
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
% path
)
if self._strict:
logger.warning(
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
% path
)
else:
logger.info(
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
% path
)

def add_total_lines(self, cnt: int = 1):
"""
Expand Down

0 comments on commit f59b6d0

Please sign in to comment.