|
|
|
@ -1563,76 +1563,14 @@ it or fix the checkout.
|
|
|
|
|
patch_refs[patch_repo] = patch_ref
|
|
|
|
|
return patch_refs, target_branches
|
|
|
|
|
|
|
|
|
|
def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
|
|
|
|
|
"""Runs a command on each dependency in a client and its dependencies.
|
|
|
|
|
def _RemoveUnversionedGitDirs(self):
|
|
|
|
|
"""Remove directories that are no longer part of the checkout.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
command: The command to use (e.g., 'status' or 'diff')
|
|
|
|
|
args: list of str - extra arguments to add to the command line.
|
|
|
|
|
Notify the user if there is an orphaned entry in their working copy.
|
|
|
|
|
Only delete the directory if there are no changes in it, and
|
|
|
|
|
delete_unversioned_trees is set to true.
|
|
|
|
|
"""
|
|
|
|
|
if not self.dependencies:
|
|
|
|
|
raise gclient_utils.Error('No solution specified')
|
|
|
|
|
|
|
|
|
|
revision_overrides = {}
|
|
|
|
|
patch_refs = {}
|
|
|
|
|
target_branches = {}
|
|
|
|
|
# It's unnecessary to check for revision overrides for 'recurse'.
|
|
|
|
|
# Save a few seconds by not calling _EnforceRevisions() in that case.
|
|
|
|
|
if command not in ('diff', 'recurse', 'runhooks', 'status', 'revert',
|
|
|
|
|
'validate'):
|
|
|
|
|
self._CheckConfig()
|
|
|
|
|
revision_overrides = self._EnforceRevisions()
|
|
|
|
|
|
|
|
|
|
if command == 'update':
|
|
|
|
|
patch_refs, target_branches = self._EnforcePatchRefsAndBranches()
|
|
|
|
|
# Disable progress for non-tty stdout.
|
|
|
|
|
should_show_progress = (
|
|
|
|
|
setup_color.IS_TTY and not self._options.verbose and progress)
|
|
|
|
|
pm = None
|
|
|
|
|
if should_show_progress:
|
|
|
|
|
if command in ('update', 'revert'):
|
|
|
|
|
pm = Progress('Syncing projects', 1)
|
|
|
|
|
elif command in ('recurse', 'validate'):
|
|
|
|
|
pm = Progress(' '.join(args), 1)
|
|
|
|
|
work_queue = gclient_utils.ExecutionQueue(
|
|
|
|
|
self._options.jobs, pm, ignore_requirements=ignore_requirements,
|
|
|
|
|
verbose=self._options.verbose)
|
|
|
|
|
for s in self.dependencies:
|
|
|
|
|
if s.should_process:
|
|
|
|
|
work_queue.enqueue(s)
|
|
|
|
|
work_queue.flush(revision_overrides, command, args, options=self._options,
|
|
|
|
|
patch_refs=patch_refs, target_branches=target_branches)
|
|
|
|
|
|
|
|
|
|
if revision_overrides:
|
|
|
|
|
print('Please fix your script, having invalid --revision flags will soon '
|
|
|
|
|
'be considered an error.', file=sys.stderr)
|
|
|
|
|
|
|
|
|
|
if patch_refs:
|
|
|
|
|
raise gclient_utils.Error(
|
|
|
|
|
'The following --patch-ref flags were not used. Please fix it:\n%s' %
|
|
|
|
|
('\n'.join(
|
|
|
|
|
patch_repo + '@' + patch_ref
|
|
|
|
|
for patch_repo, patch_ref in patch_refs.iteritems())))
|
|
|
|
|
|
|
|
|
|
# Once all the dependencies have been processed, it's now safe to write
|
|
|
|
|
# out the gn_args_file and run the hooks.
|
|
|
|
|
if command == 'update':
|
|
|
|
|
gn_args_dep = self.dependencies[0]
|
|
|
|
|
if gn_args_dep._gn_args_from:
|
|
|
|
|
deps_map = dict([(dep.name, dep) for dep in gn_args_dep.dependencies])
|
|
|
|
|
gn_args_dep = deps_map.get(gn_args_dep._gn_args_from)
|
|
|
|
|
if gn_args_dep and gn_args_dep.HasGNArgsFile():
|
|
|
|
|
gn_args_dep.WriteGNArgsFile()
|
|
|
|
|
|
|
|
|
|
if not self._options.nohooks:
|
|
|
|
|
if should_show_progress:
|
|
|
|
|
pm = Progress('Running hooks', 1)
|
|
|
|
|
self.RunHooksRecursively(self._options, pm)
|
|
|
|
|
|
|
|
|
|
if command == 'update':
|
|
|
|
|
# Notify the user if there is an orphaned entry in their working copy.
|
|
|
|
|
# Only delete the directory if there are no changes in it, and
|
|
|
|
|
# delete_unversioned_trees is set to true.
|
|
|
|
|
entries = [i.name for i in self.root.subtree(False) if i.url]
|
|
|
|
|
full_entries = [os.path.join(self.root_dir, e.replace('/', os.path.sep))
|
|
|
|
|
for e in entries]
|
|
|
|
@ -1722,12 +1660,81 @@ it or fix the checkout.
|
|
|
|
|
# record the current list of entries for next time
|
|
|
|
|
self._SaveEntries()
|
|
|
|
|
|
|
|
|
|
def RunOnDeps(self, command, args, ignore_requirements=False, progress=True):
|
|
|
|
|
"""Runs a command on each dependency in a client and its dependencies.
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
command: The command to use (e.g., 'status' or 'diff')
|
|
|
|
|
args: list of str - extra arguments to add to the command line.
|
|
|
|
|
"""
|
|
|
|
|
if not self.dependencies:
|
|
|
|
|
raise gclient_utils.Error('No solution specified')
|
|
|
|
|
|
|
|
|
|
revision_overrides = {}
|
|
|
|
|
patch_refs = {}
|
|
|
|
|
target_branches = {}
|
|
|
|
|
# It's unnecessary to check for revision overrides for 'recurse'.
|
|
|
|
|
# Save a few seconds by not calling _EnforceRevisions() in that case.
|
|
|
|
|
if command not in ('diff', 'recurse', 'runhooks', 'status', 'revert',
|
|
|
|
|
'validate'):
|
|
|
|
|
self._CheckConfig()
|
|
|
|
|
revision_overrides = self._EnforceRevisions()
|
|
|
|
|
|
|
|
|
|
if command == 'update':
|
|
|
|
|
patch_refs, target_branches = self._EnforcePatchRefsAndBranches()
|
|
|
|
|
# Disable progress for non-tty stdout.
|
|
|
|
|
should_show_progress = (
|
|
|
|
|
setup_color.IS_TTY and not self._options.verbose and progress)
|
|
|
|
|
pm = None
|
|
|
|
|
if should_show_progress:
|
|
|
|
|
if command in ('update', 'revert'):
|
|
|
|
|
pm = Progress('Syncing projects', 1)
|
|
|
|
|
elif command in ('recurse', 'validate'):
|
|
|
|
|
pm = Progress(' '.join(args), 1)
|
|
|
|
|
work_queue = gclient_utils.ExecutionQueue(
|
|
|
|
|
self._options.jobs, pm, ignore_requirements=ignore_requirements,
|
|
|
|
|
verbose=self._options.verbose)
|
|
|
|
|
for s in self.dependencies:
|
|
|
|
|
if s.should_process:
|
|
|
|
|
work_queue.enqueue(s)
|
|
|
|
|
work_queue.flush(revision_overrides, command, args, options=self._options,
|
|
|
|
|
patch_refs=patch_refs, target_branches=target_branches)
|
|
|
|
|
|
|
|
|
|
if revision_overrides:
|
|
|
|
|
print('Please fix your script, having invalid --revision flags will soon '
|
|
|
|
|
'be considered an error.', file=sys.stderr)
|
|
|
|
|
|
|
|
|
|
if patch_refs:
|
|
|
|
|
raise gclient_utils.Error(
|
|
|
|
|
'The following --patch-ref flags were not used. Please fix it:\n%s' %
|
|
|
|
|
('\n'.join(
|
|
|
|
|
patch_repo + '@' + patch_ref
|
|
|
|
|
for patch_repo, patch_ref in patch_refs.iteritems())))
|
|
|
|
|
|
|
|
|
|
# Once all the dependencies have been processed, it's now safe to write
|
|
|
|
|
# out the gn_args_file and run the hooks.
|
|
|
|
|
if command == 'update':
|
|
|
|
|
gn_args_dep = self.dependencies[0]
|
|
|
|
|
if gn_args_dep._gn_args_from:
|
|
|
|
|
deps_map = dict([(dep.name, dep) for dep in gn_args_dep.dependencies])
|
|
|
|
|
gn_args_dep = deps_map.get(gn_args_dep._gn_args_from)
|
|
|
|
|
if gn_args_dep and gn_args_dep.HasGNArgsFile():
|
|
|
|
|
gn_args_dep.WriteGNArgsFile()
|
|
|
|
|
|
|
|
|
|
self._RemoveUnversionedGitDirs()
|
|
|
|
|
|
|
|
|
|
# Sync CIPD dependencies once removed deps are deleted. In case a git
|
|
|
|
|
# dependency was moved to CIPD, we want to remove the old git directory
|
|
|
|
|
# first and then sync the CIPD dep.
|
|
|
|
|
if self._cipd_root:
|
|
|
|
|
self._cipd_root.run(command)
|
|
|
|
|
|
|
|
|
|
if not self._options.nohooks:
|
|
|
|
|
if should_show_progress:
|
|
|
|
|
pm = Progress('Running hooks', 1)
|
|
|
|
|
self.RunHooksRecursively(self._options, pm)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
def PrintRevInfo(self):
|
|
|
|
|