libv8 6.3.292.48.1 → 6.7.288.46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +10 -34
  3. data/CHANGELOG.md +16 -0
  4. data/README.md +9 -63
  5. data/Rakefile +2 -2
  6. data/ext/libv8/builder.rb +22 -87
  7. data/ext/libv8/extconf.rb +1 -1
  8. data/ext/libv8/paths.rb +5 -18
  9. data/lib/libv8/version.rb +1 -1
  10. data/spec/location_spec.rb +1 -2
  11. data/spec/spec_helper.rb +0 -1
  12. data/vendor/depot_tools/.gitattributes +1 -2
  13. data/vendor/depot_tools/OWNERS +0 -1
  14. data/vendor/depot_tools/PRESUBMIT.py +11 -6
  15. data/vendor/depot_tools/README.md +0 -1
  16. data/vendor/depot_tools/WATCHLISTS +0 -6
  17. data/vendor/depot_tools/auth.py +129 -87
  18. data/vendor/depot_tools/autoninja +11 -1
  19. data/vendor/depot_tools/autoninja.bat +7 -1
  20. data/vendor/depot_tools/autoninja.py +14 -6
  21. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/cipd +23 -2
  24. data/vendor/depot_tools/cipd.bat +2 -2
  25. data/vendor/depot_tools/cipd_client_version +1 -1
  26. data/vendor/depot_tools/cipd_manifest.txt +17 -7
  27. data/vendor/depot_tools/cit.py +7 -6
  28. data/vendor/depot_tools/cpplint.py +195 -35
  29. data/vendor/depot_tools/detect_host_arch.py +51 -0
  30. data/vendor/depot_tools/download_from_google_storage.py +85 -26
  31. data/vendor/depot_tools/fetch.py +11 -6
  32. data/vendor/depot_tools/fetch_configs/chromium.py +0 -1
  33. data/vendor/depot_tools/fetch_configs/goma_client.py +41 -0
  34. data/vendor/depot_tools/fetch_configs/infra.py +0 -1
  35. data/vendor/depot_tools/fetch_configs/infra_internal.py +0 -1
  36. data/vendor/depot_tools/gclient-new-workdir.py +4 -0
  37. data/vendor/depot_tools/gclient.py +732 -476
  38. data/vendor/depot_tools/gclient_eval.py +569 -58
  39. data/vendor/depot_tools/gclient_scm.py +258 -46
  40. data/vendor/depot_tools/gclient_utils.py +17 -1
  41. data/vendor/depot_tools/gerrit_util.py +46 -13
  42. data/vendor/depot_tools/git_cache.py +0 -2
  43. data/vendor/depot_tools/git_cl.py +176 -335
  44. data/vendor/depot_tools/git_common.py +19 -16
  45. data/vendor/depot_tools/git_footers.py +19 -5
  46. data/vendor/depot_tools/git_hyper_blame.py +9 -3
  47. data/vendor/depot_tools/git_new_branch.py +15 -3
  48. data/vendor/depot_tools/git_upstream_diff.py +7 -2
  49. data/vendor/depot_tools/gsutil.py +1 -1
  50. data/vendor/depot_tools/infra/config/cq.cfg +1 -2
  51. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  52. data/vendor/depot_tools/luci-auth +13 -0
  53. data/vendor/depot_tools/luci-auth.bat +8 -0
  54. data/vendor/depot_tools/man/html/depot_tools.html +0 -8
  55. data/vendor/depot_tools/man/html/git-upstream-diff.html +20 -3
  56. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +27 -6
  57. data/vendor/depot_tools/man/man7/depot_tools.7 +0 -5
  58. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +2 -2
  59. data/vendor/depot_tools/man/src/git-upstream-diff.txt +21 -3
  60. data/vendor/depot_tools/man/src/make_docs.sh +6 -0
  61. data/vendor/depot_tools/my_activity.py +283 -93
  62. data/vendor/depot_tools/owners.py +9 -4
  63. data/vendor/depot_tools/owners_finder.py +7 -3
  64. data/vendor/depot_tools/post_build_ninja_summary.py +322 -0
  65. data/vendor/depot_tools/presubmit_canned_checks.py +91 -106
  66. data/vendor/depot_tools/presubmit_support.py +219 -157
  67. data/vendor/depot_tools/prpc +13 -0
  68. data/vendor/depot_tools/prpc.bat +8 -0
  69. data/vendor/depot_tools/recipes/OWNERS +3 -1
  70. data/vendor/depot_tools/recipes/README.recipes.md +70 -111
  71. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +12 -5
  72. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +36 -68
  73. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +0 -8
  74. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_json.json → no_apply_patch_on_gclient.json} +64 -10
  75. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{no_shallow.json → shallow.json} +1 -1
  76. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +0 -8
  77. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +0 -8
  78. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +0 -6
  79. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +0 -7
  80. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +0 -6
  81. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +44 -0
  82. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_buildbot.json → tryjob_gerrit_branch_heads.json} +51 -5
  83. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +0 -8
  84. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +48 -8
  85. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +19 -26
  86. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +193 -155
  87. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +9 -0
  88. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +2 -7
  89. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +31 -5
  90. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +37 -19
  91. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +37 -19
  92. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +37 -19
  93. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +37 -23
  94. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +4 -0
  95. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +40 -8
  96. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +3 -3
  97. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +6 -3
  98. data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +0 -1
  99. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +0 -1
  100. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +7 -56
  101. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +0 -1
  102. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +15 -16
  103. data/vendor/depot_tools/recipes/recipes.py +4 -2
  104. data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +12 -0
  105. data/vendor/depot_tools/roll_dep.py +35 -37
  106. data/vendor/depot_tools/support/chromite_wrapper +1 -1
  107. data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +3 -3
  108. data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +2 -2
  109. data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +86 -0
  110. data/vendor/depot_tools/third_party/logilab/astroid/bases.py +53 -66
  111. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +31 -31
  112. data/vendor/depot_tools/third_party/logilab/astroid/brain/pynose.py +39 -16
  113. data/vendor/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py +225 -189
  114. data/vendor/depot_tools/third_party/logilab/astroid/inference.py +45 -41
  115. data/vendor/depot_tools/third_party/logilab/astroid/manager.py +1 -0
  116. data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +2 -2
  117. data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +3 -2
  118. data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +1 -0
  119. data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +57 -3
  120. data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +1 -1
  121. data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +21 -1
  122. data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +58 -33
  123. data/vendor/depot_tools/third_party/pylint/README.chromium +2 -2
  124. data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +3 -3
  125. data/vendor/depot_tools/third_party/pylint/checkers/base.py +6 -18
  126. data/vendor/depot_tools/third_party/pylint/checkers/classes.py +64 -63
  127. data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +25 -57
  128. data/vendor/depot_tools/third_party/pylint/checkers/format.py +14 -10
  129. data/vendor/depot_tools/third_party/pylint/checkers/python3.py +142 -37
  130. data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +10 -1
  131. data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +50 -7
  132. data/vendor/depot_tools/third_party/pylint/checkers/strings.py +1 -1
  133. data/vendor/depot_tools/third_party/pylint/epylint.py +2 -1
  134. data/vendor/depot_tools/third_party/pylint/gui.py +1 -1
  135. data/vendor/depot_tools/third_party/pylint/lint.py +88 -23
  136. data/vendor/depot_tools/third_party/pylint/reporters/html.py +37 -5
  137. data/vendor/depot_tools/third_party/pylint/testutils.py +1 -1
  138. data/vendor/depot_tools/third_party/pylint/utils.py +5 -0
  139. data/vendor/depot_tools/vpython +31 -1
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +35 -2
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +0 -15
  142. data/vendor/depot_tools/yapf +17 -0
  143. data/vendor/depot_tools/{apply_issue.bat → yapf.bat} +2 -2
  144. metadata +16 -58
  145. data/ext/libv8/compiler.rb +0 -39
  146. data/ext/libv8/compiler/apple_llvm.rb +0 -22
  147. data/ext/libv8/compiler/clang.rb +0 -22
  148. data/ext/libv8/compiler/gcc.rb +0 -22
  149. data/ext/libv8/compiler/generic_compiler.rb +0 -66
  150. data/ext/libv8/make.rb +0 -13
  151. data/ext/libv8/patcher.rb +0 -21
  152. data/patches/0001-Build-a-standalone-static-library.patch +0 -26
  153. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +0 -85
  154. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +0 -25
  155. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +0 -25
  156. data/patches/0005-Remove-TryInstallOptimizedCode.patch +0 -321
  157. data/patches/mingw-generate-makefiles.sh +0 -97
  158. data/spec/compiler/apple_llvm_spec.rb +0 -37
  159. data/spec/compiler/clang_spec.rb +0 -37
  160. data/spec/compiler/gcc_spec.rb +0 -37
  161. data/spec/compiler/generic_compiler_spec.rb +0 -50
  162. data/spec/compiler_spec.rb +0 -45
  163. data/spec/support/compiler_helpers.rb +0 -47
  164. data/vendor/depot_tools/apply_issue +0 -8
  165. data/vendor/depot_tools/apply_issue.py +0 -315
  166. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +0 -815
  167. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +0 -80
  168. data/vendor/depot_tools/man/src/_git-cherry-pick-upload_desc.helper.txt +0 -1
  169. data/vendor/depot_tools/man/src/git-cherry-pick-upload.demo.1.sh +0 -17
  170. data/vendor/depot_tools/man/src/git-cherry-pick-upload.txt +0 -35
  171. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2.json +0 -8
  172. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +0 -196
  173. data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -6
  174. data/vendor/depot_tools/recipes/recipe_modules/rietveld/api.py +0 -97
  175. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +0 -8
  176. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +0 -30
  177. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +0 -27
  178. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.py +0 -38
  179. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +0 -69
  180. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +0 -69
  181. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -2
  182. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +0 -2
  183. data/vendor/depot_tools/third_party/cq_client/README.md +0 -59
  184. data/vendor/depot_tools/third_party/cq_client/__init__.py +0 -3
  185. data/vendor/depot_tools/third_party/cq_client/v1/__init__.py +0 -3
  186. data/vendor/depot_tools/third_party/cq_client/v1/cq.pb.go +0 -810
  187. data/vendor/depot_tools/third_party/cq_client/v1/cq.proto +0 -281
  188. data/vendor/depot_tools/third_party/cq_client/v1/cq_pb2.py +0 -794
  189. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_both.cfg +0 -71
  190. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_gerrit.cfg +0 -58
  191. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_rietveld.cfg +0 -60
  192. data/vendor/depot_tools/third_party/cq_client/v2/__init__.py +0 -3
  193. data/vendor/depot_tools/third_party/cq_client/v2/cq.pb.go +0 -792
  194. data/vendor/depot_tools/third_party/cq_client/v2/cq.proto +0 -270
  195. data/vendor/depot_tools/third_party/cq_client/v2/cq_pb2.py +0 -841
