Skip to content

Navigation Menu

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 dc62096

Browse filesBrowse files
committed
Have initial refresh use a logger to warn
For #1808.
1 parent bc42ee5 commit dc62096
Copy full SHA for dc62096

File tree

1 file changed

+10
-10
lines changed
Filter options

1 file changed

+10
-10
lines changed

‎git/cmd.py

Copy file name to clipboardExpand all lines: git/cmd.py
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,14 +410,14 @@ def refresh(cls, path: Union[None, PathLike] = None) -> bool:
410410
# following values:
411411
#
412412
# 0|q|quiet|s|silence|n|none
413-
# 1|w|warn|warning
414-
# 2|r|raise|e|error
413+
# 1|w|warn|warning|log
414+
# 2|r|raise|e|error|exception
415415

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

418418
quiet = ["quiet", "q", "silence", "s", "none", "n", "0"]
419-
warn = ["warn", "w", "warning", "1"]
420-
error = ["error", "e", "raise", "r", "2"]
419+
warn = ["warn", "w", "warning", "log", "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 ERROR, 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.error("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 ERROR, 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.