Skip to content

Commit

Permalink
Revamped terminal output for update.
Browse files Browse the repository at this point in the history
Features:

- Non-verbose output is now limited to a one-line progress
indicator.

- Verbose output is now collated per subprocess.  As soon as a
subprocess finishes, its full output is dumped to terminal.

- Verbose output is prefixed with timestamps representing elapsed
time since the beginning of the gclient invocation.

- git progress indicators ("Receiving objects", etc.) are limited to
one line every 10 seconds.

- In both verbose and non-verbose mode, if a failure occurs, the
full output of the failed update operation is dumped to terminal
just before exit.

- In the event that updates are progressing, but slowly,
"Still working" messages will be printed periodically, to pacify
users and buildbots.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/227163002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@262500 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
[email protected] committed Apr 8, 2014
1 parent c1c9c4f commit fe0d190
Show file tree
Hide file tree
Showing 7 changed files with 303 additions and 189 deletions.
29 changes: 19 additions & 10 deletions gclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ def LateOverride(self, url):
parent_url = self.parent.parsed_url
if isinstance(parent_url, self.FileImpl):
parent_url = parent_url.file_location
scm = gclient_scm.CreateSCM(parent_url, self.root.root_dir, None)
scm = gclient_scm.CreateSCM(
parent_url, self.root.root_dir, None, self.outbuf)
parsed_url = scm.FullUrlForRelativeUrl(url)
else:
parsed_url = url
Expand Down Expand Up @@ -657,7 +658,8 @@ def run(self, revision_overrides, command, args, work_queue, options):
# pylint: disable=E1103
options.revision = parsed_url.GetRevision()
self._used_scm = gclient_scm.SVNWrapper(
parsed_url.GetPath(), self.root.root_dir, self.name)
parsed_url.GetPath(), self.root.root_dir, self.name,
out_cb=work_queue.out_cb)
self._used_scm.RunCommand('updatesingle',
options, args + [parsed_url.GetFilename()], file_list)
else:
Expand All @@ -667,7 +669,8 @@ def run(self, revision_overrides, command, args, work_queue, options):
self.maybeGetParentRevision(
command, options, parsed_url, self.parent.name, revision_overrides)
self._used_scm = gclient_scm.CreateSCM(
parsed_url, self.root.root_dir, self.name)
parsed_url, self.root.root_dir, self.name, self.outbuf,
out_cb=work_queue.out_cb)
self._got_revision = self._used_scm.RunCommand(command, options, args,
file_list)
if file_list:
Expand Down Expand Up @@ -724,7 +727,7 @@ def mod_path(git_pathspec):

match = re.match('^Binary file ([^\0]+) matches$', line)
if match:
print 'Binary file %s matches' % mod_path(match.group(1))
print 'Binary file %s matches\n' % mod_path(match.group(1))
return

items = line.split('\0')
Expand Down Expand Up @@ -1050,7 +1053,8 @@ def _CheckConfig(self):
solutions."""
for dep in self.dependencies:
if dep.managed and dep.url:
scm = gclient_scm.CreateSCM(dep.url, self.root_dir, dep.name)
scm = gclient_scm.CreateSCM(
dep.url, self.root_dir, dep.name, self.outbuf)
actual_url = scm.GetActualRemoteURL(self._options)
if actual_url and not scm.DoesRemoteURLMatch(self._options):
raise gclient_utils.Error('''
Expand Down Expand Up @@ -1234,7 +1238,8 @@ def _ApplySafeSyncRev(self, dep):
'It appears your safesync_url (%s) is not working properly\n'
'(as it returned an empty response). Check your config.' %
dep.safesync_url)
scm = gclient_scm.CreateSCM(dep.url, dep.root.root_dir, dep.name)
scm = gclient_scm.CreateSCM(
dep.url, dep.root.root_dir, dep.name, self.outbuf)
safe_rev = scm.GetUsableRev(rev, self._options)
if self._options.verbose:
print('Using safesync_url revision: %s.\n' % safe_rev)
Expand Down Expand Up @@ -1265,7 +1270,8 @@ def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
elif command == 'recurse':
pm = Progress(' '.join(args), 1)
work_queue = gclient_utils.ExecutionQueue(
self._options.jobs, pm, ignore_requirements=ignore_requirements)
self._options.jobs, pm, ignore_requirements=ignore_requirements,
verbose=self._options.verbose)
for s in self.dependencies:
work_queue.enqueue(s)
work_queue.flush(revision_overrides, command, args, options=self._options)
Expand Down Expand Up @@ -1301,7 +1307,8 @@ def _IsParentOfAny(parent, path_list):
if (entry not in entries and
(not any(path.startswith(entry + '/') for path in entries)) and
os.path.exists(e_dir)):
scm = gclient_scm.CreateSCM(prev_url, self.root_dir, entry_fixed)
scm = gclient_scm.CreateSCM(
prev_url, self.root_dir, entry_fixed, self.outbuf)

# Check to see if this directory is now part of a higher-up checkout.
if scm.GetCheckoutRoot() in full_entries:
Expand Down Expand Up @@ -1332,7 +1339,8 @@ def PrintRevInfo(self):
if not self.dependencies:
raise gclient_utils.Error('No solution specified')
# Load all the settings.
work_queue = gclient_utils.ExecutionQueue(self._options.jobs, None, False)
work_queue = gclient_utils.ExecutionQueue(
self._options.jobs, None, False, verbose=self._options.verbose)
for s in self.dependencies:
work_queue.enqueue(s)
work_queue.flush({}, None, [], options=self._options)
Expand All @@ -1346,7 +1354,8 @@ def GetURLAndRev(dep):
else:
original_url = dep.parsed_url
url, _ = gclient_utils.SplitUrlRevision(original_url)
scm = gclient_scm.CreateSCM(original_url, self.root_dir, dep.name)
scm = gclient_scm.CreateSCM(
original_url, self.root_dir, dep.name, self.outbuf)
if not os.path.isdir(scm.checkout_path):
return None
return '%s@%s' % (url, scm.revinfo(self._options, [], None))
Expand Down
Loading

0 comments on commit fe0d190

Please sign in to comment.