浏览代码

gclient: deprecated use_relative_hooks

And merge it in use_relative_paths. In all Chromium repos,
use_relative_hooks is True iff:

 - use_relative_paths is True, and
 - there is at least one hook

It makes sense that you'd want to use relative hooks if you use relative
paths so this CL merges both flags into use_relative_paths.

Bug: chromium:1107325
Change-Id: I0fe40eba1e1c61be26c812c7ca4329efb72c7f90
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2306795
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Corentin Wallez 5 年之前
父节点
当前提交
801c20219b
共有 3 个文件被更改,包括 8 次插入11 次删除
  1. 5 6
      gclient.py
  2. 2 3
      testing_support/fake_repos.py
  3. 1 2
      tests/gclient_test.py

+ 5 - 6
gclient.py

@@ -793,13 +793,12 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
         self._postprocess_deps(deps, rel_prefix), self._use_relative_paths)
         self._postprocess_deps(deps, rel_prefix), self._use_relative_paths)
 
 
     # compute which working directory should be used for hooks
     # compute which working directory should be used for hooks
-    use_relative_hooks = local_scope.get('use_relative_hooks', False)
+    if local_scope.get('use_relative_hooks', False):
+      print('use_relative_hooks is deprecated, please remove it from DEPS. ' +
+            '(it was merged in use_relative_paths)')
+
     hooks_cwd = self.root.root_dir
     hooks_cwd = self.root.root_dir
-    if use_relative_hooks:
-      if not self._use_relative_paths:
-        raise gclient_utils.Error(
-            'ParseDepsFile(%s): use_relative_hooks must be used with '
-            'use_relative_paths' % self.name)
+    if self._use_relative_paths:
       hooks_cwd = os.path.join(hooks_cwd, self.name)
       hooks_cwd = os.path.join(hooks_cwd, self.name)
       logging.warning('Updating hook base working directory to %s.',
       logging.warning('Updating hook base working directory to %s.',
                       hooks_cwd)
                       hooks_cwd)

+ 2 - 3
testing_support/fake_repos.py

@@ -688,7 +688,7 @@ hooks = [{
       'origin': 'git/repo_14@2\n'
       'origin': 'git/repo_14@2\n'
     })
     })
 
 
-    # A repo with a hook to be recursed in, without use_relative_hooks
+    # A repo with a hook to be recursed in, without use_relative_paths
     self._commit_git('repo_15', {
     self._commit_git('repo_15', {
       'DEPS': textwrap.dedent("""\
       'DEPS': textwrap.dedent("""\
         hooks = [{
         hooks = [{
@@ -698,11 +698,10 @@ hooks = [{
         }]"""),
         }]"""),
       'origin': 'git/repo_15@2\n'
       'origin': 'git/repo_15@2\n'
     })
     })
-    # A repo with a hook to be recursed in, with use_relative_hooks
+    # A repo with a hook to be recursed in, with use_relative_paths
     self._commit_git('repo_16', {
     self._commit_git('repo_16', {
       'DEPS': textwrap.dedent("""\
       'DEPS': textwrap.dedent("""\
         use_relative_paths=True
         use_relative_paths=True
-        use_relative_hooks=True
         hooks = [{
         hooks = [{
           "name": "relative_cwd",
           "name": "relative_cwd",
           "pattern": ".",
           "pattern": ".",

+ 1 - 2
tests/gclient_test.py

@@ -389,7 +389,7 @@ class GclientTest(trial_dir.TestCase):
 
 
   def testRecurseDepsAndHooksCwd(self):
   def testRecurseDepsAndHooksCwd(self):
     """Verifies that hooks run in the correct directory with our without
     """Verifies that hooks run in the correct directory with our without
-    use_relative_hooks"""
+    use_relative_paths"""
     write(
     write(
         '.gclient',
         '.gclient',
         'solutions = [\n'
         'solutions = [\n'
@@ -417,7 +417,6 @@ class GclientTest(trial_dir.TestCase):
     write(
     write(
         os.path.join('foo', 'baz', 'DEPS'),
         os.path.join('foo', 'baz', 'DEPS'),
         'use_relative_paths=True\n'
         'use_relative_paths=True\n'
-        'use_relative_hooks=True\n'
         'hooks = [{\n'
         'hooks = [{\n'
         '  "name": "lazors",\n'
         '  "name": "lazors",\n'
         '  "pattern": ".",\n'
         '  "pattern": ".",\n'