libv8 5.7.492.65.1 → 5.9.211.38.0beta0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +8 -2
  4. data/CHANGELOG.md +4 -0
  5. data/README.md +4 -3
  6. data/Rakefile +27 -10
  7. data/ext/libv8/builder.rb +4 -0
  8. data/lib/libv8/version.rb +1 -1
  9. data/libv8.gemspec +1 -1
  10. data/patches/0001-Build-a-standalone-static-library.patch +5 -5
  11. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +20 -24
  12. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +5 -5
  13. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +5 -5
  14. data/patches/0005-Fix-GCC-7-build-errors.patch +147 -0
  15. data/scaleway.png +0 -0
  16. data/vendor/depot_tools/.gitattributes +52 -0
  17. data/vendor/depot_tools/.gitignore +10 -0
  18. data/vendor/depot_tools/README.md +7 -3
  19. data/vendor/depot_tools/apply_issue.bat +4 -3
  20. data/vendor/depot_tools/apply_issue.py +0 -10
  21. data/vendor/depot_tools/autoninja +12 -0
  22. data/vendor/depot_tools/autoninja.bat +9 -0
  23. data/vendor/depot_tools/autoninja.py +70 -0
  24. data/vendor/depot_tools/bootstrap/win/README.md +108 -26
  25. data/vendor/depot_tools/bootstrap/win/git-bash.template.sh +3 -3
  26. data/vendor/depot_tools/bootstrap/win/git.template.bat +2 -2
  27. data/vendor/depot_tools/bootstrap/win/manifest.txt +18 -0
  28. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +18 -0
  29. data/vendor/depot_tools/bootstrap/win/python27.new.bat +49 -0
  30. data/vendor/depot_tools/bootstrap/win/win_tools.bat +55 -59
  31. data/vendor/depot_tools/bootstrap/win/win_tools.py +335 -0
  32. data/vendor/depot_tools/cipd +16 -2
  33. data/vendor/depot_tools/cipd.bat +20 -2
  34. data/vendor/depot_tools/cipd.ps1 +36 -22
  35. data/vendor/depot_tools/cipd_bin_setup.bat +6 -0
  36. data/vendor/depot_tools/cipd_bin_setup.sh +10 -0
  37. data/vendor/depot_tools/cipd_client_version +1 -1
  38. data/vendor/depot_tools/cipd_manifest.txt +9 -0
  39. data/vendor/depot_tools/cit.bat +12 -11
  40. data/vendor/depot_tools/clang-format.bat +4 -3
  41. data/vendor/depot_tools/clang_format_merge_driver.bat +12 -11
  42. data/vendor/depot_tools/commit_queue.bat +4 -3
  43. data/vendor/depot_tools/cpplint.bat +9 -3
  44. data/vendor/depot_tools/cpplint.py +3 -3
  45. data/vendor/depot_tools/depot-tools-auth.bat +4 -3
  46. data/vendor/depot_tools/download_from_google_storage.bat +5 -3
  47. data/vendor/depot_tools/download_from_google_storage.py +6 -1
  48. data/vendor/depot_tools/fetch.bat +5 -4
  49. data/vendor/depot_tools/fetch.py +4 -5
  50. data/vendor/depot_tools/gclient-new-workdir.py +82 -46
  51. data/vendor/depot_tools/gclient.bat +5 -4
  52. data/vendor/depot_tools/gclient.py +713 -319
  53. data/vendor/depot_tools/gclient_eval.py +284 -0
  54. data/vendor/depot_tools/gclient_utils.py +70 -4
  55. data/vendor/depot_tools/gerrit_client.py +26 -1
  56. data/vendor/depot_tools/gerrit_util.py +120 -127
  57. data/vendor/depot_tools/git-crrev-parse +1 -0
  58. data/vendor/depot_tools/git-gs +1 -1
  59. data/vendor/depot_tools/git_cl.py +731 -415
  60. data/vendor/depot_tools/git_common.py +23 -3
  61. data/vendor/depot_tools/git_drover.py +10 -1
  62. data/vendor/depot_tools/git_footers.py +62 -22
  63. data/vendor/depot_tools/git_hyper_blame.py +3 -2
  64. data/vendor/depot_tools/git_map.py +30 -3
  65. data/vendor/depot_tools/git_map_branches.py +18 -4
  66. data/vendor/depot_tools/git_number.py +8 -2
  67. data/vendor/depot_tools/git_retry.py +21 -0
  68. data/vendor/depot_tools/gn.bat +4 -3
  69. data/vendor/depot_tools/infra/config/cq.cfg +1 -5
  70. data/vendor/depot_tools/infra/config/recipes.cfg +18 -16
  71. data/vendor/depot_tools/led +12 -0
  72. data/vendor/depot_tools/led.bat +7 -0
  73. data/vendor/depot_tools/man/html/git-cl.html +9 -1
  74. data/vendor/depot_tools/man/html/git-drover.html +22 -18
  75. data/vendor/depot_tools/man/man1/git-cl.1 +8 -3
  76. data/vendor/depot_tools/man/man1/git-drover.1 +22 -20
  77. data/vendor/depot_tools/man/src/git-cl.txt +3 -0
  78. data/vendor/depot_tools/man/src/git-drover.txt +8 -0
  79. data/vendor/depot_tools/my_activity.py +8 -5
  80. data/vendor/depot_tools/owners.py +103 -11
  81. data/vendor/depot_tools/owners_finder.py +14 -2
  82. data/vendor/depot_tools/presubmit_canned_checks.py +25 -67
  83. data/vendor/depot_tools/presubmit_support.py +87 -35
  84. data/vendor/depot_tools/recipes/OWNERS +2 -0
  85. data/vendor/depot_tools/recipes/README.recipes.md +842 -0
  86. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +5 -3
  87. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +181 -60
  88. data/vendor/depot_tools/recipes/recipe_modules/bot_update/{example.expected → examples/full.expected}/apply_gerrit_ref.json +4 -2
  89. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +82 -0
  90. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +149 -0
  91. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json +82 -0
  92. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +149 -0
  93. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +122 -0
  94. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +149 -0
  95. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +149 -0
  96. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_shallow.json +149 -0
  97. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +148 -0
  98. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange.json +150 -0
  99. data/vendor/depot_tools/recipes/recipe_modules/bot_update/{example.expected → examples/full.expected}/trychange_oauth2.json +0 -0
  100. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_buildbot.json +152 -0
  101. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json.json +150 -0
  102. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +150 -0
  103. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +156 -0
  104. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +91 -0
  105. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +118 -0
  106. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +118 -0
  107. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +202 -0
  108. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +158 -0
  109. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +196 -0
  110. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json +202 -0
  111. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +202 -0
  112. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +162 -0
  113. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +162 -0
  114. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +149 -0
  115. data/vendor/depot_tools/recipes/recipe_modules/bot_update/{example.py → examples/full.py} +46 -8
  116. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +139 -133
  117. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +25 -13
  118. data/vendor/depot_tools/recipes/recipe_modules/cipd/api.py +40 -9
  119. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/basic.json +0 -0
  120. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/basic_pkg.json +1 -1
  121. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/describe-failed.json +0 -0
  122. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/describe-many-instances.json +0 -0
  123. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/mac64.json +0 -0
  124. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/pkg_bad_file.json +1 -1
  125. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/pkg_bad_mode.json +0 -0
  126. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/pkg_bad_verfile.json +0 -0
  127. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.expected → examples/full.expected}/win64.json +0 -0
  128. data/vendor/depot_tools/recipes/recipe_modules/cipd/{example.py → examples/full.py} +1 -0
  129. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk arch.json +7 -0
  130. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk bits.json +7 -0
  131. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_32.json +14 -0
  132. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_64.json +14 -0
  133. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_32.json +14 -0
  134. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_64.json +14 -0
  135. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_mips_64.json +14 -0
  136. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/mac_intel_64.json +14 -0
  137. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_32.json +14 -0
  138. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_64.json +14 -0
  139. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.py +59 -0
  140. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +5 -0
  141. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/{example.expected → examples/full.expected}/basic.json +7 -0
  142. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/{example.expected → examples/full.expected}/win.json +7 -0
  143. data/vendor/depot_tools/recipes/recipe_modules/depot_tools/{example.py → examples/full.py} +2 -0
  144. data/vendor/depot_tools/recipes/recipe_modules/gclient/__init__.py +1 -4
  145. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +28 -14
  146. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +10 -235
  147. data/vendor/depot_tools/recipes/recipe_modules/gclient/{example.expected → examples/full.expected}/basic.json +9 -9
  148. data/vendor/depot_tools/recipes/recipe_modules/gclient/{example.expected → examples/full.expected}/buildbot.json +9 -9
  149. data/vendor/depot_tools/recipes/recipe_modules/gclient/{example.expected → examples/full.expected}/revision.json +9 -9
  150. data/vendor/depot_tools/recipes/recipe_modules/gclient/{example.expected → examples/full.expected}/tryserver.json +9 -9
  151. data/vendor/depot_tools/recipes/recipe_modules/gclient/{example.py → examples/full.py} +5 -21
  152. data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/patch_project.py +45 -0
  153. data/vendor/depot_tools/recipes/recipe_modules/gerrit/__init__.py +1 -0
  154. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +97 -2
  155. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +283 -0
  156. data/vendor/depot_tools/recipes/recipe_modules/gerrit/{example.py → examples/full.py} +31 -2
  157. data/vendor/depot_tools/recipes/recipe_modules/gerrit/test_api.py +30 -1
  158. data/vendor/depot_tools/recipes/recipe_modules/git/__init__.py +1 -4
  159. data/vendor/depot_tools/recipes/recipe_modules/git/api.py +7 -35
  160. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic.json +3 -3
  161. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic_branch.json +3 -3
  162. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic_file_name.json +3 -3
  163. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic_hash.json +3 -3
  164. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic_ref.json +3 -3
  165. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/basic_submodule_update_force.json +3 -3
  166. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/can_fail_build.json +1 -1
  167. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/cannot_fail_build.json +3 -3
  168. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/cat-file_test.json +3 -3
  169. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/count-objects_delta.json +3 -3
  170. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/count-objects_failed.json +3 -3
  171. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/count-objects_with_bad_output.json +3 -3
  172. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/count-objects_with_bad_output_fails_build.json +1 -1
  173. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/curl_trace_file.json +3 -3
  174. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/git-cache-checkout.json +6 -6
  175. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/platform_win.json +223 -0
  176. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/rebase_failed.json +3 -3
  177. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/remote_not_origin.json +3 -3
  178. data/vendor/depot_tools/recipes/recipe_modules/git/{example.expected → examples/full.expected}/set_got_revision.json +3 -3
  179. data/vendor/depot_tools/recipes/recipe_modules/git/{example.py → examples/full.py} +2 -1
  180. data/vendor/depot_tools/recipes/recipe_modules/git/resources/git_setup.py +12 -21
  181. data/vendor/depot_tools/recipes/recipe_modules/git_cl/__init__.py +1 -4
  182. data/vendor/depot_tools/recipes/recipe_modules/git_cl/api.py +13 -11
  183. data/vendor/depot_tools/recipes/recipe_modules/git_cl/{example.expected → examples/full.expected}/basic.json +0 -0
  184. data/vendor/depot_tools/recipes/recipe_modules/git_cl/{example.py → examples/full.py} +4 -2
  185. data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +3 -0
  186. data/vendor/depot_tools/recipes/recipe_modules/gitiles/__init__.py +7 -0
  187. data/vendor/depot_tools/recipes/recipe_modules/gitiles/api.py +135 -0
  188. data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.expected/basic.json +537 -0
  189. data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.py +61 -0
  190. data/vendor/depot_tools/recipes/recipe_modules/gitiles/resources/gerrit_client.py +192 -0
  191. data/vendor/depot_tools/recipes/recipe_modules/gitiles/test_api.py +95 -0
  192. data/vendor/depot_tools/recipes/recipe_modules/gsutil/{example.expected → examples/full.expected}/basic.json +0 -0
  193. data/vendor/depot_tools/recipes/recipe_modules/gsutil/{example.py → examples/full.py} +0 -0
  194. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/__init__.py +0 -3
  195. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/basic.json +3 -2
  196. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/paths_buildbot_linux.json +3 -2
  197. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/paths_buildbot_mac.json +3 -2
  198. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/paths_buildbot_win.json +3 -2
  199. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/paths_generic_linux.json +3 -2
  200. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.expected → examples/full.expected}/paths_generic_mac.json +3 -2
  201. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_win.json +16 -0
  202. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_linux.json +16 -0
  203. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_mac.json +16 -0
  204. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_win.json +16 -0
  205. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/{example.py → examples/full.py} +2 -1
  206. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/path_config.py +12 -3
  207. data/vendor/depot_tools/recipes/recipe_modules/presubmit/__init__.py +1 -0
  208. data/vendor/depot_tools/recipes/recipe_modules/presubmit/api.py +2 -2
  209. data/vendor/depot_tools/recipes/recipe_modules/presubmit/{example.expected → examples/full.expected}/basic.json +1 -1
  210. data/vendor/depot_tools/recipes/recipe_modules/presubmit/{example.py → examples/full.py} +0 -0
  211. data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -4
  212. data/vendor/depot_tools/recipes/recipe_modules/rietveld/{example.expected → examples/full.expected}/basic.json +0 -0
  213. data/vendor/depot_tools/recipes/recipe_modules/rietveld/{example.expected → examples/full.expected}/buildbot.json +0 -0
  214. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +27 -0
  215. data/vendor/depot_tools/recipes/recipe_modules/rietveld/{example.py → examples/full.py} +9 -1
  216. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +3 -5
  217. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +21 -96
  218. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/basic_tags.json +0 -0
  219. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/set_failure_hash_with_no_steps.json +0 -0
  220. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +56 -0
  221. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected/with_gerrit_patch_deprecated.json → examples/full.expected/with_git_patch.json} +2 -2
  222. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected/with_gerrit_patch.json → examples/full.expected/with_git_patch_luci.json} +2 -2
  223. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/with_rietveld_patch.json +0 -20
  224. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/with_rietveld_patch_new.json +0 -20
  225. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/with_wrong_patch.json +1 -13
  226. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.expected → examples/full.expected}/with_wrong_patch_new.json +1 -13
  227. data/vendor/depot_tools/recipes/recipe_modules/tryserver/{example.py → examples/full.py} +3 -17
  228. data/vendor/depot_tools/recipes/recipes.py +141 -96
  229. data/vendor/depot_tools/rietveld.py +8 -1
  230. data/vendor/depot_tools/roll-dep-svn.bat +12 -10
  231. data/vendor/depot_tools/roll-dep.bat +5 -3
  232. data/vendor/depot_tools/scm.py +8 -1
  233. data/vendor/depot_tools/setup_color.py +0 -0
  234. data/vendor/depot_tools/split_cl.py +193 -0
  235. data/vendor/depot_tools/third_party/schema/.editorconfig +15 -0
  236. data/vendor/depot_tools/third_party/schema/.gitignore +174 -0
  237. data/vendor/depot_tools/third_party/schema/.travis.yml +37 -0
  238. data/vendor/depot_tools/third_party/schema/LICENSE-MIT +19 -0
  239. data/vendor/depot_tools/third_party/schema/MANIFEST.in +1 -0
  240. data/vendor/depot_tools/third_party/schema/README.chromium +12 -0
  241. data/vendor/depot_tools/third_party/schema/README.rst +382 -0
  242. data/vendor/depot_tools/third_party/schema/__init__.py +1 -0
  243. data/vendor/depot_tools/third_party/schema/schema.py +338 -0
  244. data/vendor/depot_tools/third_party/schema/setup.cfg +5 -0
  245. data/vendor/depot_tools/third_party/schema/setup.py +30 -0
  246. data/vendor/depot_tools/third_party/schema/test_schema.py +556 -0
  247. data/vendor/depot_tools/third_party/schema/tox.ini +33 -0
  248. data/vendor/depot_tools/third_party/upload.py +4 -0
  249. data/vendor/depot_tools/update_depot_tools +4 -16
  250. data/vendor/depot_tools/update_depot_tools.bat +4 -17
  251. data/vendor/depot_tools/update_depot_tools_toggle.py +38 -0
  252. data/vendor/depot_tools/vpython +12 -0
  253. data/vendor/depot_tools/vpython.bat +7 -0
  254. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +17 -5
  255. data/vendor/depot_tools/win_toolchain/package_from_installed.py +63 -33
  256. metadata +161 -113
  257. data/vendor/depot_tools/bootstrap/gclient.bat +0 -22
  258. data/vendor/depot_tools/bootstrap/win/get_file.js +0 -119
  259. data/vendor/depot_tools/bootstrap/win/git_bootstrap.py +0 -193
  260. data/vendor/depot_tools/bootstrap/win/git_version.txt +0 -1
  261. data/vendor/depot_tools/bootstrap/win/git_version_bleeding_edge.txt +0 -1
  262. data/vendor/depot_tools/bootstrap/win/python276.new.bat +0 -8
  263. data/vendor/depot_tools/bootstrap/win/svn.new.bat +0 -4
  264. data/vendor/depot_tools/bootstrap/win/svnversion.new.bat +0 -4
  265. data/vendor/depot_tools/bootstrap/win/unzip.js +0 -91
  266. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/basic.json +0 -53
  267. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/basic_output_manifest.json +0 -60
  268. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +0 -54
  269. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/buildbot.json +0 -53
  270. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/clobber.json +0 -54
  271. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json +0 -54
  272. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +0 -54
  273. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/no_shallow.json +0 -54
  274. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +0 -53
  275. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/trychange.json +0 -55
  276. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json +0 -57
  277. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/trychange_oauth2_json.json +0 -55
  278. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/trychange_oauth2_json_win.json +0 -55
  279. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob.json +0 -59
  280. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_fail.json +0 -62
  281. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +0 -83
  282. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +0 -84
  283. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +0 -60
  284. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle_deprecated.json +0 -60
  285. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_v8.json +0 -62
  286. data/vendor/depot_tools/recipes/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +0 -62
  287. data/vendor/depot_tools/recipes/recipe_modules/gclient/bundle_extra_paths.txt +0 -4
  288. data/vendor/depot_tools/recipes/recipe_modules/gerrit/example.expected/basic.json +0 -66
  289. data/vendor/depot_tools/recipes/recipe_modules/git/bundle_extra_paths.txt +0 -28
  290. data/vendor/depot_tools/recipes/recipe_modules/git/example.expected/platform_win.json +0 -237
  291. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/example.expected/paths_generic_win.json +0 -15
  292. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/example.expected/paths_kitchen_linux.json +0 -15
  293. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/example.expected/paths_kitchen_mac.json +0 -15
  294. data/vendor/depot_tools/recipes/recipe_modules/infra_paths/example.expected/paths_kitchen_win.json +0 -15
  295. data/vendor/depot_tools/recipes/recipe_modules/presubmit/bundle_extra_paths.txt +0 -30
  296. data/vendor/depot_tools/recipes/recipe_modules/tryserver/example.expected/with_git_patch.json +0 -109
  297. data/vendor/depot_tools/recipes/recipe_modules/tryserver/example.expected/with_git_patch_luci.json +0 -8
