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
@@ -309,6 +309,23 @@ class Mirror(object):
309
309
  '$GIT_CACHE_PATH is set.')
310
310
  return ret
311
311
 
312
+ @staticmethod
313
+ def _GetMostRecentCacheDirectory(ls_out_set):
314
+ ready_file_pattern = re.compile(r'.*/(\d+).ready$')
315
+ ready_dirs = []
316
+
317
+ for name in ls_out_set:
318
+ m = ready_file_pattern.match(name)
319
+ # Given <path>/<number>.ready,
320
+ # we are interested in <path>/<number> directory
321
+ if m and (name[:-len('.ready')] + '/') in ls_out_set:
322
+ ready_dirs.append((int(m.group(1)), name[:-len('.ready')]))
323
+
324
+ if not ready_dirs:
325
+ return None
326
+
327
+ return max(ready_dirs)[1]
328
+
312
329
  def Rename(self, src, dst):
313
330
  # This is somehow racy on Windows.
314
331
  # Catching OSError because WindowsError isn't portable and
@@ -384,26 +401,14 @@ class Mirror(object):
384
401
  # The .ready file is only uploaded when an entire directory has been
385
402
  # uploaded to GS.
386
403
  _, ls_out, ls_err = gsutil.check_call('ls', self._gs_path)
404
+ ls_out_set = set(ls_out.strip().splitlines())
405
+ latest_dir = self._GetMostRecentCacheDirectory(ls_out_set)
387
406
 
388
- ready_file_pattern = re.compile(r'.*/(\d+).ready$')
389
-
390
- objects = set(ls_out.strip().splitlines())
391
- ready_dirs = []
392
-
393
- for name in objects:
394
- m = ready_file_pattern.match(name)
395
- # Given <path>/<number>.ready,
396
- # we are interested in <path>/<number> directory
397
-
398
- if m and (name[:-len('.ready')] + '/') in objects:
399
- ready_dirs.append((int(m.group(1)), name[:-len('.ready')]))
400
-
401
- if not ready_dirs:
407
+ if not latest_dir:
402
408
  self.print('No bootstrap file for %s found in %s, stderr:\n %s' %
403
409
  (self.mirror_path, self.bootstrap_bucket,
404
410
  ' '.join((ls_err or '').splitlines(True))))
405
411
  return False
406
- latest_dir = max(ready_dirs)[1]
407
412
 
408
413
  try:
409
414
  # create new temporary directory locally
@@ -573,38 +578,49 @@ class Mirror(object):
573
578
  gsutil = Gsutil(path=self.gsutil_exe, boto_path=None)
574
579
 
575
580
  src_name = self.mirror_path
576
- dest_name = '%s/%s' % (self._gs_path, gen_number)
577
-
578
- # check to see if folder already exists in gs
579
- _, ls_out, ls_err = gsutil.check_call('ls', dest_name)
580
- _, ls_out_ready, ls_err_ready = (
581
- gsutil.check_call('ls', dest_name + '.ready'))
582
-
583
- # only printing out errors because the folder/ready file
584
- # might not exist yet, so it will error no matter what
585
- if ls_err:
586
- print('Failed to check GS:\n%s' % (ls_err))
587
- if ls_err_ready:
588
- print('Failed to check GS:\n%s' % (ls_err_ready))
589
-
590
- if not (ls_out == '' and ls_out_ready == ''):
591
- print('Cache %s already exists' % dest_name)
581
+ dest_prefix = '%s/%s' % (self._gs_path, gen_number)
582
+
583
+ # ls_out lists contents in the format: gs://blah/blah/123...
584
+ _, ls_out, _ = gsutil.check_call('ls', self._gs_path)
585
+
586
+ # Check to see if folder already exists in gs
587
+ ls_out_set = set(ls_out.strip().splitlines())
588
+ if (dest_prefix + '/' in ls_out_set and
589
+ dest_prefix + '.ready' in ls_out_set):
590
+ print('Cache %s already exists.' % dest_prefix)
592
591
  return
593
592
 
594
593
  # Run Garbage Collect to compress packfile.
595
594
  self.RunGit(['gc', '--prune=all'])
596
595
 
597
- gsutil.call('-m', 'cp', '-r', src_name, dest_name)
596
+ gsutil.call('-m', 'cp', '-r', src_name, dest_prefix)
598
597
 
