libv8 7.3.492.27.3beta1 → 7.4.288.28.0beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/lib/libv8/version.rb +1 -1
  4. data/vendor/depot_tools/annotated_gclient.py +4 -2
  5. data/vendor/depot_tools/auth.py +2 -0
  6. data/vendor/depot_tools/autoninja +3 -1
  7. data/vendor/depot_tools/autoninja.bat +1 -1
  8. data/vendor/depot_tools/autoninja.py +3 -1
  9. data/vendor/depot_tools/bb +1 -1
  10. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  11. data/vendor/depot_tools/buildbucket.py +8 -6
  12. data/vendor/depot_tools/checkout.py +7 -5
  13. data/vendor/depot_tools/cipd +1 -1
  14. data/vendor/depot_tools/cipd_manifest.txt +4 -4
  15. data/vendor/depot_tools/cipd_manifest.versions +80 -80
  16. data/vendor/depot_tools/cit.py +9 -7
  17. data/vendor/depot_tools/clang_format.py +4 -1
  18. data/vendor/depot_tools/clang_format_merge_driver.py +9 -7
  19. data/vendor/depot_tools/compile_single_file.py +3 -1
  20. data/vendor/depot_tools/dart_format.py +4 -2
  21. data/vendor/depot_tools/depot-tools-auth.py +10 -8
  22. data/vendor/depot_tools/fix_encoding.py +5 -2
  23. data/vendor/depot_tools/gclient-new-workdir.py +2 -0
  24. data/vendor/depot_tools/gclient.py +8 -9
  25. data/vendor/depot_tools/gclient_scm.py +54 -28
  26. data/vendor/depot_tools/gclient_utils.py +14 -4
  27. data/vendor/depot_tools/gerrit_util.py +8 -6
  28. data/vendor/depot_tools/git_cache.py +53 -37
  29. data/vendor/depot_tools/git_cl.py +115 -42
  30. data/vendor/depot_tools/git_drover.py +3 -1
  31. data/vendor/depot_tools/git_find_releases.py +8 -6
  32. data/vendor/depot_tools/git_footers.py +7 -5
  33. data/vendor/depot_tools/git_freezer.py +3 -1
  34. data/vendor/depot_tools/git_map_branches.py +7 -5
  35. data/vendor/depot_tools/git_mark_merge_base.py +8 -6
  36. data/vendor/depot_tools/git_nav_downstream.py +7 -5
  37. data/vendor/depot_tools/git_number.py +3 -1
  38. data/vendor/depot_tools/git_rebase_update.py +38 -43
  39. data/vendor/depot_tools/git_reparent_branch.py +8 -6
  40. data/vendor/depot_tools/git_upstream_diff.py +4 -2
  41. data/vendor/depot_tools/gn.py +6 -4
  42. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  43. data/vendor/depot_tools/led +1 -1
  44. data/vendor/depot_tools/luci-auth +1 -1
  45. data/vendor/depot_tools/lucicfg +1 -1
  46. data/vendor/depot_tools/mac_toolchain +1 -1
  47. data/vendor/depot_tools/man/html/depot_tools.html +1 -1
  48. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +28 -22
  49. data/vendor/depot_tools/man/html/git-cl.html +1 -1
  50. data/vendor/depot_tools/man/html/git-drover.html +18 -18
  51. data/vendor/depot_tools/man/html/git-footers.html +1 -1
  52. data/vendor/depot_tools/man/html/git-freeze.html +3 -3
  53. data/vendor/depot_tools/man/html/git-hyper-blame.html +1 -1
  54. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  55. data/vendor/depot_tools/man/html/git-map.html +1 -1
  56. data/vendor/depot_tools/man/html/git-mark-merge-base.html +1 -1
  57. data/vendor/depot_tools/man/html/git-nav-downstream.html +3 -3
  58. data/vendor/depot_tools/man/html/git-nav-upstream.html +12 -6
  59. data/vendor/depot_tools/man/html/git-new-branch.html +1 -1
  60. data/vendor/depot_tools/man/html/git-rebase-update.html +20 -1
  61. data/vendor/depot_tools/man/html/git-rename-branch.html +1 -1
  62. data/vendor/depot_tools/man/html/git-reparent-branch.html +1 -1
  63. data/vendor/depot_tools/man/html/git-retry.html +1 -1
  64. data/vendor/depot_tools/man/html/git-squash-branch.html +1 -1
  65. data/vendor/depot_tools/man/html/git-thaw.html +1 -1
  66. data/vendor/depot_tools/man/html/git-upstream-diff.html +10 -6
  67. data/vendor/depot_tools/man/man1/git-cl.1 +4 -4
  68. data/vendor/depot_tools/man/man1/git-drover.1 +21 -21
  69. data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
  70. data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
  71. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  72. data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
  73. data/vendor/depot_tools/man/man1/git-map.1 +4 -4
  74. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  75. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +6 -6
  76. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +15 -9
  77. data/vendor/depot_tools/man/man1/git-new-branch.1 +3 -3
  78. data/vendor/depot_tools/man/man1/git-rebase-update.1 +14 -4
  79. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  80. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  81. data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
  82. data/vendor/depot_tools/man/man1/git-squash-branch.1 +4 -4
  83. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  84. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +7 -13
  85. data/vendor/depot_tools/man/man7/depot_tools.7 +4 -4
  86. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +33 -27
  87. data/vendor/depot_tools/man/src/filter_demo_output.py +3 -1
  88. data/vendor/depot_tools/man/src/git-rebase-update.txt +7 -0
  89. data/vendor/depot_tools/my_activity.py +13 -11
  90. data/vendor/depot_tools/my_reviews.py +34 -29
  91. data/vendor/depot_tools/ninjalog_uploader_wrapper.py +4 -2
  92. data/vendor/depot_tools/owners_finder.py +3 -1
  93. data/vendor/depot_tools/patch.py +1 -1
  94. data/vendor/depot_tools/post_build_ninja_summary.py +17 -15
  95. data/vendor/depot_tools/presubmit_canned_checks.py +3 -1
  96. data/vendor/depot_tools/presubmit_support.py +10 -5
  97. data/vendor/depot_tools/prpc +1 -1
  98. data/vendor/depot_tools/recipes/README.recipes.md +17 -17
  99. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +1 -6
  100. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +2 -4
  101. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +1 -6
  102. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +0 -5
  103. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +2 -4
  104. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +25 -5
  105. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +23 -5
  106. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +23 -5
  107. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +0 -6
  108. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +0 -1
  109. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +1 -5
  110. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +1 -6
  111. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +0 -5
  112. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +1 -6
  113. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +1 -3
  114. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +4 -6
  115. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +4 -6
  116. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +4 -6
  117. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +4 -6
  118. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +4 -6
  119. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +4 -6
  120. data/vendor/depot_tools/rietveld.py +3 -1
  121. data/vendor/depot_tools/roll_dep.py +2 -0
  122. data/vendor/depot_tools/roll_dep_svn.py +14 -11
  123. data/vendor/depot_tools/scm.py +10 -5
  124. data/vendor/depot_tools/split_cl.py +13 -11
  125. data/vendor/depot_tools/subprocess2.py +1 -1
  126. data/vendor/depot_tools/third_party/colorama/LICENSE.txt +0 -1
  127. data/vendor/depot_tools/third_party/colorama/README.chromium +4 -5
  128. data/vendor/depot_tools/third_party/colorama/README.rst +346 -0
  129. data/vendor/depot_tools/third_party/colorama/__init__.py +3 -4
  130. data/vendor/depot_tools/third_party/colorama/ansi.py +82 -30
  131. data/vendor/depot_tools/third_party/colorama/ansitowin32.py +105 -37
  132. data/vendor/depot_tools/third_party/colorama/initialise.py +39 -15
  133. data/vendor/depot_tools/third_party/colorama/win32.py +46 -28
  134. data/vendor/depot_tools/third_party/colorama/winterm.py +80 -31
  135. data/vendor/depot_tools/third_party/upload.py +1 -1
  136. data/vendor/depot_tools/upload_to_google_storage.py +8 -6
  137. data/vendor/depot_tools/vpython +1 -1
  138. data/vendor/depot_tools/watchlists.py +5 -3
  139. data/vendor/depot_tools/weekly +4 -2
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +38 -36
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +10 -8
  142. data/vendor/depot_tools/wtf +5 -3
  143. metadata +3 -3
  144. data/vendor/depot_tools/third_party/colorama/README.txt +0 -304