@@ -26,8 +26,6 @@ import subcommand
26
26
 
27
27
  # Analogous to gc.autopacklimit git config.
28
28
  GC_AUTOPACKLIMIT = 50
29
- if sys.platform.startswith('win'):
30
- GC_AUTOPACKLIMIT = 9
31
29
 
32
30
  GIT_CACHE_CORRUPT_MESSAGE = 'WARNING: The Git cache is corrupt.'
33
31
 
@@ -294,44 +294,6 @@ def _git_amend_head(message, committer_timestamp):
294
294
  return RunGit(['commit', '--amend', '-m', message], env=env)
295
295
 
296
296
 
297
- def add_git_similarity(parser):
298
- parser.add_option(
299
- '--similarity', metavar='SIM', type=int, action='store',
300
- help='Sets the percentage that a pair of files need to match in order to'
301
- ' be considered copies (default 50)')
302
- parser.add_option(
303
- '--find-copies', action='store_true',
304
- help='Allows git to look for copies.')
305
- parser.add_option(
306
- '--no-find-copies', action='store_false', dest='find_copies',
307
- help='Disallows git from looking for copies.')
308
-
309
- old_parser_args = parser.parse_args
310
-
311
- def Parse(args):
312
- options, args = old_parser_args(args)
313
-
314
- if options.similarity is None:
315
- options.similarity = _git_get_branch_config_value(
316
- 'git-cl-similarity', default=50, value_type=int)
317
- else:
318
- print('Note: Saving similarity of %d%% in git config.'
319
- % options.similarity)
320
- _git_set_branch_config_value('git-cl-similarity', options.similarity)
321
-
322
- options.similarity = max(0, min(options.similarity, 100))
323
-
324
- if options.find_copies is None:
325
- options.find_copies = _git_get_branch_config_value(
326
- 'git-find-copies', default=True, value_type=bool)
327
- else:
328
- _git_set_branch_config_value('git-find-copies', bool(options.find_copies))
329
-
330
- return options, args
331
-
332
- parser.parse_args = Parse
333
-
334
-
335
297
  def _get_properties_from_options(options):