599
- #TODO(karenqian): prune old caches
600
-
601
- # create .ready file and upload
598
+ # Create .ready file and upload
602
599
  _, ready_file_name = tempfile.mkstemp(suffix='.ready')
603
600
  try:
604
- gsutil.call('cp', ready_file_name, '%s.ready' % (dest_name))
601
+ gsutil.call('cp', ready_file_name, '%s.ready' % (dest_prefix))
605
602
  finally:
606
603
  os.remove(ready_file_name)
607
604
 
605
+ # remove all other directory/.ready files in the same gs_path
606
+ # except for the directory/.ready file previously created
607
+ # which can be used for bootstrapping while the current one is
608
+ # being uploaded
609
+ if not prune:
610
+ return
611
+ prev_dest_prefix = self._GetMostRecentCacheDirectory(ls_out_set)
612
+ if not prev_dest_prefix:
613
+ return
614
+ for path in ls_out_set:
615
+ if (path == prev_dest_prefix + '/' or
616
+ path == prev_dest_prefix + '.ready'):
617
+ continue
618
+ if path.endswith('.ready'):
619
+ gsutil.call('rm', path)
620
+ continue
621
+ gsutil.call('-m', 'rm', '-r', path)
622
+
623
+
608
624
  @staticmethod
609
625
  def DeleteTmpPackFiles(path):
610
626
  pack_dir = os.path.join(path, 'objects', 'pack')
@@ -869,4 +885,4 @@ if __name__ == '__main__':
869
885
  sys.exit(main(sys.argv[1:]))
870
886
  except KeyboardInterrupt:
871
887
  sys.stderr.write('interrupted\n')
872
- sys.exit(1)
888
+ sys.exit(1)
@@ -79,12 +79,29 @@ GIT_HASH_RE = re.compile(r'\b([a-f0-9]{6})[a-f0-9]{34}\b', flags=re.I)
79
79
  # Used to redact the cookies from the gitcookies file.
80
80
  GITCOOKIES_REDACT_RE = re.compile(r'1/.*')
81
81
 
82
+ # The maximum number of traces we will keep. Multiplied by 3 since we store
83
+ # 3 files per trace.
84
+ MAX_TRACES = 3 * 10
85
+ # Message to be displayed to the user to inform where to find the traces for a
86
+ # git-cl upload execution.
82
87
  TRACES_MESSAGE = (
83
- 'When filing a bug, be sure to include the traces found at:\n'
84
- ' %s.zip\n'
85
- 'Consider including the git config and gitcookies,\n'
86
- 'which we have packed for you at:\n'
87
- ' %s.zip\n')
88
+ '\n'
89
+ 'The traces of this git-cl execution have been recorded at:\n'
90
+ ' %(trace_name)s-traces.zip\n'
91
+ 'Copies of your gitcookies file and git config have been recorded at:\n'
92
+ ' %(trace_name)s-git-info.zip\n')
93
+ # Format of the message to be stored as part of the traces to give developers a
94
+ # better context when they go through traces.
95
+ TRACES_README_FORMAT = (
96
+ 'Date: %(now)s\n'
97
+ '\n'
98
+ 'Change: https://%(gerrit_host)s/q/%(change_id)s\n'
99
+ 'Title: %(title)s\n'
100
+ '\n'
101
+ '%(description)s\n'
102
+ '\n'
103
+ 'Execution time: %(execution_time)s\n'
104
+ 'Exit code: %(exit_code)s\n') + TRACES_MESSAGE
88
105
 
89
106
  COMMIT_BOT_EMAIL = 'commit-bot@chromium.org'
90
107
  POSTUPSTREAM_HOOK = '.git/hooks/post-cl-land'
@@ -205,6 +222,12 @@ def time_time():
205
222
  return time.time()
206
223
 
207
224
 
225
+ def datetime_now():
226
+ # Use this so that it can be mocked in tests without interfering with python
227
+ # system machinery.
228
+ return datetime.datetime.now()
229
+
230
+
208
231
  def ask_for_data(prompt):
209
232
  try:
210
233
  return raw_input(prompt)
@@ -1998,14 +2021,14 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
1998
2021
  if gerrit_auth == git_auth:
1999
2022
  return
2000
2023
  all_gsrc = cookie_auth.get_auth_header('d0esN0tEx1st.googlesource.com')