@@ -0,0 +1,284 @@
1
+ # Copyright 2017 The Chromium Authors. All rights reserved.
2
+ # Use of this source code is governed by a BSD-style license that can be
3
+ # found in the LICENSE file.
4
+
5
+ import ast
6
+ import collections
7
+
8
+ from third_party import schema
9
+
10
+
11
+ # See https://github.com/keleshev/schema for docs how to configure schema.
12
+ _GCLIENT_DEPS_SCHEMA = {
13
+ schema.Optional(basestring): schema.Or(
14
+ None,
15
+ basestring,
16
+ {
17
+ # Repo and revision to check out under the path
18
+ # (same as if no dict was used).
19
+ 'url': basestring,
20
+
21
+ # Optional condition string. The dep will only be processed
22
+ # if the condition evaluates to True.
23
+ schema.Optional('condition'): basestring,
24
+ },
25
+ ),
26
+ }
27
+
28
+ _GCLIENT_HOOKS_SCHEMA = [{
29
+ # Hook action: list of command-line arguments to invoke.
30
+ 'action': [basestring],
31
+
32
+ # Name of the hook. Doesn't affect operation.
33
+ schema.Optional('name'): basestring,
34
+
35
+ # Hook pattern (regex). Originally intended to limit some hooks to run
36
+ # only when files matching the pattern have changed. In practice, with git,
37
+ # gclient runs all the hooks regardless of this field.
38
+ schema.Optional('pattern'): basestring,
39
+
40
+ # Working directory where to execute the hook.
41
+ schema.Optional('cwd'): basestring,
42
+
43
+ # Optional condition string. The hook will only be run
44
+ # if the condition evaluates to True.
45
+ schema.Optional('condition'): basestring,
46
+ }]
47
+
48
+ _GCLIENT_SCHEMA = schema.Schema({
49
+ # List of host names from which dependencies are allowed (whitelist).
50
+ # NOTE: when not present, all hosts are allowed.
51
+ # NOTE: scoped to current DEPS file, not recursive.
52
+ schema.Optional('allowed_hosts'): [schema.Optional(basestring)],
53
+
54
+ # Mapping from paths to repo and revision to check out under that path.
55
+ # Applying this mapping to the on-disk checkout is the main purpose
56
+ # of gclient, and also why the config file is called DEPS.
57
+ #
58
+ # The following functions are allowed:
59
+ #
60
+ # Var(): allows variable substitution (either from 'vars' dict below,
61
+ # or command-line override)
62
+ schema.Optional('deps'): _GCLIENT_DEPS_SCHEMA,
63
+
64
+ # Similar to 'deps' (see above) - also keyed by OS (e.g. 'linux').
65
+ # Also see 'target_os'.
66
+ schema.Optional('deps_os'): {
67
+ schema.Optional(basestring): _GCLIENT_DEPS_SCHEMA,
68
+ },
69
+
70
+ # Path to GN args file to write selected variables.
71
+ schema.Optional('gclient_gn_args_file'): basestring,
72
+
73
+ # Subset of variables to write to the GN args file (see above).
74
+ schema.Optional('gclient_gn_args'): [schema.Optional(basestring)],
75
+
76
+ # Hooks executed after gclient sync (unless suppressed), or explicitly
77
+ # on gclient hooks. See _GCLIENT_HOOKS_SCHEMA for details.
78
+ # Also see 'pre_deps_hooks'.
79
+ schema.Optional('hooks'): _GCLIENT_HOOKS_SCHEMA,
80
+
81
+ # Similar to 'hooks', also keyed by OS.
82
+ schema.Optional('hooks_os'): {
83
+ schema.Optional(basestring): _GCLIENT_HOOKS_SCHEMA
84
+ },
85
+
86
+ # Rules which #includes are allowed in the directory.
87
+ # Also see 'skip_child_includes' and 'specific_include_rules'.
88
+ schema.Optional('include_rules'): [schema.Optional(basestring)],
89
+
90
+ # Hooks executed before processing DEPS. See 'hooks' for more details.
91
+ schema.Optional('pre_deps_hooks'): _GCLIENT_HOOKS_SCHEMA,
92
+
93
+ # Recursion limit for nested DEPS.
94
+ schema.Optional('recursion'): int,
95
+
96
+ # Whitelists deps for which recursion should be enabled.
97
+ schema.Optional('recursedeps'): [
98
+ schema.Optional(schema.Or(
99
+ basestring,
100
+ (basestring, basestring),
101
+ [basestring, basestring]
102
+ )),
103
+ ],
104
+
105
+ # Blacklists directories for checking 'include_rules'.
106
+ schema.Optional('skip_child_includes'): [schema.Optional(basestring)],
107
+
108
+ # Mapping from paths to include rules specific for that path.
109
+ # See 'include_rules' for more details.
110
+ schema.Optional('specific_include_rules'): {
111
+ schema.Optional(basestring): [basestring]
112
+ },
113
+
114
+ # List of additional OS names to consider when selecting dependencies
115
+ # from deps_os.
116
+ schema.Optional('target_os'): [schema.Optional(basestring)],
117
+
118
+ # For recursed-upon sub-dependencies, check out their own dependencies
119
+ # relative to the paren't path, rather than relative to the .gclient file.
120
+ schema.Optional('use_relative_paths'): bool,
121
+
122
+ # Variables that can be referenced using Var() - see 'deps'.
123
+ schema.Optional('vars'): {schema.Optional(basestring): basestring},
124
+ })
125
+
126
+
127
+ def _gclient_eval(node_or_string, global_scope, filename='<unknown>'):
128
+ """Safely evaluates a single expression. Returns the result."""
129
+ _allowed_names = {'None': None, 'True': True, 'False': False}
130
+ if isinstance(node_or_string, basestring):
131
+ node_or_string = ast.parse(node_or_string, filename=filename, mode='eval')
132
+ if isinstance(node_or_string, ast.Expression):
133
+ node_or_string = node_or_string.body
134
+ def _convert(node):
135
+ if isinstance(node, ast.Str):
136
+ return node.s
137
+ elif isinstance(node, ast.Num):
138
+ return node.n
139
+ elif isinstance(node, ast.Tuple):
140
+ return tuple(map(_convert, node.elts))
141
+ elif isinstance(node, ast.List):
142
+ return list(map(_convert, node.elts))
143
+ elif isinstance(node, ast.Dict):
144
+ return collections.OrderedDict(
145
+ (_convert(k), _convert(v))
146
+ for k, v in zip(node.keys, node.values))
147
+ elif isinstance(node, ast.Name):
148
+ if node.id not in _allowed_names:
149
+ raise ValueError(
150
+ 'invalid name %r (file %r, line %s)' % (
151
+ node.id, filename, getattr(node, 'lineno', '<unknown>')))
152
+ return _allowed_names[node.id]
153
+ elif isinstance(node, ast.Call):
154
+ if not isinstance(node.func, ast.Name):
155
+ raise ValueError(
156
+ 'invalid call: func should be a name (file %r, line %s)' % (
157
+ filename, getattr(node, 'lineno', '<unknown>')))
158
+ if node.keywords or node.starargs or node.kwargs:
159
+ raise ValueError(
160
+ 'invalid call: use only regular args (file %r, line %s)' % (
161
+ filename, getattr(node, 'lineno', '<unknown>')))
162
+ args = map(_convert, node.args)
163
+ return global_scope[node.func.id](*args)
164
+ elif isinstance(node, ast.BinOp) and isinstance(node.op, ast.Add):
165
+ return _convert(node.left) + _convert(node.right)
166
+ elif isinstance(node, ast.BinOp) and isinstance(node.op, ast.Mod):
167
+ return _convert(node.left) % _convert(node.right)
168
+ else:
169
+ raise ValueError(
170
+ 'unexpected AST node: %s %s (file %r, line %s)' % (
171
+ node, ast.dump(node), filename,
172
+ getattr(node, 'lineno', '<unknown>')))
173
+ return _convert(node_or_string)
174
+
175
+
176
+ def Exec(content, global_scope, local_scope, filename='<unknown>'):
177
+ """Safely execs a set of assignments. Mutates |local_scope|."""
178
+ node_or_string = ast.parse(content, filename=filename, mode='exec')
179
+ if isinstance(node_or_string, ast.Expression):
180
+ node_or_string = node_or_string.body
181
+
182
+ def _visit_in_module(node):
183
+ if isinstance(node, ast.Assign):
184
+ if len(node.targets) != 1:
185
+ raise ValueError(
186
+ 'invalid assignment: use exactly one target (file %r, line %s)' % (
187
+ filename, getattr(node, 'lineno', '<unknown>')))
188
+ target = node.targets[0]
189
+ if not isinstance(target, ast.Name):
190
+ raise ValueError(
191
+ 'invalid assignment: target should be a name (file %r, line %s)' % (
192
+ filename, getattr(node, 'lineno', '<unknown>')))
193
+ value = _gclient_eval(node.value, global_scope, filename=filename)
194
+
195
+ if target.id in local_scope:
196
+ raise ValueError(
197
+ 'invalid assignment: overrides var %r (file %r, line %s)' % (
198
+ target.id, filename, getattr(node, 'lineno', '<unknown>')))
199
+
200
+ local_scope[target.id] = value
201
+ else:
202
+ raise ValueError(
203
+ 'unexpected AST node: %s %s (file %r, line %s)' % (
204
+ node, ast.dump(node), filename,
205
+ getattr(node, 'lineno', '<unknown>')))
206
+
207
+ if isinstance(node_or_string, ast.Module):
208
+ for stmt in node_or_string.body:
209
+ _visit_in_module(stmt)
210
+ else:
211
+ raise ValueError(
212
+ 'unexpected AST node: %s %s (file %r, line %s)' % (
213
+ node_or_string,
214
+ ast.dump(node_or_string),
215
+ filename,
216
+ getattr(node_or_string, 'lineno', '<unknown>')))
217
+
218
+ _GCLIENT_SCHEMA.validate(local_scope)
219
+
220
+
221
+ def EvaluateCondition(condition, variables, referenced_variables=None):
222
+ """Safely evaluates a boolean condition. Returns the result."""
223
+ if not referenced_variables:
224
+ referenced_variables = set()
225
+ _allowed_names = {'None': None, 'True': True, 'False': False}
226
+ main_node = ast.parse(condition, mode='eval')
227
+ if isinstance(main_node, ast.Expression):
228
+ main_node = main_node.body
229
+ def _convert(node):
230
+ if isinstance(node, ast.Str):
231
+ return node.s
232
+ elif isinstance(node, ast.Name):
233
+ if node.id in referenced_variables:
234
+ raise ValueError(
235
+ 'invalid cyclic reference to %r (inside %r)' % (
236
+ node.id, condition))
237
+ elif node.id in _allowed_names:
238
+ return _allowed_names[node.id]
239
+ elif node.id in variables:
240
+ return EvaluateCondition(
241
+ variables[node.id],
242
+ variables,
243
+ referenced_variables.union([node.id]))
244
+ else:
245
+ raise ValueError(
246
+ 'invalid name %r (inside %r)' % (node.id, condition))
247
+ elif isinstance(node, ast.BoolOp) and isinstance(node.op, ast.Or):
248
+ if len(node.values) != 2:
249
+ raise ValueError(
250
+ 'invalid "or": exactly 2 operands required (inside %r)' % (
251
+ condition))
252
+ return _convert(node.values[0]) or _convert(node.values[1])
253
+ elif isinstance(node, ast.BoolOp) and isinstance(node.op, ast.And):
254
+ if len(node.values) != 2:
255
+ raise ValueError(
256
+ 'invalid "and": exactly 2 operands required (inside %r)' % (
257
+ condition))
258
+ return _convert(node.values[0]) and _convert(node.values[1])
259
+ elif isinstance(node, ast.UnaryOp) and isinstance(node.op, ast.Not):
260
+ return not _convert(node.operand)
261
+ elif isinstance(node, ast.Compare):
262
+ if len(node.ops) != 1:
263
+ raise ValueError(
264
+ 'invalid compare: exactly 1 operator required (inside %r)' % (
265
+ condition))
266
+ if len(node.comparators) != 1:
267
+ raise ValueError(
268
+ 'invalid compare: exactly 1 comparator required (inside %r)' % (
269
+ condition))
270
+
271
+ left = _convert(node.left)
272
+ right = _convert(node.comparators[0])
273
+
274
+ if isinstance(node.ops[0], ast.Eq):
275
+ return left == right
276
+
277
+ raise ValueError(
278
+ 'unexpected operator: %s %s (inside %r)' % (
279
+ node.ops[0], ast.dump(node), condition))
280
+ else:
281
+ raise ValueError(
282
+ 'unexpected AST node: %s %s (inside %r)' % (
283
+ node, ast.dump(node), condition))
284
+ return _convert(main_node)
@@ -5,10 +5,12 @@
5
5
  """Generic utils."""