336
298
  properties = dict(x.split('=', 1) for x in options.properties)
337
299
  for key, val in properties.iteritems():
@@ -389,10 +351,11 @@ def _buildbucket_retry(operation_name, http, *args, **kwargs):
389
351
  raise BuildbucketResponseException(msg)
390
352
 
391
353
  if response.status == 200:
392
- if not content_json:
354
+ if content_json is None:
393
355
  raise BuildbucketResponseException(
394
356
  'Buildbucket returns invalid json content: %s.\n'
395
- 'Please file bugs at http://crbug.com, label "Infra-BuildBucket".' %
357
+ 'Please file bugs at http://crbug.com, '
358
+ 'component "Infra>Platform>BuildBucket".' %
396
359
  content)
397
360
  return content_json
398
361
  if response.status < 500 or try_count >= 2:
@@ -458,24 +421,17 @@ def _get_bucket_map_for_builders(builders):
458
421
 
459
422
  bucket_map = {}
460
423
  for builder in builders:
461
- masters = builders_map.get(builder, [])
462
- if not masters:
463
- return None, ('No matching master for builder %s.' % builder)
464
- if len(masters) > 1:
465
- return None, ('The builder name %s exists in multiple masters %s.' %
466
- (builder, masters))
467
- bucket = _prefix_master(masters[0])
468
- bucket_map.setdefault(bucket, {})[builder] = []
469
-
424
+ bucket = builders_map.get(builder, {}).get('bucket')
425
+ if bucket:
426
+ bucket_map.setdefault(bucket, {})[builder] = []
470
427
  return bucket_map, None
471
428
 
472
429
 
473
- def _trigger_try_jobs(auth_config, changelist, buckets, options,
474
- category='git_cl_try', patchset=None):
430
+ def _trigger_try_jobs(auth_config, changelist, buckets, options, patchset):
475
431
  """Sends a request to Buildbucket to trigger try jobs for a changelist.
476
432
 
477
433
  Args:
478
- auth_config: AuthConfig for Rietveld.
434
+ auth_config: AuthConfig for Buildbucket.
479
435
  changelist: Changelist that the try jobs are associated with.
480
436
  buckets: A nested dict mapping bucket names to builders to tests.
481
437
  options: Command-line options.
@@ -487,6 +443,8 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options,
487
443
  assert patchset, 'CL must be uploaded first'
488
444
 
489
445
  codereview_host = urlparse.urlparse(codereview_url).hostname
446
+ # Cache the buildbucket credentials under the codereview host key, so that
447
+ # users can use different credentials for different buckets.
490
448
  authenticator = auth.get_authenticator_for_host(codereview_host, auth_config)
491
449
  http = authenticator.authorize(httplib2.Http())
492
450
  http.force_exception_to_status_code = True
@@ -501,7 +459,7 @@ def _trigger_try_jobs(auth_config, changelist, buckets, options,
501
459
  patch=patchset)
502
460
 
503
461
  shared_parameters_properties = changelist.GetTryJobProperties(patchset)
504
- shared_parameters_properties['category'] = category
462
+ shared_parameters_properties['category'] = options.category
505
463
  if options.clobber:
506
464
  shared_parameters_properties['clobber'] = True
507
465
  extra_properties = _get_properties_from_options(options)
@@ -737,7 +695,7 @@ def write_try_results_json(output_file, builds):
737
695
  write_json(output_file, converted)
738
696
 
739
697
 
740
- def print_stats(similarity, find_copies, args):
698
+ def print_stats(args):
741
699
  """Prints statistics about the change to the user."""
742
700
  # --no-ext-diff is broken in some versions of Git, so try to work around
743
701
  # this by overriding the environment (but there is still a problem if the
@@ -746,18 +704,12 @@ def print_stats(similarity, find_copies, args):
746
704
  if 'GIT_EXTERNAL_DIFF' in env:
747
705
  del env['GIT_EXTERNAL_DIFF']
748
706
 
749
- if find_copies:
750
- similarity_options = ['-l100000', '-C%s' % similarity]
751
- else:
752
- similarity_options = ['-M%s' % similarity]
753
-
754
707
  try:
755
708
  stdout = sys.stdout.fileno()
756
709
  except AttributeError:
757
710
  stdout = None
758
711
  return subprocess2.call(
759
- ['git',
760
- 'diff', '--no-ext-diff', '--stat'] + similarity_options + args,
712
+ ['git', 'diff', '--no-ext-diff', '--stat', '-l100000', '-C50'] + args,
761
713
  stdout=stdout, env=env)
762
714
 
763
715
 
@@ -1568,18 +1520,16 @@ class Changelist(object):
1568
1520
  new_description += foot + '\n'
1569
1521
  self.UpdateDescription(new_description, force)
1570
1522
 
1571
- def RunHook(self, committing, may_prompt, verbose, change):
1523
+ def RunHook(self, committing, may_prompt, verbose, change, parallel):
1572
1524
  """Calls sys.exit() if the hook fails; returns a HookResults otherwise."""
1573
1525
  try:
1574
1526
  return presubmit_support.DoPresubmitChecks(change, committing,
1575
1527
  verbose=verbose, output_stream=sys.stdout, input_stream=sys.stdin,
1576
1528
  default_presubmit=None, may_prompt=may_prompt,
1577
- rietveld_obj=self._codereview_impl.GetRietveldObjForPresubmit(),
1578
- gerrit_obj=self._codereview_impl.GetGerritObjForPresubmit())
1529
+ gerrit_obj=self._codereview_impl.GetGerritObjForPresubmit(),
1530
+ parallel=parallel)
1579
1531
  except presubmit_support.PresubmitFailure as e:
1580
- DieWithError(
1581
- ('%s\nMaybe your depot_tools is out of date?\n'
1582
- 'If all fails, contact maruel@') % e)
1532
+ DieWithError('%s\nMaybe your depot_tools is out of date?' % e)
1583
1533
 
1584
1534
  def CMDPatchIssue(self, issue_arg, reject, nocommit, directory):
1585
1535
  """Fetches and applies the issue patch from codereview to local branch."""
@@ -1641,9 +1591,9 @@ class Changelist(object):
1641
1591
  change)
1642
1592
  change.SetDescriptionText(change_description.description)
1643
1593
  hook_results = self.RunHook(committing=False,
1644
- may_prompt=not options.force,
1645
- verbose=options.verbose,
1646
- change=change)
1594
+ may_prompt=not options.force,
1595
+ verbose=options.verbose,
1596
+ change=change, parallel=options.parallel)
1647
1597
  if not hook_results.should_continue():
1648
1598
  return 1
1649
1599
  if not options.reviewers and hook_results.reviewers:
@@ -1665,13 +1615,17 @@ class Changelist(object):
1665
1615
  'uploading now might not include those changes.')
1666
1616
  confirm_or_exit(action='upload')
1667
1617
 
1668
- print_stats(options.similarity, options.find_copies, git_diff_args)
1618
+ print_stats(git_diff_args)
1669
1619
  ret = self.CMDUploadChange(options, git_diff_args, custom_cl_base, change)
1670
1620
  if not ret:
1671
- if options.use_commit_queue:
1672
- self.SetCQState(_CQState.COMMIT)
1673
- elif options.cq_dry_run:
1674
- self.SetCQState(_CQState.DRY_RUN)
1621
+ if self.IsGerrit():
1622
+ self.SetLabels(options.enable_auto_submit, options.use_commit_queue,
1623
+ options.cq_dry_run);
1624
+ else:
1625
+ if options.use_commit_queue:
1626
+ self.SetCQState(_CQState.COMMIT)
1627
+ elif options.cq_dry_run:
1628
+ self.SetCQState(_CQState.DRY_RUN)
1675
1629
 
1676
1630
  _git_set_branch_config_value('last-upload-hash',
1677
1631
  RunGit(['rev-parse', 'HEAD']).strip())
@@ -1696,6 +1650,41 @@ class Changelist(object):
1696
1650
  ret = upload_branch_deps(self, orig_args)
1697
1651
  return ret
1698
1652
 
1653
+ def SetLabels(self, enable_auto_submit, use_commit_queue, cq_dry_run):
1654
+ """Sets labels on the change based on the provided flags.
1655
+
1656
+ Sets labels if issue is already uploaded and known, else returns without
1657
+ doing anything.
1658
+
1659
+ Args:
1660
+ enable_auto_submit: Sets Auto-Submit+1 on the change.
1661
+ use_commit_queue: Sets Commit-Queue+2 on the change.
1662
+ cq_dry_run: Sets Commit-Queue+1 on the change. Overrides Commit-Queue+2 if
1663
+ both use_commit_queue and cq_dry_run are true.
1664
+ """
1665
+ if not self.GetIssue():
1666
+ return
1667
+ try:
1668
+ self._codereview_impl.SetLabels(enable_auto_submit, use_commit_queue,
1669
+ cq_dry_run)
1670
+ return 0
1671
+ except KeyboardInterrupt:
1672
+ raise
1673
+ except:
1674
+ labels = []
1675
+ if enable_auto_submit:
1676
+ labels.append('Auto-Submit')
1677
+ if use_commit_queue or cq_dry_run:
1678
+ labels.append('Commit-Queue')
1679
+ print('WARNING: Failed to set label(s) on your change: %s\n'
1680
+ 'Either:\n'
1681
+ ' * Your project does not have the above label(s),\n'
1682
+ ' * You don\'t have permission to set the above label(s),\n'
1683
+ ' * There\'s a bug in this code (see stack trace below).\n' %
1684
+ (', '.join(labels)))
1685
+ # Still raise exception so that stack trace is printed.
1686
+ raise
1687
+
1699
1688
  def SetCQState(self, new_state):
1700
1689
  """Updates the CQ state for the latest patchset.
