libv8 5.3.332.38.5 → 5.6.326.50.0beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (352) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +2 -0
  4. data/ext/libv8/builder.rb +2 -2
  5. data/lib/libv8/version.rb +1 -1
  6. data/patches/0001-Build-a-standalone-static-library.patch +4 -4
  7. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +16 -11
  8. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +4 -4
  9. data/patches/{0005-Do-not-embed-debug-symbols-in-macOS-libraries.patch → 0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch} +4 -4
  10. data/vendor/depot_tools/.gitignore +4 -0
  11. data/vendor/depot_tools/OWNERS +0 -2
  12. data/vendor/depot_tools/PRESUBMIT.py +20 -23
  13. data/vendor/depot_tools/README.gclient.md +3 -3
  14. data/vendor/depot_tools/README.git-cl.md +13 -12
  15. data/vendor/depot_tools/README.md +2 -3
  16. data/vendor/depot_tools/WATCHLISTS +0 -1
  17. data/vendor/depot_tools/appengine_mapper.py +23 -0
  18. data/vendor/depot_tools/apply_issue.py +2 -8
  19. data/vendor/depot_tools/bootstrap/win/README.md +1 -8
  20. data/vendor/depot_tools/bootstrap/win/git_bootstrap.py +6 -16
  21. data/vendor/depot_tools/bootstrap/win/git_version.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/git_version_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/checkout.py +20 -433
  24. data/vendor/depot_tools/cipd +73 -0
  25. data/vendor/depot_tools/cipd.bat +12 -0
  26. data/vendor/depot_tools/cipd.ps1 +57 -0
  27. data/vendor/depot_tools/cipd_client_version +1 -0
  28. data/vendor/depot_tools/clang_format.py +9 -6
  29. data/vendor/depot_tools/clang_format_merge_driver +8 -0
  30. data/vendor/depot_tools/clang_format_merge_driver.bat +11 -0
  31. data/vendor/depot_tools/clang_format_merge_driver.py +67 -0
  32. data/vendor/depot_tools/codereview.settings +3 -2
  33. data/vendor/depot_tools/commit_queue.py +1 -1
  34. data/vendor/depot_tools/cpplint.py +2 -0
  35. data/vendor/depot_tools/fetch.py +1 -54
  36. data/vendor/depot_tools/fetch_configs/android.py +2 -2
  37. data/vendor/depot_tools/fetch_configs/breakpad.py +2 -3
  38. data/vendor/depot_tools/fetch_configs/chromium.py +2 -3
  39. data/vendor/depot_tools/fetch_configs/crashpad.py +2 -2
  40. data/vendor/depot_tools/fetch_configs/dart.py +2 -3
  41. data/vendor/depot_tools/fetch_configs/dartino.py +2 -3
  42. data/vendor/depot_tools/fetch_configs/dartium.py +2 -3
  43. data/vendor/depot_tools/fetch_configs/depot_tools.py +3 -6
  44. data/vendor/depot_tools/fetch_configs/gyp.py +2 -3
  45. data/vendor/depot_tools/fetch_configs/infra.py +2 -2
  46. data/vendor/depot_tools/fetch_configs/infra_internal.py +2 -2
  47. data/vendor/depot_tools/fetch_configs/ios.py +2 -2
  48. data/vendor/depot_tools/fetch_configs/ios_internal.py +2 -3
  49. data/vendor/depot_tools/fetch_configs/mojo.py +2 -3
  50. data/vendor/depot_tools/fetch_configs/nacl.py +2 -3
  51. data/vendor/depot_tools/fetch_configs/naclports.py +2 -3
  52. data/vendor/depot_tools/fetch_configs/pdfium.py +2 -2
  53. data/vendor/depot_tools/fetch_configs/skia.py +2 -2
  54. data/vendor/depot_tools/fetch_configs/skia_buildbot.py +2 -2
  55. data/vendor/depot_tools/fetch_configs/syzygy.py +2 -2
  56. data/vendor/depot_tools/fetch_configs/v8.py +2 -3
  57. data/vendor/depot_tools/fetch_configs/webrtc.py +5 -3
  58. data/vendor/depot_tools/fetch_configs/webrtc_android.py +2 -2
  59. data/vendor/depot_tools/fetch_configs/webrtc_ios.py +2 -2
  60. data/vendor/depot_tools/fix_encoding.py +6 -6
  61. data/vendor/depot_tools/gclient.py +136 -368
  62. data/vendor/depot_tools/gclient_scm.py +108 -647
  63. data/vendor/depot_tools/gclient_utils.py +22 -86
  64. data/vendor/depot_tools/gerrit_client.py +105 -0
  65. data/vendor/depot_tools/gerrit_util.py +174 -67
  66. data/vendor/depot_tools/git-crrev-parse +6 -7
  67. data/vendor/depot_tools/git-gs +1 -1
  68. data/vendor/depot_tools/git_cache.py +68 -18
  69. data/vendor/depot_tools/git_cherry_pick_upload.py +4 -4
  70. data/vendor/depot_tools/git_cl.py +1028 -961
  71. data/vendor/depot_tools/git_common.py +2 -3
  72. data/vendor/depot_tools/git_drover.py +0 -1
  73. data/vendor/depot_tools/git_footers.py +3 -43
  74. data/vendor/depot_tools/git_rebase_update.py +9 -1
  75. data/vendor/depot_tools/git_squash_branch.py +1 -1
  76. data/vendor/depot_tools/infra/config/cq.cfg +8 -1
  77. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  78. data/vendor/depot_tools/man/html/depot_tools.html +3 -11
  79. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +9 -9
  80. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +2 -2
  81. data/vendor/depot_tools/man/html/git-drover.html +17 -17
  82. data/vendor/depot_tools/man/html/git-footers.html +2 -2
  83. data/vendor/depot_tools/man/html/git-freeze.html +4 -4
  84. data/vendor/depot_tools/man/html/git-hyper-blame.html +2 -2
  85. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  86. data/vendor/depot_tools/man/html/git-map.html +2 -2
  87. data/vendor/depot_tools/man/html/git-mark-merge-base.html +2 -2
  88. data/vendor/depot_tools/man/html/git-nav-downstream.html +2 -2
  89. data/vendor/depot_tools/man/html/git-nav-upstream.html +2 -2
  90. data/vendor/depot_tools/man/html/git-new-branch.html +2 -2
  91. data/vendor/depot_tools/man/html/git-rebase-update.html +2 -2
  92. data/vendor/depot_tools/man/html/git-rename-branch.html +2 -2
  93. data/vendor/depot_tools/man/html/git-reparent-branch.html +2 -2
  94. data/vendor/depot_tools/man/html/git-retry.html +3 -3
  95. data/vendor/depot_tools/man/html/git-squash-branch.html +3 -3
  96. data/vendor/depot_tools/man/html/git-thaw.html +2 -2
  97. data/vendor/depot_tools/man/html/git-upstream-diff.html +3 -3
  98. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +4 -4
  99. data/vendor/depot_tools/man/man1/git-drover.1 +19 -19
  100. data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
  101. data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
  102. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  103. data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
  104. data/vendor/depot_tools/man/man1/git-map.1 +4 -4
  105. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  106. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +4 -4
  107. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +4 -4
  108. data/vendor/depot_tools/man/man1/git-new-branch.1 +4 -4
  109. data/vendor/depot_tools/man/man1/git-rebase-update.1 +4 -4
  110. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  111. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  112. data/vendor/depot_tools/man/man1/git-retry.1 +5 -5
  113. data/vendor/depot_tools/man/man1/git-squash-branch.1 +5 -5
  114. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  115. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +5 -5
  116. data/vendor/depot_tools/man/man7/depot_tools.7 +5 -10
  117. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +4 -4
  118. data/vendor/depot_tools/man/src/depot_tools.txt +1 -1
  119. data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +7 -7
  120. data/vendor/depot_tools/man/src/filter_demo_output.py +2 -2
  121. data/vendor/depot_tools/man/src/git-footers.demo.1.sh +1 -1
  122. data/vendor/depot_tools/man/src/git-retry.txt +1 -1
  123. data/vendor/depot_tools/man/src/git-squash-branch.txt +2 -2
  124. data/vendor/depot_tools/man/src/git-upstream-diff.txt +1 -1
  125. data/vendor/depot_tools/my_activity.py +6 -3
  126. data/vendor/depot_tools/my_reviews.py +1 -1
  127. data/vendor/depot_tools/ninja +2 -2
  128. data/vendor/depot_tools/ninja-linux32 +0 -0
  129. data/vendor/depot_tools/ninja-linux64 +0 -0
  130. data/vendor/depot_tools/ninja-mac +0 -0
  131. data/vendor/depot_tools/ninja.exe +0 -0
  132. data/vendor/depot_tools/owners.py +14 -3
  133. data/vendor/depot_tools/presubmit_canned_checks.py +46 -67
  134. data/vendor/depot_tools/presubmit_support.py +109 -371
  135. data/vendor/depot_tools/pylintrc +83 -56
  136. data/vendor/depot_tools/recipe_modules/OWNERS +1 -0
  137. data/vendor/depot_tools/recipe_modules/bot_update/__init__.py +18 -9
  138. data/vendor/depot_tools/recipe_modules/bot_update/api.py +56 -55
  139. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic.json +3 -7
  140. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_output_manifest.json +3 -7
  141. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +3 -7
  142. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/buildbot.json +52 -0
  143. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/clobber.json +19 -10
  144. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_rebase_patch_ref.json +19 -10
  145. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +19 -10
  146. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/no_shallow.json +19 -10
  147. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +19 -10
  148. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange.json +3 -7
  149. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2.json +2 -54
  150. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2_buildbot.json +56 -0
  151. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/{forced.json → trychange_oauth2_json.json} +6 -9
  152. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2_json_win.json +54 -0
  153. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob.json +9 -9
  154. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +9 -9
  155. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +9 -9
  156. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +9 -9
  157. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +20 -10
  158. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle_deprecated.json +59 -0
  159. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8.json +9 -9
  160. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +20 -10
  161. data/vendor/depot_tools/recipe_modules/bot_update/example.py +45 -63
  162. data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +210 -807
  163. data/vendor/depot_tools/recipe_modules/bot_update/test_api.py +34 -45
  164. data/vendor/depot_tools/recipe_modules/cipd/api.py +59 -84
  165. data/vendor/depot_tools/recipe_modules/cipd/example.expected/basic.json +71 -117
  166. data/vendor/depot_tools/recipe_modules/cipd/example.expected/describe-failed.json +14 -60
  167. data/vendor/depot_tools/recipe_modules/cipd/example.expected/describe-many-instances.json +71 -117
  168. data/vendor/depot_tools/recipe_modules/cipd/example.expected/mac64.json +71 -117
  169. data/vendor/depot_tools/recipe_modules/cipd/example.expected/win64.json +71 -117
  170. data/vendor/depot_tools/recipe_modules/cipd/example.py +2 -12
  171. data/vendor/depot_tools/recipe_modules/cipd/test_api.py +0 -9
  172. data/vendor/depot_tools/recipe_modules/depot_tools/api.py +6 -0
  173. data/vendor/depot_tools/recipe_modules/depot_tools/example.expected/basic.json +7 -0
  174. data/vendor/depot_tools/recipe_modules/depot_tools/example.expected/win.json +7 -0
  175. data/vendor/depot_tools/recipe_modules/depot_tools/example.py +3 -0
  176. data/vendor/depot_tools/recipe_modules/gclient/__init__.py +4 -0
  177. data/vendor/depot_tools/recipe_modules/gclient/api.py +9 -22
  178. data/vendor/depot_tools/recipe_modules/gclient/config.py +18 -5
  179. data/vendor/depot_tools/recipe_modules/gclient/example.expected/basic.json +14 -14
  180. data/vendor/depot_tools/recipe_modules/gclient/example.expected/buildbot.json +211 -0
  181. data/vendor/depot_tools/recipe_modules/gclient/example.expected/revision.json +16 -14
  182. data/vendor/depot_tools/recipe_modules/gclient/example.expected/tryserver.json +16 -14
  183. data/vendor/depot_tools/recipe_modules/gclient/example.py +13 -11
  184. data/vendor/depot_tools/recipe_modules/gerrit/__init__.py +6 -0
  185. data/vendor/depot_tools/recipe_modules/gerrit/api.py +63 -0
  186. data/vendor/depot_tools/recipe_modules/gerrit/example.expected/basic.json +64 -0
  187. data/vendor/depot_tools/recipe_modules/gerrit/example.py +35 -0
  188. data/vendor/depot_tools/recipe_modules/gerrit/test_api.py +24 -0
  189. data/vendor/depot_tools/recipe_modules/git/__init__.py +4 -0
  190. data/vendor/depot_tools/recipe_modules/git/api.py +155 -142
  191. data/vendor/depot_tools/recipe_modules/git/example.expected/basic.json +43 -17
  192. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_branch.json +43 -17
  193. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_file_name.json +43 -17
  194. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_hash.json +43 -17
  195. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_ref.json +43 -17
  196. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_submodule_update_force.json +43 -17
  197. data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +13 -13
  198. data/vendor/depot_tools/recipe_modules/git/example.expected/cannot_fail_build.json +43 -17
  199. data/vendor/depot_tools/recipe_modules/git/example.expected/cat-file_test.json +45 -19
  200. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_delta.json +45 -19
  201. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_failed.json +43 -17
  202. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output.json +43 -17
  203. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +8 -8
  204. data/vendor/depot_tools/recipe_modules/git/example.expected/curl_trace_file.json +44 -18
  205. data/vendor/depot_tools/recipe_modules/git/example.expected/git-cache-checkout.json +48 -22
  206. data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +43 -17
  207. data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +42 -16
  208. data/vendor/depot_tools/recipe_modules/git/example.expected/remote_not_origin.json +43 -17
  209. data/vendor/depot_tools/recipe_modules/git/example.expected/set_got_revision.json +43 -17
  210. data/vendor/depot_tools/recipe_modules/git/example.py +9 -3
  211. data/vendor/depot_tools/recipe_modules/git_cl/__init__.py +4 -0
  212. data/vendor/depot_tools/recipe_modules/git_cl/api.py +8 -8
  213. data/vendor/depot_tools/recipe_modules/git_cl/example.py +1 -1
  214. data/vendor/depot_tools/recipe_modules/gsutil/__init__.py +4 -0
  215. data/vendor/depot_tools/recipe_modules/gsutil/api.py +196 -0
  216. data/vendor/depot_tools/recipe_modules/gsutil/example.expected/basic.json +186 -0
  217. data/vendor/depot_tools/recipe_modules/gsutil/example.py +77 -0
  218. data/vendor/depot_tools/recipe_modules/gsutil/resources/gsutil_smart_retry.py +69 -0
  219. data/vendor/depot_tools/recipe_modules/infra_paths/__init__.py +3 -0
  220. data/vendor/depot_tools/recipe_modules/infra_paths/api.py +20 -3
  221. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/basic.json +3 -1
  222. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_linux.json +3 -1
  223. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_mac.json +3 -1
  224. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_win.json +3 -1
  225. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_linux.json +3 -1
  226. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_mac.json +3 -1
  227. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_win.json +3 -1
  228. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_linux.json +3 -1
  229. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_mac.json +3 -1
  230. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_win.json +3 -1
  231. data/vendor/depot_tools/recipe_modules/infra_paths/example.py +6 -1
  232. data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +4 -6
  233. data/vendor/depot_tools/recipe_modules/rietveld/__init__.py +5 -0
  234. data/vendor/depot_tools/recipe_modules/rietveld/api.py +12 -9
  235. data/vendor/depot_tools/recipe_modules/rietveld/example.expected/basic.json +2 -24
  236. data/vendor/depot_tools/recipe_modules/rietveld/example.expected/buildbot.json +30 -0
  237. data/vendor/depot_tools/recipe_modules/rietveld/example.py +12 -6
  238. data/vendor/depot_tools/recipe_modules/tryserver/__init__.py +4 -0
  239. data/vendor/depot_tools/recipe_modules/tryserver/api.py +46 -70
  240. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/set_failure_hash_with_no_steps.json +8 -0
  241. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/{with_svn_patch.json → with_gerrit_patch.json} +1 -31
  242. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_gerrit_patch_deprecated.json +39 -0
  243. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +2 -2
  244. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch_luci.json +8 -0
  245. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +3 -3
  246. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +3 -3
  247. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +1 -1
  248. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +1 -1
  249. data/vendor/depot_tools/recipe_modules/tryserver/example.py +35 -5
  250. data/vendor/depot_tools/recipes.py +52 -28
  251. data/vendor/depot_tools/repo +216 -69
  252. data/vendor/depot_tools/rietveld.py +20 -15
  253. data/vendor/depot_tools/roll_dep.py +1 -1
  254. data/vendor/depot_tools/scm.py +11 -826
  255. data/vendor/depot_tools/subprocess2.py +5 -5
  256. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +2 -0
  257. data/vendor/depot_tools/third_party/cq_client/README.md +5 -1
  258. data/vendor/depot_tools/third_party/cq_client/cq.pb.go +183 -104
  259. data/vendor/depot_tools/third_party/cq_client/cq.proto +43 -27
  260. data/vendor/depot_tools/third_party/cq_client/cq_pb2.py +95 -29
  261. data/vendor/depot_tools/third_party/cq_client/testdata/cq_both.cfg +67 -0
  262. data/vendor/depot_tools/third_party/cq_client/testdata/cq_gerrit.cfg +1 -2
  263. data/vendor/depot_tools/third_party/cq_client/testdata/cq_rietveld.cfg +0 -3
  264. data/vendor/depot_tools/third_party/upload.py +44 -24
  265. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +0 -5
  266. metadata +38 -93
  267. data/patches/0004-Reinterpret-thread-hash-for-FreeBSD-too.patch +0 -25
  268. data/vendor/depot_tools/git-auto-svn +0 -6
  269. data/vendor/depot_tools/git_auto_svn.py +0 -122
  270. data/vendor/depot_tools/man/html/git-auto-svn.html +0 -837
  271. data/vendor/depot_tools/man/man1/git-auto-svn.1 +0 -113
  272. data/vendor/depot_tools/man/src/_git-auto-svn_desc.helper.txt +0 -1
  273. data/vendor/depot_tools/man/src/git-auto-svn.txt +0 -69
  274. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/off.json +0 -43
  275. data/vendor/depot_tools/recipe_modules/cipd/example.expected/install-failed.json +0 -31
  276. data/vendor/depot_tools/recipe_modules/cipd/resources/bootstrap.py +0 -218
  277. data/vendor/depot_tools/recipe_modules/tryserver/test_api.py +0 -7
  278. data/vendor/depot_tools/third_party/gsutil/CHECKSUM +0 -1
  279. data/vendor/depot_tools/third_party/gsutil/COPYING +0 -202
  280. data/vendor/depot_tools/third_party/gsutil/LICENSE.third_party +0 -295
  281. data/vendor/depot_tools/third_party/gsutil/MANIFEST.in +0 -5
  282. data/vendor/depot_tools/third_party/gsutil/README +0 -38
  283. data/vendor/depot_tools/third_party/gsutil/README.chromium +0 -25
  284. data/vendor/depot_tools/third_party/gsutil/README.pkg +0 -49
  285. data/vendor/depot_tools/third_party/gsutil/ReleaseNotes.txt +0 -825
  286. data/vendor/depot_tools/third_party/gsutil/VERSION +0 -1
  287. data/vendor/depot_tools/third_party/gsutil/gslib/README +0 -5
  288. data/vendor/depot_tools/third_party/gsutil/gslib/__init__.py +0 -22
  289. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/__init__.py +0 -15
  290. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/acls.py +0 -234
  291. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/anon.py +0 -57
  292. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/command_opts.py +0 -116
  293. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/dev.py +0 -139
  294. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/metadata.py +0 -186
  295. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/naming.py +0 -173
  296. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/prod.py +0 -160
  297. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/projects.py +0 -130
  298. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/subdirs.py +0 -110
  299. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/support.py +0 -86
  300. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/versioning.py +0 -242
  301. data/vendor/depot_tools/third_party/gsutil/gslib/addlhelp/wildcards.py +0 -170
  302. data/vendor/depot_tools/third_party/gsutil/gslib/bucket_listing_ref.py +0 -175
  303. data/vendor/depot_tools/third_party/gsutil/gslib/command.py +0 -725
  304. data/vendor/depot_tools/third_party/gsutil/gslib/command_runner.py +0 -102
  305. data/vendor/depot_tools/third_party/gsutil/gslib/commands/__init__.py +0 -15
  306. data/vendor/depot_tools/third_party/gsutil/gslib/commands/cat.py +0 -131
  307. data/vendor/depot_tools/third_party/gsutil/gslib/commands/chacl.py +0 -523
  308. data/vendor/depot_tools/third_party/gsutil/gslib/commands/config.py +0 -662
  309. data/vendor/depot_tools/third_party/gsutil/gslib/commands/cp.py +0 -1819
  310. data/vendor/depot_tools/third_party/gsutil/gslib/commands/disablelogging.py +0 -101
  311. data/vendor/depot_tools/third_party/gsutil/gslib/commands/enablelogging.py +0 -149
  312. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getacl.py +0 -82
  313. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getcors.py +0 -121
  314. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getdefacl.py +0 -86
  315. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getlogging.py +0 -137
  316. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getversioning.py +0 -116
  317. data/vendor/depot_tools/third_party/gsutil/gslib/commands/getwebcfg.py +0 -122
  318. data/vendor/depot_tools/third_party/gsutil/gslib/commands/help.py +0 -218
  319. data/vendor/depot_tools/third_party/gsutil/gslib/commands/ls.py +0 -578
  320. data/vendor/depot_tools/third_party/gsutil/gslib/commands/mb.py +0 -172
  321. data/vendor/depot_tools/third_party/gsutil/gslib/commands/mv.py +0 -159
  322. data/vendor/depot_tools/third_party/gsutil/gslib/commands/perfdiag.py +0 -903
  323. data/vendor/depot_tools/third_party/gsutil/gslib/commands/rb.py +0 -113
  324. data/vendor/depot_tools/third_party/gsutil/gslib/commands/rm.py +0 -237
  325. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setacl.py +0 -138
  326. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setcors.py +0 -145
  327. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setdefacl.py +0 -105
  328. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setmeta.py +0 -420
  329. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setversioning.py +0 -114
  330. data/vendor/depot_tools/third_party/gsutil/gslib/commands/setwebcfg.py +0 -190
  331. data/vendor/depot_tools/third_party/gsutil/gslib/commands/update.py +0 -305
  332. data/vendor/depot_tools/third_party/gsutil/gslib/commands/version.py +0 -150
  333. data/vendor/depot_tools/third_party/gsutil/gslib/exception.py +0 -76
  334. data/vendor/depot_tools/third_party/gsutil/gslib/help_provider.py +0 -81
  335. data/vendor/depot_tools/third_party/gsutil/gslib/name_expansion.py +0 -550
  336. data/vendor/depot_tools/third_party/gsutil/gslib/no_op_auth_plugin.py +0 -30
  337. data/vendor/depot_tools/third_party/gsutil/gslib/plurality_checkable_iterator.py +0 -56
  338. data/vendor/depot_tools/third_party/gsutil/gslib/project_id.py +0 -67
  339. data/vendor/depot_tools/third_party/gsutil/gslib/storage_uri_builder.py +0 -56
  340. data/vendor/depot_tools/third_party/gsutil/gslib/thread_pool.py +0 -79
  341. data/vendor/depot_tools/third_party/gsutil/gslib/util.py +0 -167
  342. data/vendor/depot_tools/third_party/gsutil/gslib/wildcard_iterator.py +0 -498
  343. data/vendor/depot_tools/third_party/gsutil/gsutil +0 -384
  344. data/vendor/depot_tools/third_party/gsutil/gsutil.spec.in +0 -75
  345. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/__init__.py +0 -22
  346. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_client.py +0 -630
  347. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_client_test.py +0 -374
  348. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_helper.py +0 -103
  349. data/vendor/depot_tools/third_party/gsutil/oauth2_plugin/oauth2_plugin.py +0 -24
  350. data/vendor/depot_tools/third_party/gsutil/pkg_util.py +0 -60
  351. data/vendor/depot_tools/third_party/gsutil/plugins/__init__.py +0 -0
  352. data/vendor/depot_tools/third_party/gsutil/plugins/sso_auth.py +0 -105