@@ -14,6 +14,8 @@ This tool does a two things:
14
14
 
15
15
  # TODO(hinoka,iannucci): Pre-pack infra tools in cipd package with vpython spec.
16
16
 
17
+ from __future__ import print_function
18
+
17
19
  import argparse
18
20
  import sys
19
21
  import os
@@ -102,20 +104,20 @@ def get_available_tools():
102
104
 
103
105
  def usage():
104
106
  infra_tools, cipd_tools = get_available_tools()
105
- print """usage: cit.py <name of tool> [args for tool]
107
+ print("""usage: cit.py <name of tool> [args for tool]
106
108
 
107
109
  Wrapper for maintaining and calling tools in:
108
110
  "infra.git/run.py infra.tools.*"
109
111
  "infra.git/cipd/*"
110
112
 
111
- Available infra tools are:"""
113
+ Available infra tools are:""")
112
114
  for tool in infra_tools:
113
- print ' * %s' % tool
115
+ print(' * %s' % tool)
114
116
 
115
- print """
116
- Available cipd tools are:"""
117
+ print("""
118
+ Available cipd tools are:""")
117
119
  for tool in cipd_tools:
118
- print ' * %s' % tool
120
+ print(' * %s' % tool)
119
121
 
120
122
 
121
123
  def run(args):