1701
1690
 
@@ -1747,6 +1736,9 @@ class Changelist(object):
1747
1736
  """Get owner from codereview, which may differ from this checkout."""
1748
1737
  return self._codereview_impl.GetIssueOwner()
1749
1738
 
1739
+ def GetReviewers(self):
1740
+ return self._codereview_impl.GetReviewers()
1741
+
1750
1742
  def GetMostRecentPatchset(self):
1751
1743
  return self._codereview_impl.GetMostRecentPatchset()
1752
1744
 
@@ -1816,11 +1808,6 @@ class _ChangelistCodereviewBase(object):
1816
1808
  """Which branch-specific properties to erase when unsetting issue."""
1817
1809
  return []
1818
1810
 
1819
- def GetRietveldObjForPresubmit(self):
1820
- # This is an unfortunate Rietveld-embeddedness in presubmit.
1821
- # For non-Rietveld code reviews, this probably should return a dummy object.
1822
- raise NotImplementedError()
1823
-
1824
1811
  def GetGerritObjForPresubmit(self):
1825
1812
  # None is valid return value, otherwise presubmit_support.GerritAccessor.
1826
1813
  return None
@@ -1891,6 +1878,13 @@ class _ChangelistCodereviewBase(object):
1891
1878
  """Uploads a change to codereview."""
1892
1879
  raise NotImplementedError()
1893
1880
 
1881
+ def SetLabels(self, enable_auto_submit, use_commit_queue, cq_dry_run):
1882
+ """Sets labels on the change based on the provided flags.
1883
+
1884
+ Issue must have been already uploaded and known.
1885
+ """
1886
+ raise NotImplementedError()
1887
+
1894
1888
  def SetCQState(self, new_state):