@@ -5,6 +5,7 @@
5
5
  """Generic utils."""
6
6
 
7
7
  import codecs
8
+ import contextlib
8
9
  import cStringIO
9
10
  import datetime
10
11
  import logging
@@ -143,6 +144,16 @@ def FileWrite(filename, content, mode='w'):
143
144
  f.write(content)
144
145
 
145
146
 
147
+ @contextlib.contextmanager
148
+ def temporary_directory(**kwargs):
149
+ tdir = tempfile.mkdtemp(**kwargs)
150
+ try:
151
+ yield tdir
152
+ finally:
153
+ if tdir:
154
+ rmtree(tdir)
155
+
156
+
146
157
  def safe_rename(old, new):
147
158
  """Renames a file reliably.
148
159
 
@@ -179,9 +190,8 @@ def rmtree(path):
179
190
  Recursively removes a directory, even if it's marked read-only.
180
191
 
181
192
  shutil.rmtree() doesn't work on Windows if any of the files or directories
182
- are read-only, which svn repositories and some .svn files are. We need to
183
- be able to force the files to be writable (i.e., deletable) as we traverse
184
- the tree.
193
+ are read-only. We need to be able to force the files to be writable (i.e.,
194
+ deletable) as we traverse the tree.
185
195
 
186
196
  Even with all this, Windows still sometimes fails to delete a file, citing
187
197
  a permission error (maybe something to do with antivirus scans or disk
@@ -459,71 +469,9 @@ class GClientChildren(object):
459
469
  print >> sys.stderr, ' ', zombie.pid
460
470
 
461
471
 
462
- class _KillTimer(object):
463
- """Timer that kills child process after certain interval since last poke or
464
- creation.
465
- """
466
- # TODO(tandrii): we really want to make use of subprocess42 here, and not
467
- # re-invent the wheel, but it's too much work :(
468
-
469
- def __init__(self, timeout, child, child_info):
470
- self._timeout = timeout
471
- self._child = child
472
- self._child_info = child_info
473
-
474
- self._cv = threading.Condition()
475
- # All items below are protected by condition above.
476
- self._kill_at = None
477
- self._killing_attempted = False
478
- self._working = True
479
- self._thread = None
480
-
481
- # Start the timer immediately.
482
- if self._timeout:
483
- self._kill_at = time.time() + self._timeout
484
- self._thread = threading.Thread(name='_KillTimer', target=self._work)
485
- self._thread.daemon = True
486
- self._thread.start()
487
-
488
- @property
489
- def killing_attempted(self):
490
- return self._killing_attempted
491
-
492
- def poke(self):
493
- if not self._timeout:
494
- return
495
- with self._cv:
496
- self._kill_at = time.time() + self._timeout
497
-
498
- def cancel(self):
499
- with self._cv:
500
- self._working = False
501
- self._cv.notifyAll()
502
-
503
- def _work(self):
504
- if not self._timeout:
505
- return
506
- while True:
507
- with self._cv:
508
- if not self._working:
509
- return
510
- left = self._kill_at - time.time()
511
- if left > 0:
512
- self._cv.wait(timeout=left)
513
- continue
514
- try:
515
- logging.warn('killing child %s %s because of no output for %fs',
516
- self._child.pid, self._child_info, self._timeout)
517
- self._killing_attempted = True
518
- self._child.kill()
519
- except OSError:
520
- logging.exception('failed to kill child %s', self._child)
521
- return
522
-
523
-
524
472
  def CheckCallAndFilter(args, stdout=None, filter_fn=None,
525
473
  print_stdout=None, call_filter_on_first_line=False,
526
- retry=False, kill_timeout=None, **kwargs):
474
+ retry=False, **kwargs):
527
475
  """Runs a command and calls back a filter function if needed.