@@ -137,7 +139,7 @@ def run(args):
137
139
  elif os.path.isfile(cipd_file) and is_exe(cipd_file):
138
140
  cmd = [cipd_file]
139
141
  else:
140
- print >>sys.stderr, 'Unknown tool "%s"' % tool_name
142
+ print('Unknown tool "%s"' % tool_name, file=sys.stderr)
141
143
  return usage()
142
144
 
143
145
  # Add the remaining arguments.
@@ -9,6 +9,8 @@ clang-format binaries are pulled down from Google Cloud Storage whenever you
9
9
  sync Chrome, to platform-specific locations. This script knows how to locate
10
10
  those tools, assuming the script is invoked from inside a Chromium checkout."""
11
11
 
12
+ from __future__ import print_function
13
+
12
14
  import gclient_paths
13
15
  import os
14
16
  import subprocess
@@ -63,7 +65,8 @@ def main(args):
63
65
  # redirection can be a little opaque.
64
66
  help_syntax = ('-h', '--help', '-help', '-help-list', '--help-list')
65
67
  if any(match in args for match in help_syntax):
66
- print '\nDepot tools redirects you to the clang-format at:\n %s\n' % tool
68
+ print(
69
+ '\nDepot tools redirects you to the clang-format at:\n %s\n' % tool)
67
70
 
68
71
  return subprocess.call([tool] + args)
69
72
 
@@ -14,6 +14,8 @@ See https://git-scm.com/docs/gitattributes ("Defining a custom merge
14
14
  driver") for more details.
15
15
  """
16
16
 
17
+ from __future__ import print_function
18
+
17
19
  import subprocess
18
20
  import sys
19
21
 
@@ -29,14 +31,14 @@ def main():
29
31
  base, current, others, file_name_in_tree = sys.argv[1:5]
30
32
 
31
33
  if file_name_in_tree == '%P':
32
- print >>sys.stderr
33
- print >>sys.stderr, 'ERROR: clang-format merge driver needs git 2.5+'
34
+ print(file=sys.stderr)
35
+ print('ERROR: clang-format merge driver needs git 2.5+', file=sys.stderr)
34
36
  if sys.platform == 'darwin':
35
- print >>sys.stderr, 'Upgrade to Xcode 7.2+'
36
- print >>sys.stderr
37
+ print('Upgrade to Xcode 7.2+', file=sys.stderr)
38
+ print(file=sys.stderr)
37
39
  return 1