2001
- print((
2024
+ print(
2002
2025
  'WARNING: You have different credentials for Gerrit and git hosts:\n'
2003
2026
  ' %s\n'
2004
2027
  ' %s\n'
2005
2028
  ' Consider running the following command:\n'
2006
2029
  ' git cl creds-check\n'
2007
2030
  ' %s\n'
2008
- ' %s') %
2031
+ ' %s' %
2009
2032
  (git_host, self._gerrit_host,
2010
2033
  ('Hint: delete creds for .googlesource.com' if all_gsrc else ''),
2011
2034
  cookie_auth.get_new_password_message(git_host)))
@@ -2496,18 +2519,73 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2496
2519
  else:
2497
2520
  print('OK, will keep Gerrit commit-msg hook in place.')
2498
2521
 
2499
- def _RunGitPushWithTraces(self, change_desc, refspec, refspec_opts):
2522
+ def _CleanUpOldTraces(self):
2523
+ """Keep only the last |MAX_TRACES| traces."""
2524
+ try:
2525
+ traces = sorted([
2526
+ os.path.join(TRACES_DIR, f)
2527
+ for f in os.listdir(TRACES_DIR)
2528
+ if (os.path.isfile(os.path.join(TRACES_DIR, f))
2529
+ and not f.startswith('tmp'))
2530
+ ])
2531
+ traces_to_delete = traces[:-MAX_TRACES]
2532
+ for trace in traces_to_delete:
2533
+ os.remove(trace)
2534
+ except OSError:
2535
+ print('WARNING: Failed to remove old git traces from\n'
2536
+ ' %s'
2537
+ 'Consider removing them manually.' % TRACES_DIR)
2538
+
2539
+ def _WriteGitPushTraces(self, trace_name, traces_dir, git_push_metadata):
2540
+ """Zip and write the git push traces stored in traces_dir."""
2500
2541
  gclient_utils.safe_makedirs(TRACES_DIR)
2542
+ traces_zip = trace_name + '-traces'
2543
+ traces_readme = trace_name + '-README'
2544
+ # Create a temporary dir to store git config and gitcookies in. It will be
2545
+ # compressed and stored next to the traces.
2546
+ git_info_dir = tempfile.mkdtemp()
2547
+ git_info_zip = trace_name + '-git-info'
2548
+
2549
+ git_push_metadata['now'] = datetime_now().strftime('%c')
2550
+ git_push_metadata['trace_name'] = trace_name
2551
+ gclient_utils.FileWrite(
2552
+ traces_readme, TRACES_README_FORMAT % git_push_metadata)
2553
+
2554
+ # Keep only the first 6 characters of the git hashes on the packet
2555
+ # trace. This greatly decreases size after compression.
2556
+ packet_traces = os.path.join(traces_dir, 'trace-packet')
2557
+ if os.path.isfile(packet_traces):
2558
+ contents = gclient_utils.FileRead(packet_traces)
2559
+ gclient_utils.FileWrite(
2560
+ packet_traces, GIT_HASH_RE.sub(r'\1', contents))
2561
+ shutil.make_archive(traces_zip, 'zip', traces_dir)
2562
+
2563
+ # Collect and compress the git config and gitcookies.
2564
+ git_config = RunGit(['config', '-l'])
2565
+ gclient_utils.FileWrite(
2566
+ os.path.join(git_info_dir, 'git-config'),
2567
+ git_config)
2568
+
2569
+ cookie_auth = gerrit_util.Authenticator.get()
2570
+ if isinstance(cookie_auth, gerrit_util.CookiesAuthenticator):
2571
+ gitcookies_path = cookie_auth.get_gitcookies_path()
2572
+ if os.path.isfile(gitcookies_path):
2573
+ gitcookies = gclient_utils.FileRead(gitcookies_path)
2574
+ gclient_utils.FileWrite(
2575
+ os.path.join(git_info_dir, 'gitcookies'),
2576
+ GITCOOKIES_REDACT_RE.sub('REDACTED', gitcookies))
2577
+ shutil.make_archive(git_info_zip, 'zip', git_info_dir)
2578
+
2579
+ gclient_utils.rmtree(git_info_dir)
2501
2580
 
2581
+ def _RunGitPushWithTraces(
2582
+ self, change_desc, refspec, refspec_opts, git_push_metadata):
2583
+ """Run git push and collect the traces resulting from the execution."""
2502
2584
  # Create a temporary directory to store traces in. Traces will be compressed
2503
2585
  # and stored in a 'traces' dir inside depot_tools.
2504
2586
  traces_dir = tempfile.mkdtemp()
2505
- trace_name = os.path.basename(traces_dir)
2506
- traces_zip = os.path.join(TRACES_DIR, trace_name + '-traces')
2507
- # Create a temporary dir to store git config and gitcookies in. It will be
2508
- # compressed and stored next to the traces.
2509
- git_info_dir = tempfile.mkdtemp()
2510
- git_info_zip = os.path.join(TRACES_DIR, trace_name + '-git-info')
2587
+ trace_name = os.path.join(
2588
+ TRACES_DIR, datetime_now().strftime('%Y%m%dT%H%M%S.%f'))
2511
2589
 
2512
2590
  env = os.environ.copy()
2513
2591
  env['GIT_REDACT_COOKIES'] = 'o,SSO,GSSO_Uberproxy'
@@ -2518,9 +2596,10 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2518
2596
 
2519
2597
  try:
2520
2598
  push_returncode = 0
2599
+ remote_url = self.GetRemoteUrl()
2521
2600
  before_push = time_time()
2522
2601
  push_stdout = gclient_utils.CheckCallAndFilter(
2523
- ['git', 'push', self.GetRemoteUrl(), refspec],
2602
+ ['git', 'push', remote_url, refspec],
2524
2603
  env=env,
2525
2604
  print_stdout=True,
2526
2605
  # Flush after every line: useful for seeing progress when running as
@@ -2532,8 +2611,15 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2532
2611
  'for the reason of the failure.\n'
2533
2612
  'Hint: run command below to diagnose common Git/Gerrit '
2534
2613
  'credential problems:\n'
2535
- ' git cl creds-check\n' +
2536
- TRACES_MESSAGE % (traces_zip, git_info_zip),
2614
+ ' git cl creds-check\n'
2615
+ '\n'
2616
+ 'If git-cl is not working correctly, file a bug under the '
2617
+ 'Infra>SDK component including the files below.\n'
2618
+ 'Review the files before upload, since they might contain '
2619
+ 'sensitive information.\n'
2620
+ 'Set the Restrict-View-Google label so that they are not '
2621
+ 'publicly accessible.\n'
2622
+ + TRACES_MESSAGE % {'trace_name': trace_name},
2537
2623
  change_desc)
2538
2624
  finally:
2539
2625
  execution_time = time_time() - before_push
@@ -2544,31 +2630,11 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2544
2630
  'arguments': metrics_utils.extract_known_subcommand_args(refspec_opts),
2545
2631
  })