6
6
 
7
7
  import codecs
8
+ import collections
8
9
  import contextlib
9
10
  import cStringIO
10
11
  import datetime
11
12
  import logging
13
+ import operator
12
14
  import os
13
15
  import pipes
14
16
  import platform
@@ -611,8 +613,9 @@ def FindGclientRoot(from_dir, filename='.gclient'):
611
613
  # might have failed. In that case, we cannot verify that the .gclient
612
614
  # is the one we want to use. In order to not to cause too much trouble,
613
615
  # just issue a warning and return the path anyway.
614
- print >> sys.stderr, ("%s file in parent directory %s might not be the "
615
- "file you want to use" % (filename, path))
616
+ print >> sys.stderr, ("%s missing, %s file in parent directory %s might "
617
+ "not be the file you want to use." %
618
+ (entries_filename, filename, path))
616
619
  return path
617
620
  scope = {}
618
621
  try:
@@ -813,8 +816,7 @@ class ExecutionQueue(object):
813
816
  """Runs a set of WorkItem that have interdependencies and were WorkItem are
814
817
  added as they are processed.
815
818
 
816
- In gclient's case, Dependencies sometime needs to be run out of order due to
817
- From() keyword. This class manages that all the required dependencies are run
819
+ This class manages that all the required dependencies are run
818
820
  before running each one.
819
821
 
820
822
  Methods of this class are thread safe.
@@ -1237,3 +1239,67 @@ def FindExecutable(executable):
1237
1239
  if os.path.isfile(alt_target) and os.access(alt_target, os.X_OK):
1238
1240
  return alt_target
1239
1241
  return None
1242
+
1243
+
1244
+ def freeze(obj):
1245
+ """Takes a generic object ``obj``, and returns an immutable version of it.
1246
+
1247
+ Supported types:
1248
+ * dict / OrderedDict -> FrozenDict
1249
+ * list -> tuple
1250
+ * set -> frozenset
1251
+ * any object with a working __hash__ implementation (assumes that hashable
1252
+ means immutable)
1253
+
1254
+ Will raise TypeError if you pass an object which is not hashable.
1255
+ """
1256
+ if isinstance(obj, dict):
1257
+ return FrozenDict((freeze(k), freeze(v)) for k, v in obj.iteritems())
1258
+ elif isinstance(obj, (list, tuple)):
1259
+ return tuple(freeze(i) for i in obj)
1260
+ elif isinstance(obj, set):
1261
+ return frozenset(freeze(i) for i in obj)
1262
+ else:
1263
+ hash(obj)
1264
+ return obj
1265
+
1266
+
1267
+ class FrozenDict(collections.Mapping):
1268
+ """An immutable OrderedDict.
1269
+
1270
+ Modified From: http://stackoverflow.com/a/2704866
1271
+ """
1272
+ def __init__(self, *args, **kwargs):
1273
+ self._d = collections.OrderedDict(*args, **kwargs)
1274
+
1275
+ # Calculate the hash immediately so that we know all the items are
1276
+ # hashable too.
1277
+ self._hash = reduce(operator.xor,
1278
+ (hash(i) for i in enumerate(self._d.iteritems())), 0)
1279
+
1280
+ def __eq__(self, other):
1281
+ if not isinstance(other, collections.Mapping):
1282
+ return NotImplemented
1283
+ if self is other:
1284
+ return True
1285
+ if len(self) != len(other):
1286
+ return False
1287
+ for k, v in self.iteritems():
1288
+ if k not in other or other[k] != v:
1289
+ return False
1290
+ return True
1291
+
1292
+ def __iter__(self):
1293
+ return iter(self._d)
1294
+
1295
+ def __len__(self):
1296
+ return len(self._d)
1297
+
1298
+ def __getitem__(self, key):
1299
+ return self._d[key]
1300
+
1301
+ def __hash__(self):
1302
+ return self._hash
1303
+
1304
+ def __repr__(self):
1305
+ return 'FrozenDict(%r)' % (self._d.items(),)
@@ -63,6 +63,31 @@ def CMDbranch(parser, args):
63
63
  write_result(result, opt)
64
64
 
65
65
 
66
+ @subcommand.usage('[args ...]')
67
+ def CMDchanges(parser, args):
68
+ parser.add_option('-p', '--param', dest='params', action='append',
69
+ help='repeatable query parameter, format: -p key=value')
70
+ parser.add_option('-o', '--o-param', dest='o_params', action='append',
71
+ help='gerrit output parameters, e.g. ALL_REVISIONS')
72
+ parser.add_option('--limit', dest='limit', type=int,
73
+ help='maximum number of results to return')
74
+ parser.add_option('--start', dest='start', type=int,
75
+ help='how many changes to skip '
76
+ '(starting with the most recent)')
77
+
78
+ (opt, args) = parser.parse_args(args)
79
+
80
+ result = gerrit_util.QueryChanges(
81
+ urlparse.urlparse(opt.host).netloc,
82
+ list(tuple(p.split('=', 1)) for p in opt.params),
83
+ start=opt.start, # Default: None
84
+ limit=opt.limit, # Default: None
85
+ o_params=opt.o_params, # Default: None
86
+ )
87
+ logging.info('Change query returned %d changes.', len(result))
88
+ write_result(result, opt)
89
+
90
+
66
91
  class OptionParser(optparse.OptionParser):
67
92
  """Creates the option parse and add --verbose support."""
68
93
  def __init__(self, *args, **kwargs):
@@ -102,4 +127,4 @@ if __name__ == '__main__':
102
127
  sys.exit(main(sys.argv[1:]))
103
128
  except KeyboardInterrupt:
104
129
  sys.stderr.write('interrupted\n')
105
- sys.exit(1)
130
+ sys.exit(1)
@@ -50,13 +50,13 @@ class GerritAuthenticationError(GerritError):
50
50
  """Exception class for authentication errors during Gerrit communication."""
51
51
 
52
52
 
53
- def _QueryString(param_dict, first_param=None):
53
+ def _QueryString(params, first_param=None):
54
54
  """Encodes query parameters in the key:val[+key:val...] format specified here:
55
55
 
56
56
  https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#list-changes
57
57
  """
58
58
  q = [urllib.quote(first_param)] if first_param else []
59
- q.extend(['%s:%s' % (key, val) for key, val in param_dict.iteritems()])
59
+ q.extend(['%s:%s' % (key, val) for key, val in params])
60
60
  return '+'.join(q)
61
61
 
62
62
 
@@ -98,6 +98,15 @@ class CookiesAuthenticator(Authenticator):
98
98
  self.netrc = self._get_netrc()
99
99
  self.gitcookies = self._get_gitcookies()
100
100
 
101
+ @classmethod
102
+ def get_new_password_url(cls, host):
103
+ assert not host.startswith('http')
104
+ # Assume *.googlesource.com pattern.
105
+ parts = host.split('.')
106
+ if not parts[0].endswith('-review'):
107
+ parts[0] += '-review'
108
+ return 'https://%s/new-password' % ('.'.join(parts))
109
+
101
110
  @classmethod
102
111
  def get_new_password_message(cls, host):
103
112
  assert not host.startswith('http')
@@ -323,18 +332,15 @@ def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
323
332
  return conn
324
333
 
325
334
 
326
- def ReadHttpResponse(conn, expect_status=200, ignore_404=True):
335
+ def ReadHttpResponse(conn, accept_statuses=frozenset([200])):
327
336
  """Reads an http response from a connection into a string buffer.