38
40
 
39
- print 'Running clang-format 3-way merge driver on ' + file_name_in_tree
41
+ print('Running clang-format 3-way merge driver on ' + file_name_in_tree)
40
42
 
41
43
  try:
42
44
  tool = clang_format.FindClangFormatToolInChromiumTree()
@@ -56,8 +58,8 @@ def main():
56
58
  with open(fpath, 'wb') as output_file:
57
59
  output_file.write(output)
58
60
  except clang_format.NotFoundError, e:
59
- print e
60
- print 'Failed to find clang-format. Falling-back on standard 3-way merge'
61
+ print(e)
62
+ print('Failed to find clang-format. Falling-back on standard 3-way merge')
61
63
 
62
64
  return subprocess.call(['git', 'merge-file', '-Lcurrent', '-Lbase', '-Lother',
63
65
  current, base, others])
@@ -3,6 +3,8 @@
3
3
  # Use of this source code is governed by a BSD-style license that can be
4
4
  # found in the LICENSE file.
5
5
 
6
+ from __future__ import print_function
7
+
6
8
  import argparse
7
9
  import os
8
10
  import subprocess
@@ -47,7 +49,7 @@ def main():
47
49
  abs_build_dir = os.path.join(src_dir, options.build_dir)
48
50
  src_relpath = os.path.relpath(options.file_path, abs_build_dir)
49
51
 
50
- print 'Building %s' % options.file_path
52
+ print('Building %s' % options.file_path)
51
53
 
52
54
  ninja_exec = 'ninja'
53
55
  carets = '^'
@@ -10,6 +10,8 @@ dartfmt binaries are pulled down during gclient sync in the mojo repo.
10
10
  This tool is named dart_format.py instead of dartfmt to parallel
11
11
  clang_format.py, which is in this same repository."""
12
12
 
13
+ from __future__ import print_function
14
+
13
15
  import os
14
16
  import subprocess
15
17
  import sys
@@ -42,14 +44,14 @@ def main(args):
42
44
  try:
43
45
  tool = FindDartFmtToolInChromiumTree()
44
46
  except NotFoundError, e:
45
- print >> sys.stderr, e
47
+ print(e, file=sys.stderr)
46
48
  sys.exit(1)
47
49
 
48
50
  # Add some visibility to --help showing where the tool lives, since this
49
51
  # redirection can be a little opaque.
50
52
  help_syntax = ('-h', '--help', '-help', '-help-list', '--help-list')
51
53
  if any(match in args for match in help_syntax):
52
- print '\nDepot tools redirects you to the dartfmt at:\n %s\n' % tool
54
+ print('\nDepot tools redirects you to the dartfmt at:\n %s\n' % tool)
53
55
 
54
56
  return subprocess.call([tool] + sys.argv[1:])
55
57
 
@@ -11,6 +11,8 @@ Usage:
11
11
  depot-tools-auth logout codereview.chromium.org
12
12
  """
13
13
 
14
+ from __future__ import print_function
15
+
14
16
  import logging
15
17
  import optparse
16
18
  import sys
@@ -39,7 +41,7 @@ def CMDlogout(parser, args):
39
41
  """Revokes cached authentication token and removes it from disk."""
40
42
  _, authenticator = parser.parse_args(args)
41
43
  done = authenticator.logout()
42
- print 'Done.' if done else 'Already logged out.'
44
+ print('Done.' if done else 'Already logged out.')
43
45
  return 0
44
46
 
45
47
 
@@ -54,12 +56,12 @@ def CMDinfo(parser, args):
54
56
 
55
57
  def print_token_info(hostname, authenticator):
56
58
  token_info = authenticator.get_token_info()
