diff options
author | Mike Frysinger <vapier@google.com> | 2019-08-27 00:26:15 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@google.com> | 2019-08-27 07:08:52 +0000 |
commit | 8a11f6f24cecac28e7cdb3f5d0d7c83aec0df017 (patch) | |
tree | dc1e4815412030e99566be30a4b2a6c2ee6d03ea | |
parent | 898f4e6217ff6d848091f69ef64a10269c9da1cd (diff) | |
download | git-repo-8a11f6f24cecac28e7cdb3f5d0d7c83aec0df017.tar.gz |
rename local trace module
There is a standard Python "trace" module, so having a local trace.py
prevents us being able to import that. Rename the module to avoid.
Change-Id: I23e29ec95a2204bb168a641323d05e76968d9b57
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/234832
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
Tested-by: Mike Frysinger <vapier@google.com>
-rw-r--r-- | git_command.py | 2 | ||||
-rw-r--r-- | git_config.py | 2 | ||||
-rw-r--r-- | git_refs.py | 2 | ||||
-rwxr-xr-x | main.py | 4 | ||||
-rw-r--r-- | progress.py | 2 | ||||
-rwxr-xr-x | project.py | 2 | ||||
-rw-r--r-- | repo_trace.py (renamed from trace.py) | 12 |
7 files changed, 15 insertions, 11 deletions
diff --git a/git_command.py b/git_command.py index f5352ea0..67423035 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -23,7 +23,7 @@ from signal import SIGTERM | |||
23 | 23 | ||
24 | from error import GitError | 24 | from error import GitError |
25 | import platform_utils | 25 | import platform_utils |
26 | from trace import REPO_TRACE, IsTrace, Trace | 26 | from repo_trace import REPO_TRACE, IsTrace, Trace |
27 | from wrapper import Wrapper | 27 | from wrapper import Wrapper |
28 | 28 | ||
29 | GIT = 'git' | 29 | GIT = 'git' |
diff --git a/git_config.py b/git_config.py index 9b3dd25a..1ea9c43e 100644 --- a/git_config.py +++ b/git_config.py | |||
@@ -44,7 +44,7 @@ else: | |||
44 | from signal import SIGTERM | 44 | from signal import SIGTERM |
45 | from error import GitError, UploadError | 45 | from error import GitError, UploadError |
46 | import platform_utils | 46 | import platform_utils |
47 | from trace import Trace | 47 | from repo_trace import Trace |
48 | if is_python3(): | 48 | if is_python3(): |
49 | from http.client import HTTPException | 49 | from http.client import HTTPException |
50 | else: | 50 | else: |
diff --git a/git_refs.py b/git_refs.py index 3187783a..98ed1e2f 100644 --- a/git_refs.py +++ b/git_refs.py | |||
@@ -15,7 +15,7 @@ | |||
15 | # limitations under the License. | 15 | # limitations under the License. |
16 | 16 | ||
17 | import os | 17 | import os |
18 | from trace import Trace | 18 | from repo_trace import Trace |
19 | import platform_utils | 19 | import platform_utils |
20 | 20 | ||
21 | HEAD = 'HEAD' | 21 | HEAD = 'HEAD' |
@@ -45,7 +45,7 @@ except ImportError: | |||
45 | 45 | ||
46 | from color import SetDefaultColoring | 46 | from color import SetDefaultColoring |
47 | import event_log | 47 | import event_log |
48 | from trace import SetTrace | 48 | from repo_trace import SetTrace |
49 | from git_command import git, GitCommand | 49 | from git_command import git, GitCommand |
50 | from git_config import init_ssh, close_ssh | 50 | from git_config import init_ssh, close_ssh |
51 | from command import InteractiveCommand | 51 | from command import InteractiveCommand |
@@ -84,7 +84,7 @@ global_options.add_option('--color', | |||
84 | help='control color usage: auto, always, never') | 84 | help='control color usage: auto, always, never') |
85 | global_options.add_option('--trace', | 85 | global_options.add_option('--trace', |
86 | dest='trace', action='store_true', | 86 | dest='trace', action='store_true', |
87 | help='trace git command execution') | 87 | help='trace git command execution (REPO_TRACE=1)') |
88 | global_options.add_option('--time', | 88 | global_options.add_option('--time', |
89 | dest='time', action='store_true', | 89 | dest='time', action='store_true', |
90 | help='time repo command execution') | 90 | help='time repo command execution') |
diff --git a/progress.py b/progress.py index 64316959..7d4f71f1 100644 --- a/progress.py +++ b/progress.py | |||
@@ -17,7 +17,7 @@ | |||
17 | import os | 17 | import os |
18 | import sys | 18 | import sys |
19 | from time import time | 19 | from time import time |
20 | from trace import IsTrace | 20 | from repo_trace import IsTrace |
21 | 21 | ||
22 | _NOT_TTY = not os.isatty(2) | 22 | _NOT_TTY = not os.isatty(2) |
23 | 23 | ||
@@ -39,7 +39,7 @@ from error import GitError, HookError, UploadError, DownloadError | |||
39 | from error import ManifestInvalidRevisionError | 39 | from error import ManifestInvalidRevisionError |
40 | from error import NoManifestException | 40 | from error import NoManifestException |
41 | import platform_utils | 41 | import platform_utils |
42 | from trace import IsTrace, Trace | 42 | from repo_trace import IsTrace, Trace |
43 | 43 | ||
44 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M | 44 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M |
45 | 45 | ||
diff --git a/trace.py b/repo_trace.py index db514554..f5bc76d4 100644 --- a/trace.py +++ b/repo_trace.py | |||
@@ -14,15 +14,19 @@ | |||
14 | # See the License for the specific language governing permissions and | 14 | # See the License for the specific language governing permissions and |
15 | # limitations under the License. | 15 | # limitations under the License. |
16 | 16 | ||
17 | """Logic for tracing repo interactions. | ||
18 | |||
19 | Activated via `repo --trace ...` or `REPO_TRACE=1 repo ...`. | ||
20 | """ | ||
21 | |||
17 | from __future__ import print_function | 22 | from __future__ import print_function |
18 | import sys | 23 | import sys |
19 | import os | 24 | import os |
25 | |||
26 | # Env var to implicitly turn on tracing. | ||
20 | REPO_TRACE = 'REPO_TRACE' | 27 | REPO_TRACE = 'REPO_TRACE' |
21 | 28 | ||
22 | try: | 29 | _TRACE = os.environ.get(REPO_TRACE) == '1' |
23 | _TRACE = os.environ[REPO_TRACE] == '1' | ||
24 | except KeyError: | ||
25 | _TRACE = False | ||
26 | 30 | ||
27 | def IsTrace(): | 31 | def IsTrace(): |
28 | return _TRACE | 32 | return _TRACE |