summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--git_command.py2
-rw-r--r--git_config.py2
-rw-r--r--git_refs.py2
-rwxr-xr-xmain.py4
-rw-r--r--progress.py2
-rwxr-xr-xproject.py2
-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
24from error import GitError 24from error import GitError
25import platform_utils 25import platform_utils
26from trace import REPO_TRACE, IsTrace, Trace 26from repo_trace import REPO_TRACE, IsTrace, Trace
27from wrapper import Wrapper 27from wrapper import Wrapper
28 28
29GIT = 'git' 29GIT = '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:
44from signal import SIGTERM 44from signal import SIGTERM
45from error import GitError, UploadError 45from error import GitError, UploadError
46import platform_utils 46import platform_utils
47from trace import Trace 47from repo_trace import Trace
48if is_python3(): 48if is_python3():
49 from http.client import HTTPException 49 from http.client import HTTPException
50else: 50else:
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
17import os 17import os
18from trace import Trace 18from repo_trace import Trace
19import platform_utils 19import platform_utils
20 20
21HEAD = 'HEAD' 21HEAD = 'HEAD'
diff --git a/main.py b/main.py
index 5c546e82..35023d52 100755
--- a/main.py
+++ b/main.py
@@ -45,7 +45,7 @@ except ImportError:
45 45
46from color import SetDefaultColoring 46from color import SetDefaultColoring
47import event_log 47import event_log
48from trace import SetTrace 48from repo_trace import SetTrace
49from git_command import git, GitCommand 49from git_command import git, GitCommand
50from git_config import init_ssh, close_ssh 50from git_config import init_ssh, close_ssh
51from command import InteractiveCommand 51from 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')
85global_options.add_option('--trace', 85global_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)')
88global_options.add_option('--time', 88global_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 @@
17import os 17import os
18import sys 18import sys
19from time import time 19from time import time
20from trace import IsTrace 20from repo_trace import IsTrace
21 21
22_NOT_TTY = not os.isatty(2) 22_NOT_TTY = not os.isatty(2)
23 23
diff --git a/project.py b/project.py
index 5a478b41..8212e0c0 100755
--- a/project.py
+++ b/project.py
@@ -39,7 +39,7 @@ from error import GitError, HookError, UploadError, DownloadError
39from error import ManifestInvalidRevisionError 39from error import ManifestInvalidRevisionError
40from error import NoManifestException 40from error import NoManifestException
41import platform_utils 41import platform_utils
42from trace import IsTrace, Trace 42from repo_trace import IsTrace, Trace
43 43
44from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M 44from 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
19Activated via `repo --trace ...` or `REPO_TRACE=1 repo ...`.
20"""
21
17from __future__ import print_function 22from __future__ import print_function
18import sys 23import sys
19import os 24import os
25
26# Env var to implicitly turn on tracing.
20REPO_TRACE = 'REPO_TRACE' 27REPO_TRACE = 'REPO_TRACE'
21 28
22try: 29_TRACE = os.environ.get(REPO_TRACE) == '1'
23 _TRACE = os.environ[REPO_TRACE] == '1'
24except KeyError:
25 _TRACE = False
26 30
27def IsTrace(): 31def IsTrace():
28 return _TRACE 32 return _TRACE