From a6c52f566acfbff5b0f37158c0d33adf05d250e5 Mon Sep 17 00:00:00 2001 From: Joanna Wang Date: Thu, 3 Nov 2022 16:51:19 -0400 Subject: 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 Tested-by: Joanna Wang --- project.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'project.py') diff --git a/project.py b/project.py index 1c85b044..b975b72a 100644 --- a/project.py +++ b/project.py @@ -41,7 +41,7 @@ from error import ManifestInvalidRevisionError, ManifestInvalidPathError from error import NoManifestException, ManifestParseError import platform_utils import progress -from repo_trace import IsTrace, Trace +from repo_trace import Trace from git_refs import GitRefs, HEAD, R_HEADS, R_TAGS, R_PUB, R_M, R_WORKTREE_M @@ -2416,16 +2416,16 @@ class Project(object): srcUrl = 'http' + srcUrl[len('persistent-http'):] cmd += [srcUrl] - if IsTrace(): - Trace('%s', ' '.join(cmd)) - if verbose: - print('%s: Downloading bundle: %s' % (self.name, srcUrl)) - stdout = None if verbose else subprocess.PIPE - stderr = None if verbose else subprocess.STDOUT - try: - proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) - except OSError: - return False + proc = None + with Trace('Fetching bundle: %s', ' '.join(cmd)): + if verbose: + print('%s: Downloading bundle: %s' % (self.name, srcUrl)) + stdout = None if verbose else subprocess.PIPE + stderr = None if verbose else subprocess.STDOUT + try: + proc = subprocess.Popen(cmd, stdout=stdout, stderr=stderr) + except OSError: + return False (output, _) = proc.communicate() curlret = proc.returncode -- cgit v1.2.3-54-g00ecf