Skip to content

Commit f59b6d0

Browse files
polymorcodeustimvink
authored andcommitted
Update page.py
Copy strict flag behavior from mkdocs-git-revision-date-localized-plugin on handling INFO vs WARNING errors
1 parent ddec01f commit f59b6d0

File tree

1 file changed

+13
-5
lines changed
  • mkdocs_git_authors_plugin/git

1 file changed

+13
-5
lines changed

mkdocs_git_authors_plugin/git/page.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Page(AbstractRepoObject):
1818
modified by that commit.
1919
"""
2020

21-
def __init__(self, repo: Repo, path: Path):
21+
def __init__(self, repo: Repo, path: Path, strict: bool):
2222
"""
2323
Instantiate a Page object
2424
@@ -31,13 +31,21 @@ def __init__(self, repo: Repo, path: Path):
3131
self._sorted = False
3232
self._total_lines = 0
3333
self._authors: List[dict] = list()
34+
self._strict = strict
35+
3436
try:
3537
self._process_git_blame()
3638
except GitCommandError:
37-
logger.warning(
38-
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
39-
% path
40-
)
39+
if self._strict:
40+
logger.warning(
41+
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
42+
% path
43+
)
44+
else:
45+
logger.info(
46+
"[git-authors-plugin] %s has not been committed yet. Lines are not counted"
47+
% path
48+
)
4149

4250
def add_total_lines(self, cnt: int = 1):
4351
"""

0 commit comments

Comments
 (0)