328
337
 
329
338
  Args:
330
339
  conn: An Http object created by CreateHttpConn above.
331
- expect_status: Success is indicated by this status in the response.
332
- ignore_404: For many requests, gerrit-on-borg will return 404 if the request
333
- doesn't match the database contents. In most such cases, we
334
- want the API to return None rather than raise an Exception.
340
+ accept_statuses: Treat any of these statuses as success. Default: [200]
341
+ Common additions include 204, 400, and 404.
335
342
  Returns: A string buffer containing the connection's reply.
336
343
  """
337
-
338
344
  sleep_time = 0.5
339
345
  for idx in range(TRY_LIMIT):
340
346
  response, contents = conn.request(**conn.req_params)
@@ -345,12 +351,14 @@ def ReadHttpResponse(conn, expect_status=200, ignore_404=True):
345
351
  www_authenticate):
346
352
  auth_match = re.search('realm="([^"]+)"', www_authenticate, re.I)
347
353
  host = auth_match.group(1) if auth_match else conn.req_host
348
- reason = ('Authentication failed. Please make sure your .netrc file '
354
+ reason = ('Authentication failed. Please make sure your .gitcookies file '
349
355
  'has credentials for %s' % host)
350
356
  raise GerritAuthenticationError(response.status, reason)
351
357
 
352
358
  # If response.status < 500 then the result is final; break retry loop.
353
- if response.status < 500:
359
+ # If the response is 404, it might be because of replication lag, so
360
+ # keep trying anyway.
361
+ if response.status < 500 and response.status != 404:
354
362
  LOGGER.debug('got response %d for %s %s', response.status,
355
363
  conn.req_params['method'], conn.req_params['uri'])
356
364
  break
@@ -359,24 +367,25 @@ def ReadHttpResponse(conn, expect_status=200, ignore_404=True):
359
367
  LOGGER.warn('A transient error occurred while querying %s:\n'
360
368
  '%s %s %s\n'
361
369
  '%s %d %s',
362
- conn.host, conn.req_params['method'], conn.req_params['uri'],
370
+ conn.req_host, conn.req_params['method'],
371
+ conn.req_params['uri'],
363
372
  http_version, http_version, response.status, response.reason)
364
373
  if TRY_LIMIT - idx > 1:
365
374
  LOGGER.warn('... will retry %d more times.', TRY_LIMIT - idx - 1)
366
375
  time.sleep(sleep_time)
367
376
  sleep_time = sleep_time * 2
368
- if ignore_404 and response.status == 404:
369
- return StringIO()
370
- if response.status != expect_status:
377
+ if response.status not in accept_statuses:
378
+ if response.status in (401, 403):
379
+ print('Your Gerrit credentials might be misconfigured. Try: \n'
380
+ ' git cl creds-check')
371
381
  reason = '%s: %s' % (response.reason, contents)
372
382
  raise GerritError(response.status, reason)
373
383
  return StringIO(contents)
374
384
 
375
385
 
376
- def ReadHttpJsonResponse(conn, expect_status=200, ignore_404=True):
386
+ def ReadHttpJsonResponse(conn, accept_statuses=frozenset([200])):
377
387
  """Parses an https response as json."""
378
- fh = ReadHttpResponse(
379
- conn, expect_status=expect_status, ignore_404=ignore_404)
388
+ fh = ReadHttpResponse(conn, accept_statuses)
380
389
  # The first line of the response should always be: )]}'
381
390
  s = fh.readline()
382
391
  if s and s.rstrip() != ")]}'":
@@ -387,14 +396,15 @@ def ReadHttpJsonResponse(conn, expect_status=200, ignore_404=True):
387
396
  return json.loads(s)
388
397
 
389
398
 
390
- def QueryChanges(host, param_dict, first_param=None, limit=None, o_params=None,
399
+ def QueryChanges(host, params, first_param=None, limit=None, o_params=None,
391
400
  start=None):
392
401
  """
