Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3a6e3ef

Browse filesBrowse files
committed
Have initial refresh use a logger to warn
For #1808. See ac50d8e for details on the changes.
1 parent ac50d8e commit 3a6e3ef
Copy full SHA for 3a6e3ef

File tree

Expand file treeCollapse file tree

1 file changed

+12
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-12
lines changed

‎git/cmd.py

Copy file name to clipboardExpand all lines: git/cmd.py
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,15 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
409409
# expect GIT_PYTHON_REFRESH to either be unset or be one of the
410410
# following values:
411411
#
412-
# 0|q|quiet|s|silence|n|none
413-
# 1|w|warn|warning
414-
# 2|r|raise|e|error
412+
# 0|q|quiet|s|silence|silent|n|none
413+
# 1|w|warn|warning|l|log
414+
# 2|r|raise|e|error|exception
415415

416416
mode = os.environ.get(cls._refresh_env_var, "raise").lower()
417417

418-
quiet = ["quiet", "q", "silence", "s", "none", "n", "0"]
419-
warn = ["warn", "w", "warning", "1"]
420-
error = ["error", "e", "raise", "r", "2"]
418+
quiet = ["quiet", "q", "silence", "s", "silent", "none", "n", "0"]
419+
warn = ["warn", "w", "warning", "log", "l", "1"]
420+
error = ["error", "e", "exception", "raise", "r", "2"]
421421

422422
if mode in quiet:
423423
pass
@@ -428,10 +428,10 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
428428
%s
429429
All git commands will error until this is rectified.
430430
431-
This initial warning can be silenced or aggravated in the future by setting the
431+
This initial message can be silenced or aggravated in the future by setting the
432432
$%s environment variable. Use one of the following values:
433-
- %s: for no warning or exception
434-
- %s: for a printed warning
433+
- %s: for no message or exception
434+
- %s: for a warning message (logged at level CRITICAL, displayed by default)
435435
- %s: for a raised exception
436436
437437
Example:
@@ -450,7 +450,7 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
450450
)
451451

452452
if mode in warn:
453-
print("WARNING: %s" % err)
453+
_logger.critical("WARNING: %s", err)
454454
else:
455455
raise ImportError(err)
456456
else:
@@ -460,8 +460,8 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
460460
%s environment variable has been set but it has been set with an invalid value.
461461
462462
Use only the following values:
463-
- %s: for no warning or exception
464-
- %s: for a printed warning
463+
- %s: for no message or exception
464+
- %s: for a warning message (logged at level CRITICAL, displayed by default)
465465
- %s: for a raised exception
466466
"""
467467
)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.