57
- print 'Logged in to %s as %s.' % (hostname, token_info['email'])
58
- print ''
59
- print 'To login with a different email run:'
60
- print ' depot-tools-auth login %s' % hostname
61
- print 'To logout and purge the authentication token run:'
62
- print ' depot-tools-auth logout %s' % hostname
59
+ print('Logged in to %s as %s.' % (hostname, token_info['email']))
60
+ print('')
61
+ print('To login with a different email run:')
62
+ print(' depot-tools-auth login %s' % hostname)
63
+ print('To logout and purge the authentication token run:')
64
+ print(' depot-tools-auth logout %s' % hostname)
63
65
 
64
66
 
65
67
  class OptionParser(optparse.OptionParser):
@@ -89,7 +91,7 @@ def main(argv):
89
91
  try:
90
92
  return dispatcher.execute(OptionParser(), argv)
91
93
  except auth.AuthenticationError as e:
92
- print >> sys.stderr, e
94
+ print(e, file=sys.stderr)
93
95
  return 1
94
96
 
95
97
 
@@ -6,6 +6,8 @@
6
6
  multiple platforms with python.
7
7
  """
8
8
 
9
+ from __future__ import print_function
10
+
9
11
  import codecs
10
12
  import locale
11
13
  import os
@@ -22,8 +24,9 @@ def complain(message):
22
24
  to our wrapper. So be paranoid about catching errors and reporting them
23
25
  to sys.__stderr__, so that the user has a higher chance to see them.
24
26
  """
25
- print >> sys.__stderr__, (
26
- isinstance(message, str) and message or repr(message))
27
+ print(
28
+ isinstance(message, str) and message or repr(message),
29
+ file=sys.__stderr__)
27
30
 
28
31
 
29
32
  def fix_default_encoding():
@@ -7,6 +7,8 @@
7
7
  # gclient-new-workdir.py [options] <repository> <new_workdir>
8
8
  #
9
9
 
10
+ from __future__ import print_function
11
+
10
12
  import argparse
11
13
  import os
12
14
  import shutil
@@ -1650,12 +1650,11 @@ it or fix the checkout.
1650
1650
  # clean checkout.
1651
1651
  gclient_scm.scm.GIT.CleanupDir(par_scm_root, rel_e_dir)
1652
1652
  assert not os.path.exists(os.path.join(e_dir, '.git'))
1653
- print(('\nWARNING: \'%s\' has been moved from DEPS to a higher '
1654
- 'level checkout. The git folder containing all the local'
1655
- ' branches has been saved to %s.\n'
1656
- 'If you don\'t care about its state you can safely '
1657
- 'remove that folder to free up space.') %
1658
- (entry, save_dir))
1653
+ print('\nWARNING: \'%s\' has been moved from DEPS to a higher '
1654
+ 'level checkout. The git folder containing all the local'
1655
+ ' branches has been saved to %s.\n'
1656
+ 'If you don\'t care about its state you can safely '
1657
+ 'remove that folder to free up space.' % (entry, save_dir))
1659
1658
  continue
1660
1659
 
1661
1660
  if scm_root in full_entries:
@@ -1684,9 +1683,9 @@ it or fix the checkout.
1684
1683
  should_recurse=False,
1685
1684
  relative=None,
1686
1685
  condition=None))
1687
- print(('\nWARNING: \'%s\' is no longer part of this client.\n'
1688
- 'It is recommended that you manually remove it or use '
1689
- '\'gclient sync -D\' next time.') % entry_fixed)
1686
+ print('\nWARNING: \'%s\' is no longer part of this client.\n'
1687
+ 'It is recommended that you manually remove it or use '
1688
+ '\'gclient sync -D\' next time.' % entry_fixed)
1690
1689
  else:
1691
1690
  # Delete the entry
1692
1691
  print('\n________ deleting \'%s\' in \'%s\'' % (
@@ -256,9 +256,10 @@ class GitWrapper(SCMWrapper):
256
256
  def _GetDiffFilenames(self, base):
257
257
  """Returns the names of files modified since base."""
258
258
  return self._Capture(
259
- # Filter to remove base if it is None.
260
- filter(bool, ['-c', 'core.quotePath=false', 'diff', '--name-only', base])
261
- ).split()
259
+ # Filter to remove base if it is None.
260
+ list(filter(bool, ['-c', 'core.quotePath=false', 'diff', '--name-only',
261
+ base])
262
+ )).split()
262
263
 
263
264
  def diff(self, options, _args, _file_list):
264
265
  _, revision = gclient_utils.SplitUrlRevision(self.url)
@@ -372,25 +373,25 @@ class GitWrapper(SCMWrapper):
372
373
  'Candidate refs were %s.' % (commit, remote_refs))