1895
1889
  """Updates the CQ state for the latest patchset.
1896
1890
 
@@ -1905,6 +1899,9 @@ class _ChangelistCodereviewBase(object):
1905
1899
  def GetIssueOwner(self):
1906
1900
  raise NotImplementedError()
1907
1901
 
1902
+ def GetReviewers(self):
1903
+ raise NotImplementedError()
1904
+
1908
1905
  def GetTryJobProperties(self, patchset=None):
1909
1906
  raise NotImplementedError()
1910
1907
 
@@ -2007,6 +2004,9 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
2007
2004
  def GetIssueOwner(self):
2008
2005
  return (self.GetIssueProperties() or {}).get('owner_email')
2009
2006
 
2007
+ def GetReviewers(self):
2008
+ return (self.GetIssueProperties() or {}).get('reviewers')
2009
+
2010
2010
  def AddComment(self, message, publish=None):
2011
2011
  return self.RpcServer().add_comment(self.GetIssue(), message)
2012
2012
 
@@ -2125,8 +2125,8 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
2125
2125
  def CodereviewServerConfigKey(cls):
2126
2126
  return 'rietveldserver'
2127
2127
 
2128
- def GetRietveldObjForPresubmit(self):
2129
- return self.RpcServer()
2128
+ def SetLabels(self, enable_auto_submit, use_commit_queue, cq_dry_run):
2129
+ raise NotImplementedError()
2130
2130
 
2131
2131
  def SetCQState(self, new_state):
2132
2132
  props = self.GetIssueProperties()
@@ -2273,10 +2273,6 @@ class _RietveldChangelistImpl(_ChangelistCodereviewBase):
2273
2273
  if options.private or settings.GetDefaultPrivateFlag() == "True":
2274
2274
  upload_args.append('--private')
2275
2275
 
2276
- upload_args.extend(['--git_similarity', str(options.similarity)])
2277
- if not options.find_copies:
2278
- upload_args.extend(['--git_no_find_copies'])
2279
-
2280
2276
  # Include the upstream repo's URL in the change -- this is useful for
2281
2277
  # projects that have their source spread across multiple repos.
2282
2278
  remote_url = self.GetGitBaseUrlFromConfig()
@@ -2501,24 +2497,6 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2501
2497
  """Which branch-specific properties to erase when unsetting issue."""
2502
2498
  return ['gerritsquashhash']
2503
2499
 
2504
- def GetRietveldObjForPresubmit(self):
2505
- class ThisIsNotRietveldIssue(object):
2506
- def __nonzero__(self):
2507
- # This is a hack to make presubmit_support think that rietveld is not
2508
- # defined, yet still ensure that calls directly result in a decent
2509
- # exception message below.
2510
- return False
2511
-
2512
- def __getattr__(self, attr):
2513
- print(
2514
- 'You aren\'t using Rietveld at the moment, but Gerrit.\n'
2515
- 'Using Rietveld in your PRESUBMIT scripts won\'t work.\n'
2516
- 'Please, either change your PRESUBMIT to not use rietveld_obj.%s,\n'
2517
- 'or use Rietveld for codereview.\n'
2518
- 'See also http://crbug.com/579160.' % attr)
2519
- raise NotImplementedError()
2520
- return ThisIsNotRietveldIssue()
2521
-
2522
2500
  def GetGerritObjForPresubmit(self):
2523
2501
  return presubmit_support.GerritAccessor(self._GetGerritHost())
2524
2502
 
@@ -2739,7 +2717,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2739
2717
  raise
2740
2718
  return data
2741
2719
 
2742
- def CMDLand(self, force, bypass_hooks, verbose):
2720
+ def CMDLand(self, force, bypass_hooks, verbose, parallel):
2743
2721
  if git_common.is_dirty_git_tree('land'):
2744
2722
  return 1
2745
2723
  detail = self._GetChangeDetail(['CURRENT_REVISION', 'LABELS'])
@@ -2772,7 +2750,8 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2772
2750
  committing=True,
2773
2751
  may_prompt=not force,
2774
2752
  verbose=verbose,
2775
- change=self.GetChange(self.GetCommonAncestorWithUpstream(), None))
2753
+ change=self.GetChange(self.GetCommonAncestorWithUpstream(), None),
2754
+ parallel=parallel)
2776
2755
  if not hook_results.should_continue():
2777
2756
  return 1
2778
2757
 
@@ -2815,7 +2794,15 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
2815
2794
  DieWithError('Couldn\'t find patchset %i in change %i' %
2816
2795
  (parsed_issue_arg.patchset, self.GetIssue()))
2817
2796
 
2797
+ remote_url = self._changelist.GetRemoteUrl()
2798
+ if remote_url.endswith('.git'):
2799
+ remote_url = remote_url[:-len('.git')]
2818
2800
  fetch_info = revision_info['fetch']['http']
2801
+
2802
+ if remote_url != fetch_info['url']:
2803
+ DieWithError('Trying to patch a change from %s but this repo appears '
2804
+ 'to be %s.' % (fetch_info['url'], remote_url))
2805
+
2819
2806
  RunGit(['fetch', fetch_info['url'], fetch_info['ref']])
2820
2807
 
2821
2808
  if force:
@@ -3057,7 +3044,7 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
3057
3044
  if options.send_mail:
3058
3045
  refspec_opts.append('ready')
3059
3046
  refspec_opts.append('notify=ALL')
3060
- elif not self.GetIssue():
3047
+ elif not self.GetIssue() and options.squash:
3061
3048
  refspec_opts.append('wip')
3062
3049
  else:
3063
3050
  refspec_opts.append('notify=NONE')
@@ -3221,6 +3208,21 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
3221
3208
  else:
3222
3209
  DieWithError('ERROR: Gerrit commit-msg hook not installed.')
3223
3210
 
3211
+ def SetLabels(self, enable_auto_submit, use_commit_queue, cq_dry_run):
3212
+ """Sets labels on the change based on the provided flags."""
3213
+ labels = {}
3214
+ notify = None;
3215
+ if enable_auto_submit:
3216
+ labels['Auto-Submit'] = 1
3217
+ if use_commit_queue:
3218
+ labels['Commit-Queue'] = 2
3219
+ elif cq_dry_run:
3220
+ labels['Commit-Queue'] = 1
3221
+ notify = False
3222
+ if labels:
3223
+ gerrit_util.SetReview(self._GetGerritHost(), self.GetIssue(),
3224
+ labels=labels, notify=notify)
3225
+
3224
3226
  def SetCQState(self, new_state):
3225
3227
  """Sets the Commit-Queue label assuming canonical CQ config for Gerrit."""
3226
3228
  vote_map = {
@@ -3267,6 +3269,10 @@ class _GerritChangelistImpl(_ChangelistCodereviewBase):
3267
3269
  def GetIssueOwner(self):
3268
3270
  return self._GetChangeDetail(['DETAILED_ACCOUNTS'])['owner']['email']
3269
3271
 
3272
+ def GetReviewers(self):
3273
+ details = self._GetChangeDetail(['DETAILED_ACCOUNTS'])
3274
+ return [reviewer['email'] for reviewer in details['reviewers']['REVIEWER']]
3275
+
3270
3276
 
3271
3277
  _CODEREVIEW_IMPLEMENTATIONS = {
3272
3278
  'rietveld': _RietveldChangelistImpl,
@@ -3473,8 +3479,9 @@ class ChangeDescription(object):
3473
3479
  DieWithError('Running editor failed')
3474
3480
  lines = content.splitlines()
3475
3481
 
3476
- # Strip off comments.
3477
- clean_lines = [line.rstrip() for line in lines if not line.startswith('#')]
3482
+ # Strip off comments and default inserted "Bug:" line.
3483
+ clean_lines = [line.rstrip() for line in lines if not
3484
+ (line.startswith('#') or line.rstrip() == "Bug:")]
3478
3485
  if not clean_lines:
3479
3486
  DieWithError('No CL description, aborting')
3480
3487
  self.set_description(clean_lines)
@@ -4182,7 +4189,7 @@ def get_cl_statuses(changes, fine_grained, max_processes=None):
4182
4189
  return (cl, cl.GetStatus())
4183
4190
  except:
4184
4191
  # See http://crbug.com/629863.
4185
- logging.exception('failed to fetch status for %s:', cl)
4192
+ logging.exception('failed to fetch status for cl %s:', cl.GetIssue())
4186
4193
  raise
4187
4194
 
4188
4195
  threads_count = len(changes)
@@ -4789,6 +4796,9 @@ def CMDpresubmit(parser, args):
4789
4796
  help='Run checks even if tree is dirty')
4790
4797
  parser.add_option('--all', action='store_true',
4791
4798
  help='Run checks against all files, not just modified ones')
4799
+ parser.add_option('--parallel', action='store_true',
4800
+ help='Run all tests specified by input_api.RunTests in all '
4801
+ 'PRESUBMIT files in parallel.')
4792
4802
  auth.add_auth_options(parser)
4793
4803
  options, args = parser.parse_args(args)
4794
4804
  auth_config = auth.extract_auth_config_from_options(options)
@@ -4823,7 +4833,8 @@ def CMDpresubmit(parser, args):
4823
4833
  committing=not options.upload,
4824
4834
  may_prompt=False,
4825
4835
  verbose=options.verbose,
4826
- change=change)
4836
+ change=change,
4837
+ parallel=options.parallel)
4827
4838
  return 0
4828
4839
 
4829
4840
 
@@ -5001,6 +5012,13 @@ def CMDupload(parser, args):
5001
5012
  parser.add_option('--dependencies', action='store_true',
5002
5013
  help='Uploads CLs of all the local branches that depend on '
5003
5014
  'the current branch')
5015
+ parser.add_option('-a', '--enable-auto-submit', action='store_true',
5016
+ help='Sends your change to the CQ after an approval. Only '
5017
+ 'works on repos that have the Auto-Submit label '
5018
+ 'enabled')
5019
+ parser.add_option('--parallel', action='store_true',
5020
+ help='Run all tests specified by input_api.RunTests in all '
5021
+ 'PRESUBMIT files in parallel.')
5004
5022
 
5005
5023
  # TODO: remove Rietveld flags
5006
5024
  parser.add_option('--private', action='store_true',
@@ -5009,7 +5027,6 @@ def CMDupload(parser, args):
5009
5027
  help='email address to use to connect to Rietveld')
5010
5028
 
5011
5029
  orig_args = args
5012
- add_git_similarity(parser)
5013
5030
  auth.add_auth_options(parser)
5014
5031
  _add_codereview_select_options(parser)
5015
5032
  (options, args) = parser.parse_args(args)
@@ -5109,226 +5126,37 @@ def CMDland(parser, args):
5109
5126
  help="external contributor for patch (appended to " +
5110
5127
  "description and used as author for git). Should be " +
5111
5128
  "formatted as 'First Last <email@example.com>'")
5112
- add_git_similarity(parser)
5129
+ parser.add_option('--parallel', action='store_true',
5130
+ help='Run all tests specified by input_api.RunTests in all '
5131
+ 'PRESUBMIT files in parallel.')
5113
5132
  auth.add_auth_options(parser)
5114
5133
  (options, args) = parser.parse_args(args)
5115
5134
  auth_config = auth.extract_auth_config_from_options(options)
5116
5135
 
5117
5136
  cl = Changelist(auth_config=auth_config)
5118
5137
 
5119
- # TODO(tandrii): refactor this into _RietveldChangelistImpl method.
5120
- if cl.IsGerrit():
5121
- if options.message:
5122
- # This could be implemented, but it requires sending a new patch to
5123
- # Gerrit, as Gerrit unlike Rietveld versions messages with patchsets.
5124
- # Besides, Gerrit has the ability to change the commit message on submit
5125
- # automatically, thus there is no need to support this option (so far?).
5126
- parser.error('-m MESSAGE option is not supported for Gerrit.')
5127
- if options.contributor:
5128
- parser.error(
5129
- '-c CONTRIBUTOR option is not supported for Gerrit.\n'
5130
- 'Before uploading a commit to Gerrit, ensure it\'s author field is '
5131
- 'the contributor\'s "name <email>". If you can\'t upload such a '
5132
- 'commit for review, contact your repository admin and request'
5133
- '"Forge-Author" permission.')
5134
- if not cl.GetIssue():
5135
- DieWithError('You must upload the change first to Gerrit.\n'
5136
- ' If you would rather have `git cl land` upload '
5137
- 'automatically for you, see http://crbug.com/642759')
5138
- return cl._codereview_impl.CMDLand(options.force, options.bypass_hooks,
5139
- options.verbose)
5140
-
5141
- current = cl.GetBranch()
5142
- remote, upstream_branch = cl.FetchUpstreamTuple(cl.GetBranch())
5143
- if remote == '.':
5144
- print()
5145
- print('Attempting to push branch %r into another local branch!' % current)
5146
- print()
5147
- print('Either reparent this branch on top of origin/master:')
5148
- print(' git reparent-branch --root')
5149
- print()
5150
- print('OR run `git rebase-update` if you think the parent branch is ')
5151
- print('already committed.')
5152
- print()
5153
- print(' Current parent: %r' % upstream_branch)
5154
- return 1
5155
-
5156
- if not args:
5157
- # Default to merging against our best guess of the upstream branch.
5158
- args = [cl.GetUpstreamBranch()]
5159
-
5160
- if options.contributor:
5161
- if not re.match('^.*\s<\S+@\S+>$', options.contributor):
5162
- print("Please provide contributor as 'First Last <email@example.com>'")
5163
- return 1
5164
-
5165
- base_branch = args[0]
5166
-
5167
- if git_common.is_dirty_git_tree('land'):
5168
- return 1
5169
-
5170
- # This rev-list syntax means "show all commits not in my branch that
5171
- # are in base_branch".
5172
- upstream_commits = RunGit(['rev-list', '^' + cl.GetBranchRef(),
5173
- base_branch]).splitlines()
5174
- if upstream_commits:
5175
- print('Base branch "%s" has %d commits '
5176
- 'not in this branch.' % (base_branch, len(upstream_commits)))
5177
- print('Run "git merge %s" before attempting to land.' % base_branch)
5178
- return 1
5179
-
5180
- merge_base = RunGit(['merge-base', base_branch, 'HEAD']).strip()
5181
- if not options.bypass_hooks:
5182
- author = None
5183
- if options.contributor:
5184
- author = re.search(r'\<(.*)\>', options.contributor).group(1)
5185
- hook_results = cl.RunHook(
5186
- committing=True,
5187
- may_prompt=not options.force,
5188
- verbose=options.verbose,
5189
- change=cl.GetChange(merge_base, author))
5190
- if not hook_results.should_continue():
5191
- return 1
5192
-
5193
- # Check the tree status if the tree status URL is set.
5194
- status = GetTreeStatus()
5195
- if 'closed' == status:
5196
- print('The tree is closed. Please wait for it to reopen. Use '
5197
- '"git cl land --bypass-hooks" to commit on a closed tree.')
5198
- return 1
5199
- elif 'unknown' == status:
5200
- print('Unable to determine tree status. Please verify manually and '
5201
- 'use "git cl land --bypass-hooks" to commit on a closed tree.')
5202
- return 1
5203
-
5204
- change_desc = ChangeDescription(options.message)
5205
- if not change_desc.description and cl.GetIssue():
5206
- change_desc = ChangeDescription(cl.GetDescription())
5207
-
5208
- if not change_desc.description:
5209
- if not cl.GetIssue() and options.bypass_hooks:
5210
- change_desc = ChangeDescription(CreateDescriptionFromLog([merge_base]))
5211
- else:
5212
- print('No description set.')
5213
- print('Visit %s/edit to set it.' % (cl.GetIssueURL()))
5214
- return 1
5215
-
5216
- # Keep a separate copy for the commit message, because the commit message
5217
- # contains the link to the Rietveld issue, while the Rietveld message contains
5218
- # the commit viewvc url.
5219
- if cl.GetIssue():
5220
- change_desc.update_reviewers(
5221
- get_approving_reviewers(cl.GetIssueProperties()), [])
5222
-
5223
- commit_desc = ChangeDescription(change_desc.description)
5224
- if cl.GetIssue():
5225
- # Xcode won't linkify this URL unless there is a non-whitespace character
5226
- # after it. Add a period on a new line to circumvent this. Also add a space
5227
- # before the period to make sure that Gitiles continues to correctly resolve
5228
- # the URL.
5229
- commit_desc.append_footer('Review-Url: %s .' % cl.GetIssueURL())
5138
+ if not cl.IsGerrit():
5139
+ parser.error('rietveld is not supported')
5140
+
5141
+ if options.message:
5142
+ # This could be implemented, but it requires sending a new patch to
5143
+ # Gerrit, as Gerrit unlike Rietveld versions messages with patchsets.
5144
+ # Besides, Gerrit has the ability to change the commit message on submit
5145
+ # automatically, thus there is no need to support this option (so far?).
5146
+ parser.error('-m MESSAGE option is not supported for Gerrit.')
5230
5147
  if options.contributor:
5231
- commit_desc.append_footer('Patch from %s.' % options.contributor)
5232
-
5233
- print('Description:')
5234
- print(commit_desc.description)
5235
-
5236
- branches = [merge_base, cl.GetBranchRef()]
5237
- if not options.force:
5238
- print_stats(options.similarity, options.find_copies, branches)
5239
-
5240
- # We want to squash all this branch's commits into one commit with the proper
5241
- # description. We do this by doing a "reset --soft" to the base branch (which
5242
- # keeps the working copy the same), then landing that.
5243
- # Delete the special branches if they exist.
5244
- for branch in [MERGE_BRANCH, CHERRY_PICK_BRANCH]:
5245
- showref_cmd = ['show-ref', '--quiet', '--verify', 'refs/heads/%s' % branch]
5246
- result = RunGitWithCode(showref_cmd)
5247
- if result[0] == 0:
5248
- RunGit(['branch', '-D', branch])
5249
-
5250
- # We might be in a directory that's present in this branch but not in the
5251
- # trunk. Move up to the top of the tree so that git commands that expect a
5252
- # valid CWD won't fail after we check out the merge branch.
5253
- rel_base_path = settings.GetRelativeRoot()
5254
- if rel_base_path:
5255
- os.chdir(rel_base_path)
5256
-
5257
- # Stuff our change into the merge branch.
5258
- # We wrap in a try...finally block so if anything goes wrong,
5259
- # we clean up the branches.
5260
- retcode = -1
5261
- revision = None
5262
- try:
5263
- RunGit(['checkout', '-q', '-b', MERGE_BRANCH])
5264
- RunGit(['reset', '--soft', merge_base])
5265
- if options.contributor:
5266
- RunGit(
5267
- [
5268
- 'commit', '--author', options.contributor,
5269
- '-m', commit_desc.description,
5270
- ])
5271
- else:
5272
- RunGit(['commit', '-m', commit_desc.description])
5273
-
5274
- remote, branch = cl.FetchUpstreamTuple(cl.GetBranch())
5275
- mirror = settings.GetGitMirror(remote)
5276
- if mirror:
5277
- pushurl = mirror.url
5278
- git_numberer_enabled = _is_git_numberer_enabled(pushurl, branch)
5279
- else:
5280
- pushurl = remote # Usually, this is 'origin'.
5281
- git_numberer_enabled = _is_git_numberer_enabled(
5282
- RunGit(['config', 'remote.%s.url' % remote]).strip(), branch)
5283
-
5284
- retcode = PushToGitWithAutoRebase(
5285
- pushurl, branch, commit_desc.description, git_numberer_enabled)
5286
- if retcode == 0:
5287
- revision = RunGit(['rev-parse', 'HEAD']).strip()
5288
- if git_numberer_enabled:
5289
- change_desc = ChangeDescription(
5290
- RunGit(['show', '-s', '--format=%B', 'HEAD']).strip())
5291
- except: # pylint: disable=bare-except
5292
- if _IS_BEING_TESTED:
5293
- logging.exception('this is likely your ACTUAL cause of test failure.\n'
5294
- + '-' * 30 + '8<' + '-' * 30)
5295
- logging.error('\n' + '-' * 30 + '8<' + '-' * 30 + '\n\n\n')
5296
- raise
5297
- finally:
5298
- # And then swap back to the original branch and clean up.
5299
- RunGit(['checkout', '-q', cl.GetBranch()])
5300
- RunGit(['branch', '-D', MERGE_BRANCH])
5301
- RunGit(['branch', '-D', CHERRY_PICK_BRANCH], error_ok=True)
5302
-
5303
- if not revision:
5304
- print('Failed to push. If this persists, please file a bug.')
5305
- return 1
5306
-
5307
- if cl.GetIssue():
5308
- viewvc_url = settings.GetViewVCUrl()
5309
- if viewvc_url and revision:
5310
- change_desc.append_footer(
5311
- 'Committed: %s%s' % (viewvc_url, revision))
5312
- elif revision:
5313
- change_desc.append_footer('Committed: %s' % (revision,))
5314
- print('Closing issue '
5315
- '(you may be prompted for your codereview password)...')
5316
- cl.UpdateDescription(change_desc.description)
5317
- cl.CloseIssue()
5318
- props = cl.GetIssueProperties()
5319
- patch_num = len(props['patchsets'])
5320
- comment = "Committed patchset #%d (id:%d) manually as %s" % (
5321
- patch_num, props['patchsets'][-1], revision)
5322
- if options.bypass_hooks:
5323
- comment += ' (tree was closed).' if GetTreeStatus() == 'closed' else '.'
5324
- else:
5325
- comment += ' (presubmit successful).'
5326
- cl.RpcServer().add_comment(cl.GetIssue(), comment)
5327
-
5328
- if os.path.isfile(POSTUPSTREAM_HOOK):
5329
- RunCommand([POSTUPSTREAM_HOOK, merge_base], error_ok=True)
5330
-
5331
- return 0
5148
+ parser.error(
5149
+ '-c CONTRIBUTOR option is not supported for Gerrit.\n'
5150
+ 'Before uploading a commit to Gerrit, ensure it\'s author field is '
5151
+ 'the contributor\'s "name <email>". If you can\'t upload such a '
5152
+ 'commit for review, contact your repository admin and request'
5153
+ '"Forge-Author" permission.')
5154
+ if not cl.GetIssue():
5155
+ DieWithError('You must upload the change first to Gerrit.\n'
5156
+ ' If you would rather have `git cl land` upload '
5157
+ 'automatically for you, see http://crbug.com/642759')
5158
+ return cl._codereview_impl.CMDLand(options.force, options.bypass_hooks,
5159
+ options.verbose, options.parallel)
5332
5160
 
5333
5161
 
5334
5162
  def PushToGitWithAutoRebase(remote, branch, original_description,
@@ -5576,6 +5404,8 @@ def CMDtry(parser, args):
5576
5404
  '-c', '--clobber', action='store_true', default=False,
5577
5405
  help='Force a clobber before building; that is don\'t do an '
5578
5406
  'incremental build')
5407
+ group.add_option(
5408
+ '--category', default='git_cl_try', help='Specify custom build category.')
5579
5409
  group.add_option(
5580
5410
  '--project',
5581
5411
  help='Override which project to use. Projects are defined '
@@ -5593,7 +5423,9 @@ def CMDtry(parser, args):
5593
5423
  help='Host of buildbucket. The default host is %default.')
5594
5424
  parser.add_option_group(group)
5595
5425
  auth.add_auth_options(parser)
5426
+ _add_codereview_issue_select_options(parser)
5596
5427
  options, args = parser.parse_args(args)
5428
+ _process_codereview_issue_select_options(parser, options)
5597
5429
  auth_config = auth.extract_auth_config_from_options(options)
5598
5430
 
5599
5431
  if options.master and options.master.startswith('luci.'):
@@ -5607,7 +5439,8 @@ def CMDtry(parser, args):
5607
5439
  if args:
5608
5440
  parser.error('Unknown arguments: %s' % args)
5609
5441
 
5610
- cl = Changelist(auth_config=auth_config)
5442
+ cl = Changelist(auth_config=auth_config, issue=options.issue,
5443
+ codereview=options.forced_codereview)
5611
5444
  if not cl.GetIssue():
5612
5445
  parser.error('Need to upload first')
5613
5446
 
@@ -5652,8 +5485,7 @@ def CMDtry(parser, args):
5652
5485
  (patchset, cl.GetPatchset(), patchset))
5653
5486
 
5654
5487
  try:
5655
- _trigger_try_jobs(auth_config, cl, buckets, options, 'git_cl_try',
5656
- patchset)
5488
+ _trigger_try_jobs(auth_config, cl, buckets, options, patchset)
5657
5489
  except BuildbucketResponseException as ex:
5658
5490
  print('ERROR: %s' % ex)
5659
5491
  return 1
@@ -5846,6 +5678,10 @@ def CMDdiff(parser, args):
5846
5678
 
5847
5679
  def CMDowners(parser, args):
5848
5680
  """Finds potential owners for reviewing."""
5681
+ parser.add_option(
5682
+ '--ignore-current',
5683
+ action='store_true',
5684
+ help='Ignore the CL\'s current reviewers and start from scratch.')
5849
5685
  parser.add_option(
5850
5686
  '--no-color',
5851
5687
  action='store_true',
@@ -5881,7 +5717,9 @@ def CMDowners(parser, args):
5881
5717
  return owners_finder.OwnersFinder(
5882
5718
  affected_files,
5883
5719
  change.RepositoryRoot(),
5884
- author, fopen=file, os_path=os.path,
5720
+ author,
5721
+ [] if options.ignore_current else cl.GetReviewers(),
5722
+ fopen=file, os_path=os.path,
5885
5723
  disable_color=options.no_color,
5886
5724
  override_files=change.OriginalOwnersFiles()).run()
5887
5725
 
@@ -6018,12 +5856,15 @@ def CMDformat(parser, args):
6018
5856
 
6019
5857
  if opts.full:
6020
5858
  if python_diff_files:
6021
- cmd = [yapf_tool]
6022
- if not opts.dry_run and not opts.diff:
6023
- cmd.append('-i')
6024
- stdout = RunCommand(cmd + python_diff_files, cwd=top_dir)
6025
- if opts.diff:
6026
- sys.stdout.write(stdout)
5859
+ if opts.dry_run or opts.diff:
5860
+ cmd = [yapf_tool, '--diff'] + python_diff_files
5861
+ stdout = RunCommand(cmd, error_ok=True, cwd=top_dir)
5862
+ if opts.diff:
5863
+ sys.stdout.write(stdout)
5864
+ elif len(stdout) > 0:
5865
+ return_value = 2
5866
+ else:
5867
+ RunCommand([yapf_tool, '-i'] + python_diff_files, cwd=top_dir)
6027
5868
  else:
6028
5869
  # TODO(sbc): yapf --lines mode still has some issues.
6029
5870
  # https://github.com/google/yapf/issues/154