diff options
author | Joanna Wang <jojwang@google.com> | 2022-11-03 16:51:19 -0400 |
---|---|---|
committer | Joanna Wang <jojwang@google.com> | 2022-11-03 21:07:07 +0000 |
commit | a6c52f566acfbff5b0f37158c0d33adf05d250e5 (patch) | |
tree | d79d55b872c3be39c54dcb6ef41749c40d39ccf2 /project.py | |
parent | 0d130d2da0754c546f654ede99a79aac2b8e6c5f (diff) | |
download | git-repo-a6c52f566acfbff5b0f37158c0d33adf05d250e5.tar.gz |
Set tracing to always on and save to .repo/TRACE_FILE.
- add `--trace_to_stderr` option so stderr will include trace outputs and any other errors that get sent to stderr
- while TRACE_FILE will only include trace outputs
piggy-backing on: https://gerrit-review.googlesource.com/c/git-repo/+/349154
Change-Id: I3895a84de4b2784f17fac4325521cd5e72e645e2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/350114
Reviewed-by: LaMont Jones <lamontjones@google.com>
Tested-by: Joanna Wang <jojwang@google.com>
Diffstat (limited to 'project.py')
-rw-r--r-- | project.py | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -41,7 +41,7 @@ from error import ManifestInvalidRevisionError, ManifestInvalidPathError | |||
41 | from error import NoManifestException, ManifestParseError | 41 | from error import NoManifestException, ManifestParseError |
42 | import platform_utils | 42 | import platform_utils |
43 | import progress | 43 | import progress |
44 | from repo_trace import IsTrace, Trace | 44 | from repo_trace import Trace |
45 | 45 | ||
46 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M | 46 | from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M |
47 | 47 | ||
@@ -2416,16 +2416,16 @@ class Project(object): | |||
2416 | srcUrl = 'http' + srcUrl[len('persistent-http'):] | 2416 | srcUrl = 'http' + srcUrl[len('persistent-http'):] |
2417 | cmd += [srcUrl] | 2417 | cmd += [srcUrl] |
2418 | 2418 | ||
2419 | if IsTrace(): | 2419 | proc = None |
2420 | Trace('%s', ' '.join(cmd)) | 2420 | with Trace('Fetching bundle: %s', ' '.join(cmd)): |
2421 | if verbose: | 2421 | if verbose: |
2422 | print('%s: Downloading bundle: %s' % (self.name, srcUrl)) | 2422 | print('%s: Downloading bundle: %s' % (self.name, srcUrl)) |
2423 | stdout = None if verbose else subprocess.PIPE | 2423 | stdout = None if verbose else subprocess.PIPE |
2424 | stderr = None if verbose else subprocess.STDOUT | 2424 | stderr = None if verbose else subprocess.STDOUT |
2425 | try: | 2425 | try: |
2426 | proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) | 2426 | proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) |
2427 | except OSError: | 2427 | except OSError: |
2428 | return False | 2428 | return False |
2429 | 2429 | ||
2430 | (output, _) = proc.communicate() | 2430 | (output, _) = proc.communicate() |
2431 | curlret = proc.returncode | 2431 | curlret = proc.returncode |