528
476
 
529
477
  Accepts all subprocess2.Popen() parameters plus:
@@ -534,23 +482,16 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
534
482
  stdout: Can be any bufferable output.
535
483
  retry: If the process exits non-zero, sleep for a brief interval and try
536
484
  again, up to RETRY_MAX times.
537
- kill_timeout: (float) if given, number of seconds after which process would
538
- be killed. Must not be used with shell=True as only shell process
539
- would be killed, but not processes spawned by shell.
540
485
 
541
486
  stderr is always redirected to stdout.
542
487
  """
543
488
  assert print_stdout or filter_fn
544
- assert not kwargs.get('shell', False) or not kill_timeout, (
545
- 'kill_timeout should not be used with shell=True')
546
489
  stdout = stdout or sys.stdout
547
490
  output = cStringIO.StringIO()
548
491
  filter_fn = filter_fn or (lambda x: None)
549
492
 
550
493
  sleep_interval = RETRY_INITIAL_SLEEP
551
494
  run_cwd = kwargs.get('cwd', os.getcwd())
552
- debug_kid_info = "'%s' in %s" % (' '.join('"%s"' % x for x in args), run_cwd)
553
-
554
495
  for _ in xrange(RETRY_MAX + 1):
555
496
  kid = subprocess2.Popen(
556
497
  args, bufsize=0, stdout=subprocess2.PIPE, stderr=subprocess2.STDOUT,
@@ -563,10 +504,10 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
563
504
 
564
505
  # Also, we need to forward stdout to prevent weird re-ordering of output.
565
506
  # This has to be done on a per byte basis to make sure it is not buffered:
566
- # normally buffering is done for each line, but if svn requests input, no
567
- # end-of-line character is output after the prompt and it would not show up.
507
+ # normally buffering is done for each line, but if the process requests
508
+ # input, no end-of-line character is output after the prompt and it would
509
+ # not show up.
568
510
  try:
569
- timeout_killer = _KillTimer(kill_timeout, kid, debug_kid_info)
570
511
  in_byte = kid.stdout.read(1)
571
512
  if in_byte:
572
513
  if call_filter_on_first_line:
@@ -587,7 +528,6 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
587
528
  if len(in_line):
588
529
  filter_fn(in_line)
589
530
  rv = kid.wait()
590
- timeout_killer.cancel()
591
531
 
592
532
  # Don't put this in a 'finally,' since the child may still run if we get
593
533
  # an exception.
@@ -601,12 +541,8 @@ def CheckCallAndFilter(args, stdout=None, filter_fn=None,
601
541
  return output.getvalue()
602
542
  if not retry:
603
543
  break
604
- print ("WARNING: subprocess %s failed; will retry after a short nap..." %
605
- debug_kid_info)
606
- if timeout_killer.killing_attempted:
607
- print('The subprocess above was likely killed because it looked hung. '
608
- 'Output thus far:\n> %s' %
609
- ('\n> '.join(output.getvalue().splitlines())))
544
+ print ("WARNING: subprocess '%s' in %s failed; will retry after a short "
545
+ 'nap...' % (' '.join('"%s"' % x for x in args), run_cwd))
610
546
  time.sleep(sleep_interval)
611
547
  sleep_interval *= 2
612
548
  raise subprocess2.CalledProcessError(
@@ -1135,7 +1071,7 @@ def GetEditor(git_editor=None):
1135
1071
  """Returns the most plausible editor to use.
