|
5 | 5 |
|
6 | 6 | """Module implementing a remote object allowing easy access to git remotes."""
|
7 | 7 |
|
| 8 | +import contextlib |
8 | 9 | import logging
|
9 | 10 | import re
|
10 | 11 |
|
11 |
| -from git.cmd import handle_process_output, Git |
| 12 | +from git.cmd import Git, handle_process_output |
12 | 13 | from git.compat import defenc, force_text
|
| 14 | +from git.config import GitConfigParser, SectionConstraint, cp |
13 | 15 | from git.exc import GitCommandError
|
| 16 | +from git.refs import Head, Reference, RemoteReference, SymbolicReference, TagReference |
14 | 17 | from git.util import (
|
15 |
| - LazyMixin, |
16 |
| - IterableObj, |
| 18 | + CallableRemoteProgress, |
17 | 19 | IterableList,
|
| 20 | + IterableObj, |
| 21 | + LazyMixin, |
18 | 22 | RemoteProgress,
|
19 |
| - CallableRemoteProgress, |
20 |
| -) |
21 |
| -from git.util import ( |
22 | 23 | join_path,
|
23 | 24 | )
|
24 | 25 |
|
25 |
| -from git.config import ( |
26 |
| - GitConfigParser, |
27 |
| - SectionConstraint, |
28 |
| - cp, |
29 |
| -) |
30 |
| -from git.refs import Head, Reference, RemoteReference, SymbolicReference, TagReference |
31 |
| - |
32 | 26 | # typing-------------------------------------------------------
|
33 | 27 |
|
34 | 28 | from typing import (
|
@@ -345,18 +339,13 @@ class FetchInfo(IterableObj):
|
345 | 339 | @classmethod
|
346 | 340 | def refresh(cls) -> Literal[True]:
|
347 | 341 | """This gets called by the refresh function (see the top level __init__)."""
|
348 |
| - # clear the old values in _flag_map |
349 |
| - try: |
| 342 | + # Clear the old values in _flag_map. |
| 343 | + with contextlib.suppress(KeyError): |
350 | 344 | del cls._flag_map["t"]
|
351 |
| - except KeyError: |
352 |
| - pass |
353 |
| - |
354 |
| - try: |
| 345 | + with contextlib.suppress(KeyError): |
355 | 346 | del cls._flag_map["-"]
|
356 |
| - except KeyError: |
357 |
| - pass |
358 | 347 |
|
359 |
| - # set the value given the git version |
| 348 | + # Set the value given the git version. |
360 | 349 | if Git().version_info[:2] >= (2, 10):
|
361 | 350 | cls._flag_map["t"] = cls.TAG_UPDATE
|
362 | 351 | else:
|
|
0 commit comments