2546
2632
 
2547
- if push_returncode != 0:
2548
- # Keep only the first 6 characters of the git hashes on the packet
2549
- # trace. This greatly decreases size after compression.
2550
- packet_traces = os.path.join(traces_dir, 'trace-packet')
2551
- contents = gclient_utils.FileRead(packet_traces)
2552
- gclient_utils.FileWrite(
2553
- packet_traces, GIT_HASH_RE.sub(r'\1', contents))
2554
- shutil.make_archive(traces_zip, 'zip', traces_dir)
2633
+ git_push_metadata['execution_time'] = execution_time
2634
+ git_push_metadata['exit_code'] = push_returncode
2635
+ self._WriteGitPushTraces(trace_name, traces_dir, git_push_metadata)
2555
2636
 
2556
- # Collect and compress the git config and gitcookies.
2557
- git_config = RunGit(['config', '-l'])
2558
- gclient_utils.FileWrite(
2559
- os.path.join(git_info_dir, 'git-config'),
2560
- git_config)
2561
-
2562
- cookie_auth = gerrit_util.Authenticator.get()
2563
- if isinstance(cookie_auth, gerrit_util.CookiesAuthenticator):
2564
- gitcookies_path = cookie_auth.get_gitcookies_path()
2565
- gitcookies = gclient_utils.FileRead(gitcookies_path)
2566
- gclient_utils.FileWrite(
2567
- os.path.join(git_info_dir, 'gitcookies'),
2568
- GITCOOKIES_REDACT_RE.sub('REDACTED', gitcookies))
2569
- shutil.make_archive(git_info_zip, 'zip', git_info_dir)
2570
-
2571
- gclient_utils.rmtree(git_info_dir)
2637
+ self._CleanUpOldTraces()
2572
2638
  gclient_utils.rmtree(traces_dir)
2573
2639
 
2574
2640
  return push_stdout
@@ -2822,7 +2888,14 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2822
2888
  'spaces not allowed in refspec: "%s"' % refspec_suffix)