1136
1072
 
1137
1073
  In order of preference:
1138
- - GIT_EDITOR/SVN_EDITOR environment variable
1074
+ - GIT_EDITOR environment variable
1139
1075
  - core.editor git configuration variable (if supplied by git-cl)
1140
1076
  - VISUAL environment variable
1141
1077
  - EDITOR environment variable
@@ -1244,9 +1180,9 @@ def NumLocalCpus():
1244
1180
  try:
1245
1181
  import multiprocessing
1246
1182
  return multiprocessing.cpu_count()
1247
- except NotImplementedError: # pylint: disable=W0702
1183
+ except NotImplementedError: # pylint: disable=bare-except
1248
1184
  # (UNIX) Query 'os.sysconf'.
1249
- # pylint: disable=E1101
1185
+ # pylint: disable=no-member
1250
1186
  if hasattr(os, 'sysconf') and 'SC_NPROCESSORS_ONLN' in os.sysconf_names:
1251
1187
  return int(os.sysconf('SC_NPROCESSORS_ONLN'))
1252
1188
 
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/python
2
+ # Copyright 2017 The Chromium Authors. All rights reserved.
3
+ # Use of this source code is governed by a BSD-style license that can be
4
+ # found in the LICENSE file.
5
+
6
+ """Simple client for the Gerrit REST API.
7
+
8
+ Example usage:
9
+ ./gerrit_client.py [command] [args]""
10
+ """
11
+
12
+ from __future__ import print_function
13
+
14
+ import json
15
+ import logging
16
+ import optparse
17
+ import subcommand
18
+ import sys
19
+ import urllib
20
+ import urlparse
21
+
22
+ from third_party import colorama
23
+ import fix_encoding
24
+ import gerrit_util
25
+ import setup_color
26
+
27
+ __version__ = '0.1'
28
+ # Shortcut since it quickly becomes redundant.
29
+ Fore = colorama.Fore
30
+
31
+
32
+ def write_result(result, opt):
33
+ if opt.json_file:
34
+ with open(opt.json_file, 'w') as json_file:
35
+ json_file.write(json.dumps(result))
36
+
37
+
38
+ @subcommand.usage('[args ...]')
39
+ def CMDbranchinfo(parser, args):
40
+ parser.add_option('--branch', dest='branch', help='branch name')
41
+
42
+ (opt, args) = parser.parse_args(args)
43
+ host = urlparse.urlparse(opt.host).netloc
44
+ project = urllib.quote_plus(opt.project)
45
+ branch = urllib.quote_plus(opt.branch)
46
+ result = gerrit_util.GetGerritBranch(host, project, branch)
47
+ logging.info(result)
48
+ write_result(result, opt)
49
+
50
+ @subcommand.usage('[args ...]')
51
+ def CMDbranch(parser, args):
52
+ parser.add_option('--branch', dest='branch', help='branch name')
53
+ parser.add_option('--commit', dest='commit', help='commit hash')
54
+
55
+ (opt, args) = parser.parse_args(args)
56
+
57
+ project = urllib.quote_plus(opt.project)
58
+ host = urlparse.urlparse(opt.host).netloc
59
+ branch = urllib.quote_plus(opt.branch)
60
+ commit = urllib.quote_plus(opt.commit)
61
+ result = gerrit_util.CreateGerritBranch(host, project, branch, commit)
62
+ logging.info(result)
63
+ write_result(result, opt)
64
+
65
+
66
+ class OptionParser(optparse.OptionParser):
67
+ """Creates the option parse and add --verbose support."""
68
+ def __init__(self, *args, **kwargs):
69
+ optparse.OptionParser.__init__(
70
+ self, *args, prog='git cl', version=__version__, **kwargs)
71
+ self.add_option(
72
+ '--verbose', action='count', default=0,
73
+ help='Use 2 times for more debugging info')
74
+ self.add_option('--host', dest='host', help='Url of host.')
75
+ self.add_option('--project', dest='project', help='project name')
76
+ self.add_option(
77
+ '--json_file', dest='json_file', help='output json filepath')
78
+
79
+ def parse_args(self, args=None, values=None):
80
+ options, args = optparse.OptionParser.parse_args(self, args, values)
81
+ levels = [logging.WARNING, logging.INFO, logging.DEBUG]
82
+ logging.basicConfig(level=levels[min(options.verbose, len(levels) - 1)])
83
+ return options, args
84
+
85
+
86
+ def main(argv):
87
+ if sys.hexversion < 0x02060000:
88
+ print('\nYour python version %s is unsupported, please upgrade.\n'
89
+ %(sys.version.split(' ', 1)[0],),
90
+ file=sys.stderr)
91
+ return 2
92
+ dispatcher = subcommand.CommandDispatcher(__name__)
93
+ return dispatcher.execute(OptionParser(), argv)
94
+
95
+
96
+ if __name__ == '__main__':
97
+ # These affect sys.stdout so do it outside of main() to simplify mocks in
98
+ # unit testing.
99
+ fix_encoding.fix_encoding()
100
+ setup_color.init()
101
+ try:
102
+ sys.exit(main(sys.argv[1:]))
103
+ except KeyboardInterrupt:
104
+ sys.stderr.write('interrupted\n')
105
+ sys.exit(1)
@@ -9,6 +9,7 @@ https://gerrit-review.googlesource.com/Documentation/rest-api.html
9
9
  """
10
10
 
11
11
  import base64
12
+ import contextlib
12
13
  import cookielib
13
14
  import httplib
14
15
  import json
@@ -19,11 +20,13 @@ import re
19
20
  import socket
20
21
  import stat
21
22
  import sys
23
+ import tempfile
22
24
  import time
23
25
  import urllib
24
26
  import urlparse
25
27
  from cStringIO import StringIO
26
28
 
29
+ import gclient_utils
27
30
 
28
31
  LOGGER = logging.getLogger()
29
32
  TRY_LIMIT = 5
@@ -113,30 +116,46 @@ class CookiesAuthenticator(Authenticator):
113
116
 
114
117
  @classmethod
115
118
  def _get_netrc(cls):
119
+ # Buffer the '.netrc' path. Use an empty file if it doesn't exist.
116
120
  path = cls.get_netrc_path()
117
- if not os.path.exists(path):
118
- return netrc.netrc(os.devnull)
119
-
120
- try:
121
- return netrc.netrc(path)
122
- except IOError:
123
- print >> sys.stderr, 'WARNING: Could not read netrc file %s' % path
124
- return netrc.netrc(os.devnull)
125
- except netrc.NetrcParseError:
121
+ content = ''
122
+ if os.path.exists(path):
126
123
  st = os.stat(path)
127
124
  if st.st_mode & (stat.S_IRWXG | stat.S_IRWXO):
128
125
  print >> sys.stderr, (
129
126
  'WARNING: netrc file %s cannot be used because its file '
130
127
  'permissions are insecure. netrc file permissions should be '
131
128
  '600.' % path)
132
- else:
133
- print >> sys.stderr, ('ERROR: Cannot use netrc file %s due to a '
134
- 'parsing error.' % path)
135
- raise
129
+ with open(path) as fd:
130
+ content = fd.read()
131
+
132
+ # Load the '.netrc' file. We strip comments from it because processing them
133
+ # can trigger a bug in Windows. See crbug.com/664664.
134
+ content = '\n'.join(l for l in content.splitlines()
135
+ if l.strip() and not l.strip().startswith('#'))
136
+ with tempdir() as tdir:
137
+ netrc_path = os.path.join(tdir, 'netrc')
138
+ with open(netrc_path, 'w') as fd:
139
+ fd.write(content)
140
+ os.chmod(netrc_path, (stat.S_IRUSR | stat.S_IWUSR))
141
+ return cls._get_netrc_from_path(netrc_path)
142
+
143
+ @classmethod
144
+ def _get_netrc_from_path(cls, path):
145
+ try:
146
+ return netrc.netrc(path)
147
+ except IOError:
148
+ print >> sys.stderr, 'WARNING: Could not read netrc file %s' % path
149
+ return netrc.netrc(os.devnull)
150
+ except netrc.NetrcParseError as e:
151
+ print >> sys.stderr, ('ERROR: Cannot use netrc file %s due to a '
152
+ 'parsing error: %s' % (path, e))
136
153
  return netrc.netrc(os.devnull)
137
154
 
138
155
  @classmethod
139
156
  def get_gitcookies_path(cls):
157
+ if os.getenv('GIT_COOKIES_PATH'):
158
+ return os.getenv('GIT_COOKIES_PATH')
140
159
  return os.path.join(os.environ['HOME'], '.gitcookies')
141
160
 
142
161
  @classmethod
@@ -162,7 +181,7 @@ class CookiesAuthenticator(Authenticator):
162
181
  login, secret_token = value.split('=', 1)
163
182
  gitcookies[domain] = (login, secret_token)
164
183
  except (IndexError, ValueError, TypeError) as exc:
165
- logging.warning(exc)
184
+ LOGGER.warning(exc)
166
185
 
167
186
  return gitcookies
168
187
 
@@ -179,6 +198,7 @@ class CookiesAuthenticator(Authenticator):
179
198
  return 'Basic %s' % (base64.b64encode('%s:%s' % (auth[0], auth[2])))
180
199
  return None
181
200
 
201
+
182
202
  # Backwards compatibility just in case somebody imports this outside of
183
203
  # depot_tools.
184
204
  NetrcAuthenticator = CookiesAuthenticator
@@ -199,6 +219,8 @@ class GceAuthenticator(Authenticator):
199
219
 
200
220
  @classmethod
201
221
  def is_gce(cls):
222
+ if os.getenv('SKIP_GCE_AUTH_FOR_GIT'):
223
+ return False
202
224
  if cls._cache_is_gce is None:
203
225
  cls._cache_is_gce = cls._test_is_gce()
204
226
  return cls._cache_is_gce
@@ -232,7 +254,6 @@ class GceAuthenticator(Authenticator):
232
254
  if resp.status < httplib.INTERNAL_SERVER_ERROR:
233
255
  return resp
234
256
 
235
-
236
257
  @classmethod
237
258
  def _get_token_dict(cls):
238
259
  if cls._token_cache:
@@ -254,7 +275,6 @@ class GceAuthenticator(Authenticator):
254
275
  return '%(token_type)s %(access_token)s' % token_dict
255
276
 
256
277
 
257
-
258
278
  def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
259
279
  """Opens an https connection to a gerrit service, and sends a request."""
260
280
  headers = headers or {}
@@ -266,10 +286,11 @@ def CreateHttpConn(host, path, reqtype='GET', headers=None, body=None):
266
286
  else:
267
287
  LOGGER.debug('No authorization found for %s.' % bare_host)
268
288
 
269
- if 'Authorization' in headers and not path.startswith('a/'):
270
- url = '/a/%s' % path
271
- else:
272
- url = '/%s' % path
289
+ url = path
290
+ if not url.startswith('/'):
291
+ url = '/' + url
292
+ if 'Authorization' in headers and not url.startswith('/a/'):
293
+ url = '/a%s' % url
273
294
 
274
295
  if body:
275
296
  body = json.JSONEncoder().encode(body)
@@ -322,17 +343,18 @@ def ReadHttpResponse(conn, expect_status=200, ignore_404=True):
322
343
 
323
344
  # If response.status < 500 then the result is final; break retry loop.
324
345
  if response.status < 500:
346
+ LOGGER.debug('got response %d for %s %s', response.status,
347
+ conn.req_params['method'], conn.req_params['url'])
325
348
  break
326
349
  # A status >=500 is assumed to be a possible transient error; retry.
327
350
  http_version = 'HTTP/%s' % ('1.1' if response.version == 11 else '1.0')
328
- msg = (
329
- 'A transient error occurred while querying %s:\n'
330
- '%s %s %s\n'
331
- '%s %d %s' % (
332
- conn.host, conn.req_params['method'], conn.req_params['url'],
333
- http_version, http_version, response.status, response.reason))
351
+ LOGGER.warn('A transient error occurred while querying %s:\n'
352
+ '%s %s %s\n'
353
+ '%s %d %s',
354
+ conn.host, conn.req_params['method'], conn.req_params['url'],
355
+ http_version, http_version, response.status, response.reason)
334
356
  if TRY_LIMIT - idx > 1:
335
- msg += '\n... will retry %d more times.' % (TRY_LIMIT - idx - 1)
357
+ LOGGER.warn('... will retry %d more times.', TRY_LIMIT - idx - 1)
336
358
  time.sleep(sleep_time)
337
359
  sleep_time = sleep_time * 2
338
360
  req_host = conn.req_host
@@ -341,7 +363,6 @@ def ReadHttpResponse(conn, expect_status=200, ignore_404=True):
341
363
  conn.req_host = req_host
342
364
  conn.req_params = req_params
343
365
  conn.request(**req_params)
344
- LOGGER.warn(msg)
345
366
  if ignore_404 and response.status == 404:
346
367
  return StringIO()
347
368
  if response.status != expect_status:
@@ -475,27 +496,19 @@ def GetChange(host, change):
475
496
  return ReadHttpJsonResponse(CreateHttpConn(host, path))
476
497
 
477
498
 
478
- def GetChangeDetail(host, change, o_params=None):
499
+ def GetChangeDetail(host, change, o_params=None, ignore_404=True):
479
500
  """Query a gerrit server for extended information about a single change."""
501
+ # TODO(tandrii): cahnge ignore_404 to False by default.
480
502
  path = 'changes/%s/detail' % change
481
503
  if o_params:
482
504
  path += '?%s' % '&'.join(['o=%s' % p for p in o_params])
483
- return ReadHttpJsonResponse(CreateHttpConn(host, path))
505
+ return ReadHttpJsonResponse(CreateHttpConn(host, path), ignore_404=ignore_404)
484
506
 
485
507
 
486
- def GetChangeDescriptionFromGitiles(url, revision):
487
- """Query Gitiles for actual commit message for a given url and ref.
488
-
489
- url must be obtained from call to GetChangeDetail for a specific
490
- revision (patchset) under 'fetch' key.
491
- """
492
- parsed = urlparse.urlparse(url)
493
- path = '%s/+/%s?format=json' % (parsed.path, revision)
494
- # Note: Gerrit instances that Chrome infrastructure uses thus far have all
495
- # enabled Gitiles, which allowes us to execute this call. This isn't true for
496
- # all Gerrit instances out there. Thus, if line below fails, consider adding a
497
- # fallback onto actually fetching ref from remote using pure git.
498
- return ReadHttpJsonResponse(CreateHttpConn(parsed.netloc, path))['message']
508
+ def GetChangeCommit(host, change, revision='current'):
509
+ """Query a gerrit server for a revision associated with a change."""
510
+ path = 'changes/%s/revisions/%s/commit?links' % (change, revision)
511
+ return ReadHttpJsonResponse(CreateHttpConn(host, path))
499
512
 
500
513
 
501
514
  def GetChangeCurrentRevision(host, change):
@@ -545,36 +558,72 @@ def SubmitChange(host, change, wait_for_merge=True):
545
558
  return ReadHttpJsonResponse(conn, ignore_404=False)
546
559
 
547
560
 
548
- def SetCommitMessage(host, change, description):
549
- """Updates a commit message."""
550
- # First, edit the commit message in a draft.
551
- path = 'changes/%s/edit:message' % change
552
- body = {'message': description}
553
- conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
561
+ def HasPendingChangeEdit(host, change):
562
+ conn = CreateHttpConn(host, 'changes/%s/edit' % change)
554
563
  try:
555
564
  ReadHttpResponse(conn, ignore_404=False)
556
565
  except GerritError as e:
557
566
  # On success, gerrit returns status 204; anything else is an error.
558
567
  if e.http_status != 204:
559
568
  raise
569
+ return False
560
570
  else:
561
- raise GerritError(
562
- 'Unexpectedly received a 200 http status while editing message in '
563
- 'change %s' % change)
571
+ return True
572
+
564
573
 
565
- # And then publish it.
566
- path = 'changes/%s/edit:publish' % change
567
- conn = CreateHttpConn(host, path, reqtype='POST', body={})
574
+ def DeletePendingChangeEdit(host, change):
575
+ conn = CreateHttpConn(host, 'changes/%s/edit' % change, reqtype='DELETE')
568
576
  try:
569
577
  ReadHttpResponse(conn, ignore_404=False)
570
578
  except GerritError as e:
571
- # On success, gerrit returns status 204; anything else is an error.
572
- if e.http_status != 204:
579
+ # On success, gerrit returns status 204; if the edit was already deleted it
580
+ # returns 404. Anything else is an error.
581
+ if e.http_status not in (204, 404):
573
582
  raise
574
- else:
575
- raise GerritError(
576
- 'Unexpectedly received a 200 http status while publishing message '
577
- 'change in %s' % change)
583
+
584
+
585
+ def SetCommitMessage(host, change, description, notify='ALL'):
586
+ """Updates a commit message."""
587
+ try:
588
+ assert notify in ('ALL', 'NONE')
589
+ # First, edit the commit message in a draft.
590
+ path = 'changes/%s/edit:message' % change
591
+ body = {'message': description}
592
+ conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
593
+ try:
594
+ ReadHttpResponse(conn, ignore_404=False)
595
+ except GerritError as e:
596
+ # On success, gerrit returns status 204; anything else is an error.
597
+ if e.http_status != 204:
598
+ raise
599
+ else:
600
+ raise GerritError(
601
+ 'Unexpectedly received a 200 http status while editing message in '
602
+ 'change %s' % change)
603
+
604
+ # And then publish it.
605
+ path = 'changes/%s/edit:publish' % change
606
+ conn = CreateHttpConn(host, path, reqtype='POST', body={'notify': notify})
607
+ try:
608
+ ReadHttpResponse(conn, ignore_404=False)
609
+ except GerritError as e:
610
+ # On success, gerrit returns status 204; anything else is an error.
611
+ if e.http_status != 204:
612
+ raise
613
+ else:
614
+ raise GerritError(
615
+ 'Unexpectedly received a 200 http status while publishing message '
616
+ 'change in %s' % change)
617
+ except (GerritError, KeyboardInterrupt) as e:
618
+ # Something went wrong with one of the two calls, so we want to clean up
619
+ # after ourselves before returning.
620
+ try:
621
+ DeletePendingChangeEdit(host, change)
622
+ except GerritError:
623
+ LOGGER.error('Encountered error while cleaning up after failed attempt '
624
+ 'to set the CL description. You may have to delete the '
625
+ 'pending change edit yourself in the web UI.')
626
+ raise e
578
627
 
579
628
 
580
629
  def GetReviewers(host, change):
@@ -589,18 +638,32 @@ def GetReview(host, change, revision):
589
638
  return ReadHttpJsonResponse(CreateHttpConn(host, path))
590
639
 
591
640
 
592
- def AddReviewers(host, change, add=None):
641
+ def AddReviewers(host, change, add=None, is_reviewer=True, notify=True):
593
642
  """Add reviewers to a change."""
643
+ errors = None
594
644
  if not add:
595
- return
645
+ return None
596
646
  if isinstance(add, basestring):
597
647
  add = (add,)
598
648
  path = 'changes/%s/reviewers' % change
599
649
  for r in add:
600
- body = {'reviewer': r}
601
- conn = CreateHttpConn(host, path, reqtype='POST', body=body)
602
- jmsg = ReadHttpJsonResponse(conn, ignore_404=False)
603
- return jmsg
650
+ state = 'REVIEWER' if is_reviewer else 'CC'
651
+ notify = 'ALL' if notify else 'NONE'
652
+ body = {
653
+ 'reviewer': r,
654
+ 'state': state,
655
+ 'notify': notify,
656
+ }
657
+ try:
658
+ conn = CreateHttpConn(host, path, reqtype='POST', body=body)
659
+ _ = ReadHttpJsonResponse(conn, ignore_404=False)
660
+ except GerritError as e:
661
+ if e.http_status == 422: # "Unprocessable Entity"
662
+ LOGGER.warn('Failed to add "%s" as a %s' % (r, state.lower()))
663
+ errors = True
664
+ else:
665
+ raise
666
+ return errors
604
667
 
605
668
 
606
669
  def RemoveReviewers(host, change, remove=None):
@@ -689,3 +752,47 @@ def ResetReviewLabels(host, change, label, value='0', message=None,
689
752
  elif jmsg[0]['current_revision'] != revision:
690
753
  raise GerritError(200, 'While resetting labels on change "%s", '
691
754
  'a new patchset was uploaded.' % change)
755
+
756
+
757
+ def CreateGerritBranch(host, project, branch, commit):
758
+ """
759
+ Create a new branch from given project and commit
760
+ https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#create-branch
761
+
762
+ Returns:
763
+ A JSON with 'ref' key
764
+ """
765
+ path = 'projects/%s/branches/%s' % (project, branch)
766
+ body = {'revision': commit}
767
+ conn = CreateHttpConn(host, path, reqtype='PUT', body=body)
768
+ response = ReadHttpJsonResponse(conn)
769
+ if response:
770
+ return response
771
+ raise GerritError(200, 'Unable to create gerrit branch')
772
+
773
+
774
+ def GetGerritBranch(host, project, branch):
775
+ """
776
+ Get a branch from given project and commit
777
+ https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-branch
778
+
779
+ Returns:
780
+ A JSON object with 'revision' key
781
+ """
782
+ path = 'projects/%s/branches/%s' % (project, branch)
783
+ conn = CreateHttpConn(host, path, reqtype='GET')
784
+ response = ReadHttpJsonResponse(conn)
785
+ if response:
786
+ return response
787
+ raise GerritError(200, 'Unable to get gerrit branch')
788
+
789
+
790
+ @contextlib.contextmanager
791
+ def tempdir():
792
+ tdir = None
793
+ try:
794
+ tdir = tempfile.mkdtemp(suffix='gerrit_util')
795
+ yield tdir
796
+ finally:
797
+ if tdir:
798
+ gclient_utils.rmtree(tdir)