Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: recipe_modules/gclient/api.py

Issue 2286793003: Remove all references to GIT_MODE from depot_tools (Closed)
Patch Set: Slightly cleaner Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « recipe_modules/bot_update/test_api.py ('k') | recipe_modules/gclient/config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: recipe_modules/gclient/api.py
diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py
index 7462e22c650c02fe69aec0978157f31b24ded516..9182d6a1fb90ec514610bd572d371c16a37eb163 100644
--- a/recipe_modules/gclient/api.py
+++ b/recipe_modules/gclient/api.py
@@ -151,40 +151,30 @@ class GclientApi(recipe_api.RecipeApi):
test_data_paths = set(cfg.got_revision_mapping.keys() +
[s.name for s in cfg.solutions])
step_test_data = lambda: (
- self.test_api.output_json(test_data_paths, cfg.GIT_MODE))
+ self.test_api.output_json(test_data_paths))
try:
- if not cfg.GIT_MODE: # pragma: no cover
- args = ['sync', '--nohooks', '--force', '--verbose']
- if cfg.delete_unversioned_trees:
- args.append('--delete_unversioned_trees')
- if with_branch_heads:
- args.append('--with_branch_heads')
- self('sync', args + revisions + ['--output-json', self.m.json.output()],
- step_test_data=step_test_data,
- **kwargs)
- else:
- # clean() isn't used because the gclient sync flags passed in checkout()
- # do much the same thing, and they're more correct than doing a separate
- # 'gclient revert' because it makes sure the other args are correct when
- # a repo was deleted and needs to be re-cloned (notably
- # --with_branch_heads), whereas 'revert' uses default args for clone
- # operations.
- #
- # TODO(mmoss): To be like current official builders, this step could
- # just delete the whole <slave_name>/build/ directory and start each
- # build from scratch. That might be the least bad solution, at least
- # until we have a reliable gclient method to produce a pristine working
- # dir for git-based builds (e.g. maybe some combination of 'git
- # reset/clean -fx' and removing the 'out' directory).
- j = '-j2' if self.m.platform.is_win else '-j8'
- args = ['sync', '--verbose', '--with_branch_heads', '--nohooks', j,
- '--reset', '--force', '--upstream', '--no-nag-max']
- if cfg.delete_unversioned_trees:
- args.append('--delete_unversioned_trees')
- self('sync', args + revisions +
- ['--output-json', self.m.json.output()],
- step_test_data=step_test_data,
- **kwargs)
+ # clean() isn't used because the gclient sync flags passed in checkout()
+ # do much the same thing, and they're more correct than doing a separate
+ # 'gclient revert' because it makes sure the other args are correct when
+ # a repo was deleted and needs to be re-cloned (notably
+ # --with_branch_heads), whereas 'revert' uses default args for clone
+ # operations.
+ #
+ # TODO(mmoss): To be like current official builders, this step could
+ # just delete the whole <slave_name>/build/ directory and start each
+ # build from scratch. That might be the least bad solution, at least
+ # until we have a reliable gclient method to produce a pristine working
+ # dir for git-based builds (e.g. maybe some combination of 'git
+ # reset/clean -fx' and removing the 'out' directory).
+ j = '-j2' if self.m.platform.is_win else '-j8'
+ args = ['sync', '--verbose', '--with_branch_heads', '--nohooks', j,
+ '--reset', '--force', '--upstream', '--no-nag-max']
+ if cfg.delete_unversioned_trees:
+ args.append('--delete_unversioned_trees')
+ self('sync', args + revisions +
+ ['--output-json', self.m.json.output()],
+ step_test_data=step_test_data,
+ **kwargs)
finally:
result = self.m.step.active_result
data = result.json.output
@@ -239,25 +229,16 @@ class GclientApi(recipe_api.RecipeApi):
sync_step = None
try:
- if not cfg.GIT_MODE: # pragma: no cover
- try:
- if revert:
- self.revert(**kwargs)
- finally:
- sync_step = self.sync(cfg, with_branch_heads=with_branch_heads,
- **kwargs)
- else:
- sync_step = self.sync(cfg, with_branch_heads=with_branch_heads,
- **kwargs)
-
- cfg_cmds = [
- ('user.name', 'local_bot'),
- ('user.email', 'local_bot@example.com'),
- ]
- for var, val in cfg_cmds:
- name = 'recurse (git config %s)' % var
- self(name, ['recurse', 'git', 'config', var, val], **kwargs)
-
+ sync_step = self.sync(cfg, with_branch_heads=with_branch_heads,
+ **kwargs)
+
+ cfg_cmds = [
+ ('user.name', 'local_bot'),
+ ('user.email', 'local_bot@example.com'),
+ ]
+ for var, val in cfg_cmds:
+ name = 'recurse (git config %s)' % var
+ self(name, ['recurse', 'git', 'config', var, val], **kwargs)
finally:
cwd = kwargs.get('cwd', self.m.path['slave_build'])
if 'checkout' not in self.m.path:
« no previous file with comments | « recipe_modules/bot_update/test_api.py ('k') | recipe_modules/gclient/config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698