2823
2889
  refspec = '%s:refs/for/%s%s' % (ref_to_push, branch, refspec_suffix)
2824
2890
 
2825
- push_stdout = self._RunGitPushWithTraces(change_desc, refspec, refspec_opts)
2891
+ git_push_metadata = {
2892
+ 'gerrit_host': self._GetGerritHost(),
2893
+ 'title': title or '<untitled>',
2894
+ 'change_id': change_id,
2895
+ 'description': change_desc.description,
2896
+ }
2897
+ push_stdout = self._RunGitPushWithTraces(
2898
+ change_desc, refspec, refspec_opts, git_push_metadata)
2826
2899
 
2827
2900
  if options.squash:
2828
2901
  regex = re.compile(r'remote:\s+https?://[\w\-\.\+\/#]*/(\d+)\s.*')
@@ -4,6 +4,8 @@
4
4
  # found in the LICENSE file.
5
5
  """git drover: A tool for merging changes to release branches."""
6
6
 
7
+ from __future__ import print_function
8
+
7
9
  import argparse
8
10
  import cPickle
9
11
  import functools
@@ -452,7 +454,7 @@ def main():
452
454
  options.parent_checkout, options.dry_run,
453
455
  options.verbose)
454
456
  except Error as e:
455
- print 'Error:', e.message
457
+ print('Error:', e.message)
456
458
  sys.exit(128)
457
459
 
458
460
 
@@ -11,6 +11,8 @@ Note that it uses the "cherry picked from" annotation to find merges, so it will
11
11
  only work on merges that followed the "use cherry-pick -x" instructions.
12
12
  """
13
13
 
14
+ from __future__ import print_function
15
+
14
16
  import optparse
15
17
  import re
16
18
  import sys
@@ -43,16 +45,16 @@ def main():
43
45
  for arg in args:
44
46
  commit_name = GetNameForCommit(arg)
45
47
  if not commit_name:
46
- print '%s not found' % arg
48
+ print('%s not found' % arg)
47
49
  return 1
48
- print 'commit %s was:' % arg
49
- print ' initially in ' + commit_name
50
+ print('commit %s was:' % arg)
51
+ print(' initially in ' + commit_name)
50
52
  merges = GetMergesForCommit(arg)
51
53
  for merge in merges:
52
- print ' merged to ' + GetNameForCommit(merge) + ' (as ' + merge + ')'
54
+ print(' merged to ' + GetNameForCommit(merge) + ' (as ' + merge + ')')
53
55
  if not merges:
54
- print 'No merges found. If this seems wrong, be sure that you did:'
55
- print ' git fetch origin && gclient sync --with_branch_heads'
56
+ print('No merges found. If this seems wrong, be sure that you did:')
57
+ print(' git fetch origin && gclient sync --with_branch_heads')
56
58
 
57
59
  return 0
58
60
 
@@ -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 json
8
10
  import re
@@ -229,23 +231,23 @@ def main(args):
229
231
 
230
232
  if opts.key:
231
233
  for v in footers.get(normalize_name(opts.key), []):
232
- print v
234
+ print(v)
233
235
  elif opts.position:
234
236
  pos = get_position(footers)
235
- print '%s@{#%s}' % (pos[0], pos[1] or '?')
237
+ print('%s@{#%s}' % (pos[0], pos[1] or '?'))
236
238
  elif opts.position_ref:
237
- print get_position(footers)[0]
239
+ print(get_position(footers)[0])
238
240
  elif opts.position_num:
239
241
  pos = get_position(footers)
240
242
  assert pos[1], 'No valid position for commit'
241
- print pos[1]
243
+ print(pos[1])
242
244
  elif opts.json:
243
245
  with open(opts.json, 'w') as f:
244
246
  json.dump(footers, f)
245
247
  else:
246
248
  for k in footers.keys():
247
249
  for v in footers[k]:
248
- print '%s: %s' % (k, v)
250
+ print('%s: %s' % (k, v))
249
251
  return 0
250
252
 
251
253
 
@@ -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 sys
7
9
  import optparse
8
10
 
@@ -26,7 +28,7 @@ def main(args):
26
28
  dispatcher = subcommand.CommandDispatcher(__name__)
27
29
  ret = dispatcher.execute(optparse.OptionParser(), args)
28
30
  if ret:
29
- print ret
31
+ print(ret)
30
32
  return 0
31
33
 
32
34