373
374
  return None
374
375
 
375
- def apply_patch_ref(self, patch_repo, patch_ref, target_branch, options,
376
+ def apply_patch_ref(self, patch_repo, patch_ref, target_ref, options,
376
377
  file_list):
377
378
  """Apply a patch on top of the revision we're synced at.
378
379
 
379
380
  The patch ref is given by |patch_repo|@|patch_ref|, and the current revision
380
381
  is |base_rev|.
381
- We also need the |target_branch| that the patch was uploaded against. We use
382
+ We also need the |target_ref| that the patch was uploaded against. We use
382
383
  it to find a merge base between |patch_rev| and |base_rev|, so we can find
383
384
  what commits constitute the patch:
384
385
 
385
386
  Graphically, it looks like this:
386
387
 
387
- ... -> merge_base -> [possibly already landed commits] -> target_branch
388
+ ... -> merge_base -> [possibly already landed commits] -> target_ref
388
389
  \
389
390
  -> [possibly not yet landed dependent CLs] -> patch_rev
390
391
 
391
392
  Next, we apply the commits |merge_base..patch_rev| on top of whatever is
392
393
  currently checked out, denoted |base_rev|. Typically, it'd be a revision
393
- from |target_branch|, but this is not required.
394
+ from |target_ref|, but this is not required.
394
395
 
395
396
  Graphically, we cherry pick |merge_base..patch_rev| on top of |base_rev|:
396
397
 
@@ -402,7 +403,7 @@ class GitWrapper(SCMWrapper):
402
403
  Args:
403
404
  patch_repo: The patch origin. e.g. 'https://foo.googlesource.com/bar'
404
405
  patch_ref: The ref to the patch. e.g. 'refs/changes/1234/34/1'.
405
- target_branch: The branch the patch was uploaded against.
406
+ target_ref: The ref the patch was uploaded against.
406
407
  e.g. 'refs/heads/master' or 'refs/heads/infra/config'.
407
408
  options: The options passed to gclient.
408
409
  file_list: A list where modified files will be appended.
@@ -416,25 +417,49 @@ class GitWrapper(SCMWrapper):
416
417
 
417
418
  base_rev = self._Capture(['rev-parse', 'HEAD'])
418
419
 
419
- if target_branch:
420
- # Convert the target branch to a remote ref if possible.
421
- remote_ref = scm.GIT.RefToRemoteRef(target_branch, self.remote)
422
- if remote_ref:
423
- target_branch = ''.join(remote_ref)
420
+ if not target_ref:
421
+ target_ref = self._GetTargetBranchForCommit(base_rev) or base_rev
422
+ elif not target_ref.startswith(('refs/heads/', 'refs/branch-heads/')):
423
+ # TODO(ehmaldonado): Support all refs.
424
+ raise gclient_utils.Error(
425
+ 'target_ref must be in refs/heads/** or refs/branch-heads/**. '
426
+ 'Got %s instead.' % target_ref)
427
+ elif target_ref == 'refs/heads/master':
428
+ # We handle refs/heads/master separately because bot_update treats it
429
+ # differently than other refs: it will fetch refs/heads/foo to
430
+ # refs/heads/foo, but refs/heads/master to refs/remotes/origin/master.
431
+ # It's not strictly necessary, but it simplifies the rest of the code.
432
+ target_ref = 'refs/remotes/%s/master' % self.remote
433
+ elif scm.GIT.IsValidRevision(self.checkout_path, target_ref):
434
+ # The target ref for the change is already available, so we don't need to
435
+ # do anything.
436
+ # This is a common case. When applying a patch to a top-level solution,
437
+ # bot_update will fetch the target ref for the change and sync the
438
+ # solution to it.
439
+ pass
424
440
  else:
425
- target_branch = self._GetTargetBranchForCommit(base_rev)
426
-
427
- # Fallback to the commit we got.
428
- # This means that apply_path_ref will try to find the merge-base between the
429
- # patch and the commit (which is most likely the commit) and cherry-pick
430
- # everything in between.
431
- if not target_branch:
432
- target_branch = base_rev
441
+ # The target ref is not available. We check next for a remote version of
442
+ # it (e.g. refs/remotes/origin/<branch>) and fetch it if it's not
443
+ # available.
444
+ self.Print('%s is not an existing ref.' % target_ref)
445
+ original_target_ref = target_ref
446
+ target_ref = ''.join(scm.GIT.RefToRemoteRef(target_ref, self.remote))
447
+ self.Print('Trying with %s' % target_ref)
448
+ if not scm.GIT.IsValidRevision(self.checkout_path, target_ref):
449
+ self.Print(
450
+ '%s is not an existing ref either. Will proceed to fetch it.'
451
+ % target_ref)
452
+ url, _ = gclient_utils.SplitUrlRevision(self.url)
453
+ mirror = self._GetMirror(url, options, target_ref)
454
+ if mirror:
455
+ self._UpdateMirrorIfNotContains(
456
+ mirror, options, 'branch', target_ref, original_target_ref)
457
+ self._Fetch(options, refspec=target_ref)
433
458
 
434
459
  self.Print('===Applying patch ref===')
435
460
  self.Print('Patch ref is %r @ %r. Target branch for patch is %r. '
436
461
  'Current HEAD is %r. Current dir is %r' % (
437
- patch_repo, patch_ref, target_branch, base_rev,
462
+ patch_repo, patch_ref, target_ref, base_rev,
438
463
  self.checkout_path))
439
464
  self._Capture(['reset', '--hard'])
440
465
  self._Capture(['fetch', patch_repo, patch_ref])
@@ -446,9 +471,9 @@ class GitWrapper(SCMWrapper):
446
471
  else:
447
472
  # Find the merge-base between the branch_rev and patch_rev to find out
448
473
  # the changes we need to cherry-pick on top of base_rev.
449
- merge_base = self._Capture(['merge-base', target_branch, patch_rev])
474
+ merge_base = self._Capture(['merge-base', target_ref, patch_rev])
450
475
  self.Print('Merge base of %s and %s is %s' % (
451
- target_branch, patch_rev, merge_base))
476
+ target_ref, patch_rev, merge_base))
452
477
  if merge_base == patch_rev:
453
478
  # If the merge-base is patch_rev, it means patch_rev is already part
454
479
  # of the history, so just check it out.
@@ -467,9 +492,9 @@ class GitWrapper(SCMWrapper):
467
492
 
468
493
  except subprocess2.CalledProcessError as e:
469
494
  self.Print('Failed to apply patch.')
470
- self.Print('Patch ref is %r @ %r. Target branch for patch is %r. '
495
+ self.Print('Patch ref is %r @ %r. Target ref for patch is %r. '
471
496
  'Current HEAD is %r. Current dir is %r' % (
472
- patch_repo, patch_ref, target_branch, base_rev,
497
+ patch_repo, patch_ref, target_ref, base_rev,
473
498
  self.checkout_path))
474
499
  self.Print('git returned non-zero exit status %s:\n%s' % (
475
500
  e.returncode, e.stderr))
@@ -606,7 +631,7 @@ class GitWrapper(SCMWrapper):
606
631
  # Skip url auto-correction if remote.origin.gclient-auto-fix-url is set.
607
632
  # This allows devs to use experimental repos which have a different url
608
633
  # but whose branch(s) are the same as official repos.
609
- if (current_url.rstrip(b'/') != url.rstrip('/') and url != 'git://foo' and
634
+ if (current_url.rstrip('/') != url.rstrip('/') and url != 'git://foo' and
610
635
  subprocess2.capture(
611
636
  ['git', 'config', 'remote.%s.gclient-auto-fix-url' % self.remote],
612
637
  cwd=self.checkout_path).strip() != 'False'):
@@ -1282,7 +1307,8 @@ class GitWrapper(SCMWrapper):
1282
1307
  kwargs.setdefault('stderr', subprocess2.PIPE)
1283
1308
  strip = kwargs.pop('strip', True)
1284
1309
  env = scm.GIT.ApplyEnvVars(kwargs)
1285
- ret = subprocess2.check_output(['git'] + args, env=env, **kwargs)
1310
+ ret = subprocess2.check_output(
1311
+ ['git'] + args, env=env, **kwargs).decode('utf-8')
1286
1312
  if strip:
1287
1313
  ret = ret.strip()
1288
1314
  return ret
@@ -433,10 +433,20 @@ class Annotated(Wrapper):
433
433
 
434
434
  # Continue lockless.
435
435
  obj[0] += out
436
- while '\n' in obj[0]:
437
- line, remaining = obj[0].split('\n', 1)
438
- if line:
439
- self._wrapped.write('%d>%s\n' % (index, line))
436
+ while True:
437
+ # TODO(agable): find both of these with a single pass.
438
+ cr_loc = obj[0].find('\r')
439
+ lf_loc = obj[0].find('\n')
440
+ if cr_loc == lf_loc == -1:
441
+ break
442
+ elif cr_loc == -1 or (lf_loc >= 0 and lf_loc < cr_loc):
443
+ line, remaining = obj[0].split('\n', 1)
444
+ if line:
445
+ self._wrapped.write('%d>%s\n' % (index, line))
446
+ elif lf_loc == -1 or (cr_loc >= 0 and cr_loc < lf_loc):
447
+ line, remaining = obj[0].split('\r', 1)
448
+ if line:
449
+ self._wrapped.write('%d>%s\r' % (index, line))
440
450
  obj[0] = remaining
441
451
 
442
452
  def flush(self):
@@ -8,6 +8,8 @@ Utilities for requesting information for a gerrit server via https.
8
8
  https://gerrit-review.googlesource.com/Documentation/rest-api.html
9
9
  """
10
10
 
11
+ from __future__ import print_function
12
+
11
13
  import base64
12
14
  import contextlib
13
15
  import cookielib
@@ -166,10 +168,10 @@ class CookiesAuthenticator(Authenticator):
166
168
 
167
169
  st = os.stat(path)
168
170
  if st.st_mode & (stat.S_IRWXG | stat.S_IRWXO):
169
- print >> sys.stderr, (
171
+ print(
170
172
  'WARNING: netrc file %s cannot be used because its file '
171
173
  'permissions are insecure. netrc file permissions should be '
172
- '600.' % path)
174
+ '600.' % path, file=sys.stderr)
173
175
  with open(path) as fd:
174
176
  content = fd.read()
175
177
 
@@ -189,11 +191,11 @@ class CookiesAuthenticator(Authenticator):
189
191
  try:
190
192
  return netrc.netrc(path)
191
193
  except IOError:
192
- print >> sys.stderr, 'WARNING: Could not read netrc file %s' % path
194
+ print('WARNING: Could not read netrc file %s' % path, file=sys.stderr)
193
195
  return netrc.netrc(os.devnull)
194
196
  except netrc.NetrcParseError as e:
195
- print >> sys.stderr, ('ERROR: Cannot use netrc file %s due to a '
196
- 'parsing error: %s' % (path, e))
197
+ print('ERROR: Cannot use netrc file %s due to a parsing error: %s' %
198
+ (path, e), file=sys.stderr)
197
199
  return netrc.netrc(os.devnull)
198
200
 
199
201
  @classmethod
@@ -786,7 +788,7 @@ def AddReviewers(host, change, reviewers=None, ccs=None, notify=True,
786
788
  'reviewer': r,
787
789
  'state': state,
788
790
  'notify': 'NONE', # We handled `notify` argument above.
789
- })
791
+ })
790
792
 
791
793
  conn = CreateHttpConn(host, path, reqtype='POST', body=body)
792
794
  # Gerrit will return 400 if one or more of the requested reviewers are