393
402
  Queries a gerrit-on-borg server for changes matching query terms.
394
403
 
395
404
  Args:
396
- param_dict: A dictionary of search parameters, as documented here:
397
- http://gerrit-documentation.googlecode.com/svn/Documentation/2.6/user-search.html
405
+ params: A list of key:value pairs for search parameters, as documented
406
+ here (e.g. ('is', 'owner') for a parameter 'is:owner'):
407
+ https://gerrit-review.googlesource.com/Documentation/user-search.html#search-operators
398
408
  first_param: A change identifier
399
409
  limit: Maximum number of results to return.
400
410
  start: how many changes to skip (starting with the most recent)
@@ -404,20 +414,19 @@ def QueryChanges(host, param_dict, first_param=None, limit=None, o_params=None,
404
414
  A list of json-decoded query results.
405
415
  """
406
416
  # Note that no attempt is made to escape special characters; YMMV.
407
- if not param_dict and not first_param:
417
+ if not params and not first_param:
408
418
  raise RuntimeError('QueryChanges requires search parameters')
409
- path = 'changes/?q=%s' % _QueryString(param_dict, first_param)
419
+ path = 'changes/?q=%s' % _QueryString(params, first_param)
410
420
  if start:
411
421
  path = '%s&start=%s' % (path, start)
412
422
  if limit:
413
423
  path = '%s&n=%d' % (path, limit)
414
424
  if o_params:
415
425
  path = '%s&%s' % (path, '&'.join(['o=%s' % p for p in o_params]))
416
- # Don't ignore 404; a query should always return a list, even if it's empty.
417
- return ReadHttpJsonResponse(CreateHttpConn(host, path), ignore_404=False)
426
+ return ReadHttpJsonResponse(CreateHttpConn(host, path))
418
427
 
419
428
 
420
- def GenerateAllChanges(host, param_dict, first_param=None, limit=500,
429
+ def GenerateAllChanges(host, params, first_param=None, limit=500,
421
430
  o_params=None, start=None):
422
431
  """
423
432
  Queries a gerrit-on-borg server for all the changes matching the query terms.
@@ -430,7 +439,7 @@ def GenerateAllChanges(host, param_dict, first_param=None, limit=500,
430
439
  limit.
431
440
 
432
441
  Args:
433
- param_dict, first_param: Refer to QueryChanges().
442
+ params, first_param: Refer to QueryChanges().
434
443
  limit: Maximum number of requested changes per query.
435
444
  o_params: Refer to QueryChanges().
436
445
  start: Refer to QueryChanges().
@@ -458,7 +467,7 @@ def GenerateAllChanges(host, param_dict, first_param=None, limit=500,
458
467
  # > E get's updated. New order: EABCDFGH
459
468
  # query[3..6] => CDF # C is a dup
460
469
  # query[6..9] => GH # E is missed.
461
- page = QueryChanges(host, param_dict, first_param, limit, o_params,
470
+ page = QueryChanges(host, params, first_param, limit, o_params,
462
471
  cur_start)
463
472
  for cl in at_most_once(page):
464
473
  yield cl
@@ -475,20 +484,20 @@ def GenerateAllChanges(host, param_dict, first_param=None, limit=500,
475
484
  # If we paged through, query again the first page which in most circumstances
476
485
  # will fetch all changes that were modified while this function was run.
477
486
  if start != cur_start:
478
- page = QueryChanges(host, param_dict, first_param, limit, o_params, start)
487
+ page = QueryChanges(host, params, first_param, limit, o_params, start)
479
488
  for cl in at_most_once(page):
480
489
  yield cl
481
490
 
482
491
 
483
- def MultiQueryChanges(host, param_dict, change_list, limit=None, o_params=None,
492
+ def MultiQueryChanges(host, params, change_list, limit=None, o_params=None,
484
493
  start=None):
485
494
  """Initiate a query composed of multiple sets of query parameters."""
486
495
  if not change_list:
487
496
  raise RuntimeError(
488
497
  "MultiQueryChanges requires a list of change numbers/id's")
489
498
  q = ['q=%s' % '+OR+'.join([urllib.quote(str(x)) for x in change_list])]
490
- if param_dict:
491
- q.append(_QueryString(param_dict))
499
+ if params:
500
+ q.append(_QueryString(params))
492
501
  if limit:
493
502
  q.append('n=%d' % limit)
494
503
  if start:
@@ -497,7 +506,7 @@ def MultiQueryChanges(host, param_dict, change_list, limit=None, o_params=None,
497
506
  q.extend(['o=%s' % p for p in o_params])
498
507
  path = 'changes/?%s' % '&'.join(q)
499
508
  try:
500
- result = ReadHttpJsonResponse(CreateHttpConn(host, path), ignore_404=False)
509
+ result = ReadHttpJsonResponse(CreateHttpConn(host, path))
501
510
  except GerritError as e:
502
511
  msg = '%s:\n%s' % (e.message, path)
503
512
  raise GerritError(e.http_status, msg)
@@ -525,13 +534,12 @@ def GetChange(host, change):
525
534
  return ReadHttpJsonResponse(CreateHttpConn(host, path))
526
535
 
527
536
 
528
- def GetChangeDetail(host, change, o_params=None, ignore_404=True):
537
+ def GetChangeDetail(host, change, o_params=None):
529
538
  """Query a gerrit server for extended information about a single change."""
530
- # TODO(tandrii): cahnge ignore_404 to False by default.
531
539
  path = 'changes/%s/detail' % change
532
540
  if o_params:
533
541
  path += '?%s' % '&'.join(['o=%s' % p for p in o_params])
534
- return ReadHttpJsonResponse(CreateHttpConn(host, path), ignore_404=ignore_404)
542
+ return ReadHttpJsonResponse(CreateHttpConn(host, path))
535
543
 
536
544
 
537
545
  def GetChangeCommit(host, change, revision='current'):
@@ -542,12 +550,12 @@ def GetChangeCommit(host, change, revision='current'):
542
550
 
543
551
  def GetChangeCurrentRevision(host, change):
544
552
  """Get information about the latest revision for a given change."""
545
- return QueryChanges(host, {}, change, o_params=('CURRENT_REVISION',))
553
+ return QueryChanges(host, [], change, o_params=('CURRENT_REVISION',))
546
554
 
547
555
 
548
556
  def GetChangeRevisions(host, change):
549
557
  """Get information about all revisions associated with a change."""
550
- return QueryChanges(host, {}, change, o_params=('ALL_REVISIONS',))
558
+ return QueryChanges(host, [], change, o_params=('ALL_REVISIONS',))
551
559
 
552
560
 
553
561
  def GetChangeReview(host, change, revision=None):
@@ -563,12 +571,18 @@ def GetChangeReview(host, change, revision=None):
563
571
  return ReadHttpJsonResponse(CreateHttpConn(host, path))
564
572
 
565
573
 
574
+ def GetChangeComments(host, change):
575
+ """Get the line- and file-level comments on a change."""
576
+ path = 'changes/%s/comments' % change
577
+ return ReadHttpJsonResponse(CreateHttpConn(host, path))
578
+
579
+
566
580
  def AbandonChange(host, change, msg=''):
567
581
  """Abandon a gerrit change."""
568
582
  path = 'changes/%s/abandon' % change
569
583
  body = {'message': msg} if msg else {}
570
584
  conn = CreateHttpConn(host, path, reqtype='POST', body=body)
571
- return ReadHttpJsonResponse(conn, ignore_404=False)
585
+ return ReadHttpJsonResponse(conn)
572
586
 
573
587
 
574
588
  def RestoreChange(host, change, msg=''):
@@ -576,7 +590,7 @@ def RestoreChange(host, change, msg=''):
576
590
  path = 'changes/%s/restore' % change
577
591
  body = {'message': msg} if msg else {}
578
592
  conn = CreateHttpConn(host, path, reqtype='POST', body=body)
579
- return ReadHttpJsonResponse(conn, ignore_404=False)
593
+ return ReadHttpJsonResponse(conn)
580
594
 
581
595
 
582
596
  def SubmitChange(host, change, wait_for_merge=True):
@@ -584,75 +598,41 @@ def SubmitChange(host, change, wait_for_merge=True):
584
598
  path = 'changes/%s/submit' % change
585
599
  body = {'wait_for_merge': wait_for_merge}
586
600
  conn = CreateHttpConn(host, path, reqtype='POST', body=body)
587
- return ReadHttpJsonResponse(conn, ignore_404=False)
601
+ return ReadHttpJsonResponse(conn)
588
602
 
589
603
 
590
604
  def HasPendingChangeEdit(host, change):
591
605
  conn = CreateHttpConn(host, 'changes/%s/edit' % change)
592
606
  try:
593
- ReadHttpResponse(conn, ignore_404=False)
607
+ ReadHttpResponse(conn)
594
608
  except GerritError as e:
595
- # On success, gerrit returns status 204; anything else is an error.
596
- if e.http_status != 204:
597
- raise
598
- return False
599
- else:
600
- return True
609
+ # 204 No Content means no pending change.
610
+ if e.http_status == 204:
611
+ return False
612
+ raise
613
+ return True
601
614
 
602
615
 
603
616
  def DeletePendingChangeEdit(host, change):
604
617
  conn = CreateHttpConn(host, 'changes/%s/edit' % change, reqtype='DELETE')
605
- try:
606
- ReadHttpResponse(conn, ignore_404=False)
607
- except GerritError as e:
608
- # On success, gerrit returns status 204; if the edit was already deleted it
609
- # returns 404. Anything else is an error.
610
- if e.http_status not in (204, 404):
611
- raise
618
+ # On success, gerrit returns status 204; if the edit was already deleted it
619
+ # returns 404. Anything else is an error.
620
+ ReadHttpResponse(conn, accept_statuses=[204, 404])
612
621
 
613
622
 
614
623
  def SetCommitMessage(host, change, description, notify='ALL'):
615
624
  """Updates a commit message."""
625
+ assert notify in ('ALL', 'NONE')
626
+ path = 'changes/%s/message' % change
627
+ body = {'message': description}
628
+ conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
616
629
  try:
617
- assert notify in ('ALL', 'NONE')
618
- # First, edit the commit message in a draft.
619
- path = 'changes/%s/edit:message' % change
620
- body = {'message': description}
621
- conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
622
- try:
623
- ReadHttpResponse(conn, ignore_404=False)
624
- except GerritError as e:
625
- # On success, gerrit returns status 204; anything else is an error.
626
- if e.http_status != 204:
627
- raise
628
- else:
629
- raise GerritError(
630
- 'Unexpectedly received a 200 http status while editing message in '
631
- 'change %s' % change)
632
-
633
- # And then publish it.
634
- path = 'changes/%s/edit:publish' % change
635
- conn = CreateHttpConn(host, path, reqtype='POST', body={'notify': notify})
636
- try:
637
- ReadHttpResponse(conn, ignore_404=False)
638
- except GerritError as e:
639
- # On success, gerrit returns status 204; anything else is an error.
640
- if e.http_status != 204:
641
- raise
642
- else:
643
- raise GerritError(
644
- 'Unexpectedly received a 200 http status while publishing message '
645
- 'change in %s' % change)
646
- except (GerritError, KeyboardInterrupt) as e:
647
- # Something went wrong with one of the two calls, so we want to clean up
648
- # after ourselves before returning.
649
- try:
650
- DeletePendingChangeEdit(host, change)
651
- except GerritError:
652
- LOGGER.error('Encountered error while cleaning up after failed attempt '
653
- 'to set the CL description. You may have to delete the '
654
- 'pending change edit yourself in the web UI.')
655
- raise e
630
+ ReadHttpResponse(conn, accept_statuses=[200, 204])
631
+ except GerritError as e:
632
+ raise GerritError(
633
+ e.http_status,
634
+ 'Received unexpected http status while editing message '
635
+ 'in change %s' % change)
656
636
 
657
637
 
658
638
  def GetReviewers(host, change):
@@ -667,32 +647,46 @@ def GetReview(host, change, revision):
667
647
  return ReadHttpJsonResponse(CreateHttpConn(host, path))
668
648
 
669
649
 
670
- def AddReviewers(host, change, add=None, is_reviewer=True, notify=True):
650
+ def AddReviewers(host, change, reviewers=None, ccs=None, notify=True,
651
+ accept_statuses=frozenset([200, 400, 422])):
671
652
  """Add reviewers to a change."""
672
- errors = None
673
- if not add:
653
+ if not reviewers and not ccs:
674
654
  return None
675
- if isinstance(add, basestring):
676
- add = (add,)
677
- path = 'changes/%s/reviewers' % change
678
- for r in add:
679
- state = 'REVIEWER' if is_reviewer else 'CC'
680
- notify = 'ALL' if notify else 'NONE'
681
- body = {
682
- 'reviewer': r,
683
- 'state': state,
684
- 'notify': notify,
685
- }
686
- try:
687
- conn = CreateHttpConn(host, path, reqtype='POST', body=body)
688
- _ = ReadHttpJsonResponse(conn, ignore_404=False)
689
- except GerritError as e:
690
- if e.http_status == 422: # "Unprocessable Entity"
691
- LOGGER.warn('Note: "%s" not added as a %s' % (r, state.lower()))
692
- errors = True
693
- else:
694
- raise
695
- return errors
655
+ if not change:
656
+ return None
657
+ reviewers = frozenset(reviewers or [])
658
+ ccs = frozenset(ccs or [])
659
+ path = 'changes/%s/revisions/current/review' % change
660
+
661
+ body = {
662
+ 'reviewers': [],
663
+ 'notify': 'ALL' if notify else 'NONE',
664
+ }
665
+ for r in sorted(reviewers | ccs):
666
+ state = 'REVIEWER' if r in reviewers else 'CC'
667
+ body['reviewers'].append({
668
+ 'reviewer': r,
669
+ 'state': state,
670
+ 'notify': 'NONE', # We handled `notify` argument above.
671
+ })
672
+
673
+ conn = CreateHttpConn(host, path, reqtype='POST', body=body)
674
+ # Gerrit will return 400 if one or more of the requested reviewers are
675
+ # unprocessable. We read the response object to see which were rejected,
676
+ # warn about them, and retry with the remainder.
677
+ resp = ReadHttpJsonResponse(conn, accept_statuses=accept_statuses)
678
+
679
+ errored = set()
680
+ for result in resp.get('reviewers', {}).itervalues():
681
+ r = result.get('input')
682
+ state = 'REVIEWER' if r in reviewers else 'CC'
683
+ if result.get('error'):
684
+ errored.add(r)
685
+ LOGGER.warn('Note: "%s" not added as a %s' % (r, state.lower()))
686
+ if errored:
687
+ # Try again, adding only those that didn't fail, and only accepting 200.
688
+ AddReviewers(host, change, reviewers=(reviewers-errored),
689
+ ccs=(ccs-errored), notify=notify, accept_statuses=[200])
696
690
 
697
691
 
698
692
  def RemoveReviewers(host, change, remove=None):
@@ -705,18 +699,15 @@ def RemoveReviewers(host, change, remove=None):
705
699
  path = 'changes/%s/reviewers/%s' % (change, r)
706
700
  conn = CreateHttpConn(host, path, reqtype='DELETE')
707
701
  try:
708
- ReadHttpResponse(conn, ignore_404=False)
702
+ ReadHttpResponse(conn, accept_statuses=[204])
709
703
  except GerritError as e:
710
- # On success, gerrit returns status 204; anything else is an error.
711
- if e.http_status != 204:
712
- raise
713
- else:
714
704
  raise GerritError(
715
- 'Unexpectedly received a 200 http status while deleting reviewer "%s"'
716
- ' from change %s' % (r, change))
705
+ e.http_status,
706
+ 'Received unexpected http status while deleting reviewer "%s" '
707
+ 'from change %s' % (r, change))
717
708
 
718
709
 
719
- def SetReview(host, change, msg=None, labels=None, notify=None):
710
+ def SetReview(host, change, msg=None, labels=None, notify=None, ready=None):
720
711
  """Set labels and/or add a message to a code review."""
721
712
  if not msg and not labels:
722
713
  return
@@ -727,7 +718,9 @@ def SetReview(host, change, msg=None, labels=None, notify=None):
727
718
  if labels:
728
719
  body['labels'] = labels
729
720
  if notify:
730
- body['notify'] = notify
721
+ body['notify'] = 'ALL' if notify else 'NONE'
722
+ if ready:
723
+ body['ready'] = True
731
724
  conn = CreateHttpConn(host, path, reqtype='POST', body=body)
732
725
  response = ReadHttpJsonResponse(conn)
733
726
  if labels:
@@ -794,7 +787,7 @@ def CreateGerritBranch(host, project, branch, commit):
794
787
  path = 'projects/%s/branches/%s' % (project, branch)
795
788
  body = {'revision': commit}
796
789
  conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
797
- response = ReadHttpJsonResponse(conn)
790
+ response = ReadHttpJsonResponse(conn, accept_statuses=[201])
798
791
  if response:
799
792
  return response
800
793
  raise GerritError(200, 'Unable to create gerrit branch')