libv8 4.5.95.5 → 5.0.71.48.0beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (332) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +45 -19
  3. data/CHANGELOG.md +14 -0
  4. data/README.md +30 -15
  5. data/Rakefile +7 -6
  6. data/ext/libv8/arch.rb +5 -4
  7. data/ext/libv8/builder.rb +25 -19
  8. data/ext/libv8/compiler.rb +6 -33
  9. data/ext/libv8/location.rb +7 -8
  10. data/lib/libv8/version.rb +1 -1
  11. data/libv8.gemspec +1 -1
  12. data/patches/build-standalone-static-library.patch +14 -0
  13. data/patches/disable-building-tests.patch +48 -10
  14. data/patches/fPIC-for-static.patch +3 -3
  15. data/release/x86-linux/Vagrantfile +8 -4
  16. data/release/x86_64-freebsd10/Vagrantfile +86 -0
  17. data/release/x86_64-linux/Vagrantfile +8 -4
  18. data/spec/compiler_spec.rb +5 -29
  19. data/spec/support/compiler_helpers.rb +2 -4
  20. data/vendor/depot_tools/.gitignore +15 -3
  21. data/vendor/depot_tools/OWNERS +2 -2
  22. data/vendor/depot_tools/PRESUBMIT.py +4 -2
  23. data/vendor/depot_tools/WATCHLISTS +6 -0
  24. data/vendor/depot_tools/apply_issue.py +70 -38
  25. data/vendor/depot_tools/bootstrap/win/README.md +66 -0
  26. data/vendor/depot_tools/bootstrap/win/git-bash.template.sh +12 -0
  27. data/vendor/depot_tools/bootstrap/win/git.template.bat +5 -0
  28. data/vendor/depot_tools/bootstrap/win/profile.d.python.sh +20 -0
  29. data/vendor/depot_tools/bootstrap/win/win_tools.bat +96 -45
  30. data/vendor/depot_tools/breakpad.py +6 -141
  31. data/vendor/depot_tools/buildbucket.py +45 -31
  32. data/vendor/depot_tools/cbuildbot +1 -0
  33. data/vendor/depot_tools/checkout.py +2 -1
  34. data/vendor/depot_tools/chrome_set_ver +1 -0
  35. data/vendor/depot_tools/cit +8 -0
  36. data/vendor/depot_tools/cit.bat +11 -0
  37. data/vendor/depot_tools/cit.py +120 -0
  38. data/vendor/depot_tools/codereview.settings +0 -2
  39. data/vendor/depot_tools/commit_queue +1 -5
  40. data/vendor/depot_tools/commit_queue.bat +1 -4
  41. data/vendor/depot_tools/commit_queue.py +78 -29
  42. data/vendor/depot_tools/cpplint.py +22 -14
  43. data/vendor/depot_tools/cros +1 -0
  44. data/vendor/depot_tools/cros_sdk +1 -0
  45. data/vendor/depot_tools/depot-tools-auth.py +3 -3
  46. data/vendor/depot_tools/download_from_google_storage.py +101 -21
  47. data/vendor/depot_tools/drover.py +2 -3
  48. data/vendor/depot_tools/fetch.py +31 -27
  49. data/vendor/depot_tools/{recipes → fetch_configs}/android.py +4 -4
  50. data/vendor/depot_tools/fetch_configs/breakpad.py +45 -0
  51. data/vendor/depot_tools/{recipes → fetch_configs}/chromium.py +3 -3
  52. data/vendor/depot_tools/{recipes/recipe_util.py → fetch_configs/config_util.py} +3 -3
  53. data/vendor/depot_tools/fetch_configs/crashpad.py +41 -0
  54. data/vendor/depot_tools/{recipes → fetch_configs}/dart.py +3 -3
  55. data/vendor/depot_tools/{recipes/pdfium.py → fetch_configs/dartino.py} +14 -13
  56. data/vendor/depot_tools/{recipes → fetch_configs}/dartium.py +3 -3
  57. data/vendor/depot_tools/{recipes → fetch_configs}/depot_tools.py +3 -3
  58. data/vendor/depot_tools/fetch_configs/gyp.py +42 -0
  59. data/vendor/depot_tools/{recipes → fetch_configs}/infra.py +3 -3
  60. data/vendor/depot_tools/{recipes → fetch_configs}/infra_internal.py +3 -3
  61. data/vendor/depot_tools/{recipes → fetch_configs}/ios.py +4 -4
  62. data/vendor/depot_tools/{recipes → fetch_configs}/mojo.py +3 -3
  63. data/vendor/depot_tools/{recipes → fetch_configs}/nacl.py +3 -3
  64. data/vendor/depot_tools/{recipes → fetch_configs}/naclports.py +3 -3
  65. data/vendor/depot_tools/fetch_configs/pdfium.py +40 -0
  66. data/vendor/depot_tools/{recipes → fetch_configs}/skia.py +3 -3
  67. data/vendor/depot_tools/{recipes → fetch_configs}/skia_buildbot.py +3 -3
  68. data/vendor/depot_tools/fetch_configs/syzygy.py +41 -0
  69. data/vendor/depot_tools/{recipes → fetch_configs}/v8.py +3 -3
  70. data/vendor/depot_tools/{recipes → fetch_configs}/webrtc.py +3 -3
  71. data/vendor/depot_tools/{recipes → fetch_configs}/webrtc_android.py +4 -4
  72. data/vendor/depot_tools/{recipes → fetch_configs}/webrtc_ios.py +4 -4
  73. data/vendor/depot_tools/fix_encoding.py +6 -6
  74. data/vendor/depot_tools/gcl.py +11 -21
  75. data/vendor/depot_tools/gclient +10 -0
  76. data/vendor/depot_tools/gclient-new-workdir.py +7 -38
  77. data/vendor/depot_tools/gclient.bat +2 -2
  78. data/vendor/depot_tools/gclient.py +85 -65
  79. data/vendor/depot_tools/gclient_scm.py +83 -10
  80. data/vendor/depot_tools/gclient_utils.py +5 -1
  81. data/vendor/depot_tools/gerrit_util.py +243 -26
  82. data/vendor/depot_tools/git-auto-svn +1 -1
  83. data/vendor/depot_tools/git-cache +1 -1
  84. data/vendor/depot_tools/git-cherry-pick-upload +1 -1
  85. data/vendor/depot_tools/git-cl +1 -1
  86. data/vendor/depot_tools/git-drover +6 -0
  87. data/vendor/depot_tools/git-find-releases +6 -0
  88. data/vendor/depot_tools/git-footers +1 -1
  89. data/vendor/depot_tools/git-freeze +1 -1
  90. data/vendor/depot_tools/git-gs +1 -1
  91. data/vendor/depot_tools/git-hyper-blame +6 -0
  92. data/vendor/depot_tools/git-map +1 -1
  93. data/vendor/depot_tools/git-map-branches +1 -1
  94. data/vendor/depot_tools/git-mark-merge-base +1 -1
  95. data/vendor/depot_tools/git-nav-downstream +1 -1
  96. data/vendor/depot_tools/git-new-branch +1 -1
  97. data/vendor/depot_tools/git-number +1 -1
  98. data/vendor/depot_tools/git-rebase-update +1 -1
  99. data/vendor/depot_tools/git-rename-branch +1 -1
  100. data/vendor/depot_tools/git-reparent-branch +1 -1
  101. data/vendor/depot_tools/git-retry +1 -1
  102. data/vendor/depot_tools/git-squash-branch +1 -1
  103. data/vendor/depot_tools/git-thaw +1 -1
  104. data/vendor/depot_tools/git-try +1 -1
  105. data/vendor/depot_tools/git-upstream-diff +1 -1
  106. data/vendor/depot_tools/git_auto_svn.py +24 -6
  107. data/vendor/depot_tools/git_cache.py +74 -27
  108. data/vendor/depot_tools/git_cl.py +2118 -747
  109. data/vendor/depot_tools/git_common.py +100 -6
  110. data/vendor/depot_tools/git_dates.py +62 -0
  111. data/vendor/depot_tools/git_drover.py +424 -0
  112. data/vendor/depot_tools/git_find_releases.py +65 -0
  113. data/vendor/depot_tools/git_footers.py +42 -0
  114. data/vendor/depot_tools/git_hyper_blame.py +391 -0
  115. data/vendor/depot_tools/git_map_branches.py +8 -6
  116. data/vendor/depot_tools/git_new_branch.py +6 -1
  117. data/vendor/depot_tools/git_rebase_update.py +56 -16
  118. data/vendor/depot_tools/git_reparent_branch.py +13 -0
  119. data/vendor/depot_tools/git_try.py +0 -2
  120. data/vendor/depot_tools/gsutil.py +51 -20
  121. data/vendor/depot_tools/infra/config/OWNERS +3 -1
  122. data/vendor/depot_tools/infra/config/cq.cfg +7 -3
  123. data/vendor/depot_tools/infra/config/recipes.cfg +9 -0
  124. data/vendor/depot_tools/luci_hacks/README.md +35 -0
  125. data/vendor/depot_tools/{bootstrap/virtualenv/tests → luci_hacks}/__init__.py +0 -0
  126. data/vendor/depot_tools/luci_hacks/luci_recipe_run.isolate +12 -0
  127. data/vendor/depot_tools/luci_hacks/luci_recipe_run.py +81 -0
  128. data/vendor/depot_tools/luci_hacks/trigger_luci_job.py +128 -0
  129. data/vendor/depot_tools/man/html/depot_tools.html +9 -1
  130. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +4 -4
  131. data/vendor/depot_tools/man/html/git-drover.html +191 -35
  132. data/vendor/depot_tools/man/html/git-hyper-blame.html +878 -0
  133. data/vendor/depot_tools/man/html/git-rebase-update.html +9 -4
  134. data/vendor/depot_tools/man/man1/git-drover.1 +189 -36
  135. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +128 -0
  136. data/vendor/depot_tools/man/man1/git-rebase-update.1 +8 -6
  137. data/vendor/depot_tools/man/man7/depot_tools.7 +9 -4
  138. data/vendor/depot_tools/man/src/_git-hyper-blame_desc.helper.txt +1 -0
  139. data/vendor/depot_tools/man/src/common_demo_functions.sh +5 -0
  140. data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +1 -1
  141. data/vendor/depot_tools/man/src/git-drover.demo.1.sh +11 -16
  142. data/vendor/depot_tools/man/src/git-drover.demo.3.sh +27 -0
  143. data/vendor/depot_tools/man/src/git-drover.demo.4.sh +39 -0
  144. data/vendor/depot_tools/man/src/git-drover.txt +49 -3
  145. data/vendor/depot_tools/man/src/git-hyper-blame.demo.1.sh +3 -0
  146. data/vendor/depot_tools/man/src/git-hyper-blame.demo.2.sh +4 -0
  147. data/vendor/depot_tools/man/src/git-hyper-blame.demo.common.sh +57 -0
  148. data/vendor/depot_tools/man/src/git-hyper-blame.txt +85 -0
  149. data/vendor/depot_tools/man/src/git-rebase-update.txt +5 -1
  150. data/vendor/depot_tools/my_activity.py +6 -21
  151. data/vendor/depot_tools/ninja +2 -2
  152. data/vendor/depot_tools/ninja-linux32 +0 -0
  153. data/vendor/depot_tools/ninja-linux64 +0 -0
  154. data/vendor/depot_tools/ninja-mac +0 -0
  155. data/vendor/depot_tools/ninja.exe +0 -0
  156. data/vendor/depot_tools/presubmit_canned_checks.py +83 -69
  157. data/vendor/depot_tools/presubmit_support.py +126 -42
  158. data/vendor/depot_tools/pylint.py +5 -1
  159. data/vendor/depot_tools/python_runner.sh +55 -0
  160. data/vendor/depot_tools/recipe_modules/bot_update/__init__.py +32 -0
  161. data/vendor/depot_tools/recipe_modules/bot_update/api.py +283 -0
  162. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic.json +56 -0
  163. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_output_manifest.json +63 -0
  164. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/basic_with_branch_heads.json +57 -0
  165. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/clobber.json +44 -0
  166. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/forced.json +57 -0
  167. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/gerrit_no_reset.json +44 -0
  168. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/no_shallow.json +44 -0
  169. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/off.json +43 -0
  170. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/reset_root_solution_revision.json +43 -0
  171. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/svn_mode.json +59 -0
  172. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange.json +58 -0
  173. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/trychange_oauth2.json +60 -0
  174. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob.json +58 -0
  175. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +60 -0
  176. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +81 -0
  177. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +81 -0
  178. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_gerrit_angle.json +49 -0
  179. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8.json +61 -0
  180. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_v8_head_by_default.json +51 -0
  181. data/vendor/depot_tools/recipe_modules/bot_update/example.py +172 -0
  182. data/vendor/depot_tools/{bootstrap/virtualenv/virtualenv_support → recipe_modules/bot_update/resources}/__init__.py +0 -0
  183. data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +1764 -0
  184. data/vendor/depot_tools/recipe_modules/bot_update/test_api.py +86 -0
  185. data/vendor/depot_tools/recipe_modules/depot_tools/__init__.py +3 -0
  186. data/vendor/depot_tools/recipe_modules/depot_tools/api.py +27 -0
  187. data/vendor/depot_tools/recipe_modules/gclient/__init__.py +10 -0
  188. data/vendor/depot_tools/recipe_modules/gclient/api.py +378 -0
  189. data/vendor/depot_tools/recipe_modules/gclient/config.py +671 -0
  190. data/vendor/depot_tools/recipe_modules/gclient/example.expected/basic.json +172 -0
  191. data/vendor/depot_tools/recipe_modules/gclient/example.expected/revision.json +174 -0
  192. data/vendor/depot_tools/recipe_modules/gclient/example.expected/tryserver.json +185 -0
  193. data/vendor/depot_tools/recipe_modules/gclient/example.py +100 -0
  194. data/vendor/depot_tools/recipe_modules/gclient/test_api.py +37 -0
  195. data/vendor/depot_tools/recipe_modules/git/__init__.py +9 -0
  196. data/vendor/depot_tools/recipe_modules/git/api.py +377 -0
  197. data/vendor/depot_tools/recipe_modules/git/example.expected/basic.json +177 -0
  198. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_branch.json +177 -0
  199. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_file_name.json +179 -0
  200. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_hash.json +176 -0
  201. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_ref.json +177 -0
  202. data/vendor/depot_tools/recipe_modules/git/example.expected/basic_submodule_update_force.json +178 -0
  203. data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +153 -0
  204. data/vendor/depot_tools/recipe_modules/git/example.expected/cannot_fail_build.json +181 -0
  205. data/vendor/depot_tools/recipe_modules/git/example.expected/cat-file_test.json +199 -0
  206. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_delta.json +250 -0
  207. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_failed.json +181 -0
  208. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output.json +182 -0
  209. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +102 -0
  210. data/vendor/depot_tools/recipe_modules/git/example.expected/curl_trace_file.json +181 -0
  211. data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +186 -0
  212. data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +179 -0
  213. data/vendor/depot_tools/recipe_modules/git/example.expected/remote_not_origin.json +179 -0
  214. data/vendor/depot_tools/recipe_modules/git/example.expected/set_got_revision.json +178 -0
  215. data/vendor/depot_tools/recipe_modules/git/example.py +147 -0
  216. data/vendor/depot_tools/recipe_modules/git/resources/git_setup.py +61 -0
  217. data/vendor/depot_tools/recipe_modules/git/test_api.py +18 -0
  218. data/vendor/depot_tools/recipe_modules/git_cl/__init__.py +4 -0
  219. data/vendor/depot_tools/recipe_modules/git_cl/api.py +25 -0
  220. data/vendor/depot_tools/recipe_modules/git_cl/config.py +22 -0
  221. data/vendor/depot_tools/recipe_modules/git_cl/example.expected/basic.json +66 -0
  222. data/vendor/depot_tools/recipe_modules/git_cl/example.py +41 -0
  223. data/vendor/depot_tools/recipe_modules/infra_paths/__init__.py +4 -0
  224. data/vendor/depot_tools/recipe_modules/infra_paths/api.py +12 -0
  225. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/basic.json +14 -0
  226. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_linux.json +14 -0
  227. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_mac.json +14 -0
  228. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_buildbot_win.json +14 -0
  229. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_linux.json +14 -0
  230. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_mac.json +14 -0
  231. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_kitchen_win.json +14 -0
  232. data/vendor/depot_tools/recipe_modules/infra_paths/example.py +28 -0
  233. data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +45 -0
  234. data/vendor/depot_tools/recipe_modules/presubmit/__init__.py +4 -0
  235. data/vendor/depot_tools/recipe_modules/presubmit/api.py +20 -0
  236. data/vendor/depot_tools/recipe_modules/presubmit/example.expected/basic.json +18 -0
  237. data/vendor/depot_tools/recipe_modules/presubmit/example.py +15 -0
  238. data/vendor/depot_tools/recipe_modules/rietveld/__init__.py +5 -0
  239. data/vendor/depot_tools/recipe_modules/rietveld/api.py +94 -0
  240. data/vendor/depot_tools/recipe_modules/rietveld/example.expected/basic.json +30 -0
  241. data/vendor/depot_tools/recipe_modules/rietveld/example.py +24 -0
  242. data/vendor/depot_tools/recipe_modules/tryserver/__init__.py +15 -0
  243. data/vendor/depot_tools/recipe_modules/tryserver/api.py +280 -0
  244. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +104 -0
  245. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +58 -0
  246. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +58 -0
  247. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_svn_patch.json +68 -0
  248. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +43 -0
  249. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +43 -0
  250. data/vendor/depot_tools/recipe_modules/tryserver/example.py +53 -0
  251. data/vendor/depot_tools/recipe_modules/tryserver/test_api.py +7 -0
  252. data/vendor/depot_tools/recipes.py +136 -0
  253. data/vendor/depot_tools/repo +1 -1
  254. data/vendor/depot_tools/rietveld.py +46 -15
  255. data/vendor/depot_tools/roll_dep.py +97 -36
  256. data/vendor/depot_tools/scm.py +3 -3
  257. data/vendor/depot_tools/setup_color.py +94 -0
  258. data/vendor/depot_tools/subprocess2.py +10 -1
  259. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -1
  260. data/vendor/depot_tools/third_party/cq_client/README.md +47 -9
  261. data/vendor/depot_tools/third_party/cq_client/cq.pb.go +617 -0
  262. data/vendor/depot_tools/third_party/cq_client/cq.proto +75 -17
  263. data/vendor/depot_tools/third_party/cq_client/cq_pb2.py +168 -41
  264. data/vendor/depot_tools/third_party/cq_client/testdata/cq_gerrit.cfg +55 -0
  265. data/vendor/depot_tools/third_party/cq_client/{test/cq_example.cfg → testdata/cq_rietveld.cfg} +14 -6
  266. data/vendor/depot_tools/third_party/fancy_urllib/README +5 -4
  267. data/vendor/depot_tools/third_party/fancy_urllib/__init__.py +114 -52
  268. data/vendor/depot_tools/third_party/protobuf26/README.chromium +9 -6
  269. data/vendor/depot_tools/third_party/upload.py +17 -31
  270. data/vendor/depot_tools/trychange.py +0 -2
  271. data/vendor/depot_tools/update_depot_tools +29 -11
  272. data/vendor/depot_tools/update_depot_tools.bat +4 -9
  273. data/vendor/depot_tools/upload_to_google_storage.py +42 -5
  274. data/vendor/depot_tools/win_toolchain/OWNERS +1 -0
  275. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +227 -52
  276. data/vendor/depot_tools/win_toolchain/package_from_installed.py +203 -88
  277. metadata +161 -81
  278. data/patches/arm/do-not-imply-vfp3-and-armv7.patch +0 -16
  279. data/patches/arm/do-not-use-vfp2.patch +0 -13
  280. data/patches/clang51/no-unused-variable.patch +0 -12
  281. data/vendor/depot_tools/bootstrap/.gitignore +0 -2
  282. data/vendor/depot_tools/bootstrap/bootstrap.py +0 -234
  283. data/vendor/depot_tools/bootstrap/deps.pyl +0 -15
  284. data/vendor/depot_tools/bootstrap/util.py +0 -87
  285. data/vendor/depot_tools/bootstrap/virtualenv/.gitignore +0 -10
  286. data/vendor/depot_tools/bootstrap/virtualenv/.travis.yml +0 -28
  287. data/vendor/depot_tools/bootstrap/virtualenv/AUTHORS.txt +0 -91
  288. data/vendor/depot_tools/bootstrap/virtualenv/CONTRIBUTING.rst +0 -21
  289. data/vendor/depot_tools/bootstrap/virtualenv/LICENSE.txt +0 -22
  290. data/vendor/depot_tools/bootstrap/virtualenv/MANIFEST.in +0 -11
  291. data/vendor/depot_tools/bootstrap/virtualenv/README.rst +0 -10
  292. data/vendor/depot_tools/bootstrap/virtualenv/bin/rebuild-script.py +0 -71
  293. data/vendor/depot_tools/bootstrap/virtualenv/docs/changes.rst +0 -747
  294. data/vendor/depot_tools/bootstrap/virtualenv/docs/conf.py +0 -149
  295. data/vendor/depot_tools/bootstrap/virtualenv/docs/development.rst +0 -61
  296. data/vendor/depot_tools/bootstrap/virtualenv/docs/index.rst +0 -137
  297. data/vendor/depot_tools/bootstrap/virtualenv/docs/installation.rst +0 -58
  298. data/vendor/depot_tools/bootstrap/virtualenv/docs/make.bat +0 -170
  299. data/vendor/depot_tools/bootstrap/virtualenv/docs/reference.rst +0 -256
  300. data/vendor/depot_tools/bootstrap/virtualenv/docs/userguide.rst +0 -249
  301. data/vendor/depot_tools/bootstrap/virtualenv/scripts/virtualenv +0 -3
  302. data/vendor/depot_tools/bootstrap/virtualenv/setup.py +0 -111
  303. data/vendor/depot_tools/bootstrap/virtualenv/tests/test_activate.sh +0 -94
  304. data/vendor/depot_tools/bootstrap/virtualenv/tests/test_activate_expected.output +0 -2
  305. data/vendor/depot_tools/bootstrap/virtualenv/tests/test_virtualenv.py +0 -139
  306. data/vendor/depot_tools/bootstrap/virtualenv/tests/tox.ini +0 -12
  307. data/vendor/depot_tools/bootstrap/virtualenv/tox.ini +0 -17
  308. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv.py +0 -2367
  309. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.bat +0 -26
  310. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.csh +0 -42
  311. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.fish +0 -74
  312. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.ps1 +0 -150
  313. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate.sh +0 -80
  314. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/activate_this.py +0 -34
  315. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/deactivate.bat +0 -20
  316. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/distutils-init.py +0 -101
  317. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/distutils.cfg +0 -6
  318. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_embedded/site.py +0 -758
  319. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_support/pip-6.0-py2.py3-none-any.whl +0 -0
  320. data/vendor/depot_tools/bootstrap/virtualenv/virtualenv_support/setuptools-8.2.1-py2.py3-none-any.whl +0 -0
  321. data/vendor/depot_tools/bootstrap/win/README.google +0 -16
  322. data/vendor/depot_tools/cbuildbot +0 -96
  323. data/vendor/depot_tools/chrome_set_ver +0 -96
  324. data/vendor/depot_tools/cros +0 -96
  325. data/vendor/depot_tools/cros_sdk +0 -96
  326. data/vendor/depot_tools/git-cl-upload-hook +0 -52
  327. data/vendor/depot_tools/git-crup +0 -45
  328. data/vendor/depot_tools/python_git_runner.sh +0 -36
  329. data/vendor/depot_tools/recipes/blink.py +0 -59
  330. data/vendor/depot_tools/third_party/cq_client/test/validate_config_test.py +0 -52
  331. data/vendor/depot_tools/third_party/cq_client/validate_config.py +0 -108
  332. data/vendor/depot_tools/win_toolchain/toolchain2013.py +0 -494
@@ -22,6 +22,8 @@ import functools
22
22
  import logging
23
23
  import os
24
24
  import re
25
+ import setup_color
26
+ import shutil
25
27
  import signal
26
28
  import sys
27
29
  import tempfile
@@ -32,7 +34,8 @@ import subprocess2
32
34
 
33
35
  ROOT = os.path.abspath(os.path.dirname(__file__))
34
36
 
35
- GIT_EXE = ROOT+'\\git.bat' if sys.platform.startswith('win') else 'git'
37
+ IS_WIN = sys.platform == 'win32'
38
+ GIT_EXE = ROOT+'\\git.bat' if IS_WIN else 'git'
36
39
  TEST_MODE = False
37
40
 
38
41
  FREEZE = 'FREEZE'
@@ -279,15 +282,34 @@ def once(function):
279
282
  ## Git functions
280
283
 
281
284
 
285
+ def blame(filename, revision=None, porcelain=False, *_args):
286
+ command = ['blame']
287
+ if porcelain:
288
+ command.append('-p')
289
+ if revision is not None:
290
+ command.append(revision)
291
+ command.extend(['--', filename])
292
+ return run(*command)
293
+
294
+
282
295
  def branch_config(branch, option, default=None):
283
296
  return config('branch.%s.%s' % (branch, option), default=default)
284
297
 
285
298
 
299
+ def config_regexp(pattern):
300
+ if IS_WIN: # pragma: no cover
301
+ # this madness is because we call git.bat which calls git.exe which calls
302
+ # bash.exe (or something to that effect). Each layer divides the number of
303
+ # ^'s by 2.
304
+ pattern = pattern.replace('^', '^' * 8)
305
+ return run('config', '--get-regexp', pattern).splitlines()
306
+
307
+
286
308
  def branch_config_map(option):
287
309
  """Return {branch: <|option| value>} for all branches."""
288
310
  try:
289
311
  reg = re.compile(r'^branch\.(.*)\.%s$' % option)
290
- lines = run('config', '--get-regexp', reg.pattern).splitlines()
312
+ lines = config_regexp(reg.pattern)
291
313
  return {reg.match(k).group(1): v for k, v in (l.split() for l in lines)}
292
314
  except subprocess2.CalledProcessError:
293
315
  return {}
@@ -353,18 +375,22 @@ def del_config(option, scope='local'):
353
375
  pass
354
376
 
355
377
 
378
+ def diff(oldrev, newrev, *args):
379
+ return run('diff', oldrev, newrev, *args)
380
+
381
+
356
382
  def freeze():
357
383
  took_action = False
358
384
 
359
385
  try:
360
- run('commit', '-m', FREEZE + '.indexed')
386
+ run('commit', '--no-verify', '-m', FREEZE + '.indexed')
361
387
  took_action = True
362
388
  except subprocess2.CalledProcessError:
363
389
  pass
364
390
 
365
391
  try:
366
392
  run('add', '-A')
367
- run('commit', '-m', FREEZE + '.unindexed')
393
+ run('commit', '--no-verify', '-m', FREEZE + '.unindexed')
368
394
  took_action = True
369
395
  except subprocess2.CalledProcessError:
370
396
  pass
@@ -411,7 +437,7 @@ def get_or_create_merge_base(branch, parent=None):
411
437
  def is_ancestor(a, b):
412
438
  return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0
413
439
 
414
- if base:
440
+ if base and base != actual_merge_base:
415
441
  if not is_ancestor(base, branch):
416
442
  logging.debug('Found WRONG pre-set merge-base for %s: %s', branch, base)
417
443
  base = None
@@ -535,10 +561,39 @@ def remove_merge_base(branch):
535
561
  del_branch_config(branch, 'base-upstream')
536
562
 
537
563
 
564
+ def repo_root():
565
+ """Returns the absolute path to the repository root."""
566
+ return run('rev-parse', '--show-toplevel')
567
+
568
+
538
569
  def root():
539
570
  return config('depot-tools.upstream', 'origin/master')
540
571
 
541
572
 
573
+ @contextlib.contextmanager
574
+ def less(): # pragma: no cover
575
+ """Runs 'less' as context manager yielding its stdin as a PIPE.
576
+
577
+ Automatically checks if sys.stdout is a non-TTY stream. If so, it avoids
578
+ running less and just yields sys.stdout.
579
+ """
580
+ if not setup_color.IS_TTY:
581
+ yield sys.stdout
582
+ return
583
+
584
+ # Run with the same options that git uses (see setup_pager in git repo).
585
+ # -F: Automatically quit if the output is less than one screen.
586
+ # -R: Don't escape ANSI color codes.
587
+ # -X: Don't clear the screen before starting.
588
+ cmd = ('less', '-FRX')
589
+ try:
590
+ proc = subprocess2.Popen(cmd, stdin=subprocess2.PIPE)
591
+ yield proc.stdin
592
+ finally:
593
+ proc.stdin.close()
594
+ proc.wait()
595
+
596
+
542
597
  def run(*cmd, **kwargs):
543
598
  """The same as run_with_stderr, except it only returns stdout."""
544
599
  return run_with_stderr(*cmd, **kwargs)[0]
@@ -552,7 +607,6 @@ def run_with_retcode(*cmd, **kwargs):
552
607
  except subprocess2.CalledProcessError as cpe:
553
608
  return cpe.returncode
554
609
 
555
-
556
610
  def run_stream(*cmd, **kwargs):
557
611
  """Runs a git command. Returns stdout as a PIPE (file-like object).
558
612
 
@@ -561,6 +615,7 @@ def run_stream(*cmd, **kwargs):
561
615
  """
562
616
  kwargs.setdefault('stderr', subprocess2.VOID)
563
617
  kwargs.setdefault('stdout', subprocess2.PIPE)
618
+ kwargs.setdefault('shell', False)
564
619
  cmd = (GIT_EXE, '-c', 'color.ui=never') + cmd
565
620
  proc = subprocess2.Popen(cmd, **kwargs)
566
621
  return proc.stdout
@@ -577,6 +632,7 @@ def run_stream_with_retcode(*cmd, **kwargs):
577
632
  """
578
633
  kwargs.setdefault('stderr', subprocess2.VOID)
579
634
  kwargs.setdefault('stdout', subprocess2.PIPE)
635
+ kwargs.setdefault('shell', False)
580
636
  cmd = (GIT_EXE, '-c', 'color.ui=never') + cmd
581
637
  try:
582
638
  proc = subprocess2.Popen(cmd, **kwargs)
@@ -600,6 +656,7 @@ def run_with_stderr(*cmd, **kwargs):
600
656
  kwargs.setdefault('stdin', subprocess2.PIPE)
601
657
  kwargs.setdefault('stdout', subprocess2.PIPE)
602
658
  kwargs.setdefault('stderr', subprocess2.PIPE)
659
+ kwargs.setdefault('shell', False)
603
660
  autostrip = kwargs.pop('autostrip', True)
604
661
  indata = kwargs.pop('indata', None)
605
662
 
@@ -817,3 +874,40 @@ def get_branches_info(include_tracking_status):
817
874
  missing_upstreams[info.upstream] = None
818
875
 
819
876
  return dict(info_map.items() + missing_upstreams.items())
877
+
878
+
879
+ def make_workdir_common(repository, new_workdir, files_to_symlink,
880
+ files_to_copy, symlink=None):
881
+ if not symlink:
882
+ symlink = os.symlink
883
+ os.makedirs(new_workdir)
884
+ for entry in files_to_symlink:
885
+ clone_file(repository, new_workdir, entry, symlink)
886
+ for entry in files_to_copy:
887
+ clone_file(repository, new_workdir, entry, shutil.copy)
888
+
889
+
890
+ def make_workdir(repository, new_workdir):
891
+ GIT_DIRECTORY_WHITELIST = [
892
+ 'config',
893
+ 'info',
894
+ 'hooks',
895
+ 'logs/refs',
896
+ 'objects',
897
+ 'packed-refs',
898
+ 'refs',
899
+ 'remotes',
900
+ 'rr-cache',
901
+ 'svn'
902
+ ]
903
+ make_workdir_common(repository, new_workdir, GIT_DIRECTORY_WHITELIST,
904
+ ['HEAD'])
905
+
906
+
907
+ def clone_file(repository, new_workdir, link, operation):
908
+ if not os.path.exists(os.path.join(repository, link)):
909
+ return
910
+ link_dir = os.path.dirname(os.path.join(new_workdir, link))
911
+ if not os.path.exists(link_dir):
912
+ os.makedirs(link_dir)
913
+ operation(os.path.join(repository, link), os.path.join(new_workdir, link))
@@ -0,0 +1,62 @@
1
+ # Copyright 2016 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
+ """Utility module for dealing with Git timestamps."""
6
+
7
+ import datetime
8
+
9
+
10
+ def timestamp_offset_to_datetime(timestamp, offset):
11
+ """Converts a timestamp + offset into a datetime.datetime.
12
+
13
+ Useful for dealing with the output of porcelain commands, which provide times
14
+ as timestamp and offset strings.
15
+
16
+ Args:
17
+ timestamp: An int UTC timestamp, or a string containing decimal digits.
18
+ offset: A str timezone offset. e.g., '-0800'.
19
+
20
+ Returns:
21
+ A tz-aware datetime.datetime for this timestamp.
22
+ """
23
+ timestamp = int(timestamp)
24
+ tz = FixedOffsetTZ.from_offset_string(offset)
25
+ return datetime.datetime.fromtimestamp(timestamp, tz)
26
+
27
+
28
+ def datetime_string(dt):
29
+ """Converts a tz-aware datetime.datetime into a string in git format."""
30
+ return dt.strftime('%Y-%m-%d %H:%M:%S %z')
31
+
32
+
33
+ # Adapted from: https://docs.python.org/2/library/datetime.html#tzinfo-objects
34
+ class FixedOffsetTZ(datetime.tzinfo):
35
+ def __init__(self, offset, name):
36
+ datetime.tzinfo.__init__(self)
37
+ self.__offset = offset
38
+ self.__name = name
39
+
40
+ def __repr__(self): # pragma: no cover
41
+ return '{}({!r}, {!r})'.format(type(self).__name__, self.__offset,
42
+ self.__name)
43
+
44
+ @classmethod
45
+ def from_offset_string(cls, offset):
46
+ try:
47
+ hours = int(offset[:-2])
48
+ minutes = int(offset[-2:])
49
+ except ValueError:
50
+ return cls(datetime.timedelta(0), 'UTC')
51
+
52
+ delta = datetime.timedelta(hours=hours, minutes=minutes)
53
+ return cls(delta, offset)
54
+
55
+ def utcoffset(self, dt):
56
+ return self.__offset
57
+
58
+ def tzname(self, dt):
59
+ return self.__name
60
+
61
+ def dst(self, dt):
62
+ return datetime.timedelta(0)
@@ -0,0 +1,424 @@
1
+ #!/usr/bin/env python
2
+ # Copyright 2015 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
+ """git drover: A tool for merging changes to release branches."""
6
+
7
+ import argparse
8
+ import cPickle
9
+ import functools
10
+ import logging
11
+ import os
12
+ import shutil
13
+ import subprocess
14
+ import sys
15
+ import tempfile
16
+
17
+ import git_common
18
+
19
+
20
+ class Error(Exception):
21
+ pass
22
+
23
+
24
+ _PATCH_ERROR_MESSAGE = """Patch failed to apply.
25
+
26
+ A workdir for this cherry-pick has been created in
27
+ {0}
28
+
29
+ To continue, resolve the conflicts there and run
30
+ git drover --continue {0}
31
+
32
+ To abort this cherry-pick run
33
+ git drover --abort {0}
34
+ """
35
+
36
+
37
+ class PatchError(Error):
38
+ """An error indicating that the patch failed to apply."""
39
+
40
+ def __init__(self, workdir):
41
+ super(PatchError, self).__init__(_PATCH_ERROR_MESSAGE.format(workdir))
42
+
43
+
44
+ _DEV_NULL_FILE = open(os.devnull, 'w')
45
+
46
+ if os.name == 'nt':
47
+ # This is a just-good-enough emulation of os.symlink for drover to work on
48
+ # Windows. It uses junctioning of directories (most of the contents of
49
+ # the .git directory), but copies files. Note that we can't use
50
+ # CreateSymbolicLink or CreateHardLink here, as they both require elevation.
51
+ # Creating reparse points is what we want for the directories, but doing so
52
+ # is a relatively messy set of DeviceIoControl work at the API level, so we
53
+ # simply shell to `mklink /j` instead.
54
+ def emulate_symlink_windows(source, link_name):
55
+ if os.path.isdir(source):
56
+ subprocess.check_call(['mklink', '/j',
57
+ link_name.replace('/', '\\'),
58
+ source.replace('/', '\\')],
59
+ shell=True)
60
+ else:
61
+ shutil.copy(source, link_name)
62
+ mk_symlink = emulate_symlink_windows
63
+ else:
64
+ mk_symlink = os.symlink
65
+
66
+
67
+ class _Drover(object):
68
+
69
+ def __init__(self, branch, revision, parent_repo, dry_run, verbose):
70
+ self._branch = branch
71
+ self._branch_ref = 'refs/remotes/branch-heads/%s' % branch
72
+ self._revision = revision
73
+ self._parent_repo = os.path.abspath(parent_repo)
74
+ self._dry_run = dry_run
75
+ self._workdir = None
76
+ self._branch_name = None
77
+ self._needs_cleanup = True
78
+ self._verbose = verbose
79
+ self._process_options()
80
+
81
+ def _process_options(self):
82
+ if self._verbose:
83
+ logging.getLogger().setLevel(logging.DEBUG)
84
+
85
+
86
+ @classmethod
87
+ def resume(cls, workdir):
88
+ """Continues a cherry-pick that required manual resolution.
89
+
90
+ Args:
91
+ workdir: A string containing the path to the workdir used by drover.
92
+ """
93
+ drover = cls._restore_drover(workdir)
94
+ drover._continue()
95
+
96
+ @classmethod
97
+ def abort(cls, workdir):
98
+ """Aborts a cherry-pick that required manual resolution.
99
+
100
+ Args:
101
+ workdir: A string containing the path to the workdir used by drover.
102
+ """
103
+ drover = cls._restore_drover(workdir)
104
+ drover._cleanup()
105
+
106
+ @staticmethod
107
+ def _restore_drover(workdir):
108
+ """Restores a saved drover state contained within a workdir.
109
+
110
+ Args:
111
+ workdir: A string containing the path to the workdir used by drover.
112
+ """
113
+ try:
114
+ with open(os.path.join(workdir, '.git', 'drover'), 'rb') as f:
115
+ drover = cPickle.load(f)
116
+ drover._process_options()
117
+ return drover
118
+ except (IOError, cPickle.UnpicklingError):
119
+ raise Error('%r is not git drover workdir' % workdir)
120
+
121
+ def _continue(self):
122
+ if os.path.exists(os.path.join(self._workdir, '.git', 'CHERRY_PICK_HEAD')):
123
+ self._run_git_command(
124
+ ['commit', '--no-edit'],
125
+ error_message='All conflicts must be resolved before continuing')
126
+
127
+ if self._upload_and_land():
128
+ # Only clean up the workdir on success. The manually resolved cherry-pick
129
+ # can be reused if the user cancels before landing.
130
+ self._cleanup()
131
+
132
+ def run(self):
133
+ """Runs this Drover instance.
134
+
135
+ Raises:
136
+ Error: An error occurred while attempting to cherry-pick this change.
137
+ """
138
+ try:
139
+ self._run_internal()
140
+ finally:
141
+ self._cleanup()
142
+
143
+ def _run_internal(self):
144
+ self._check_inputs()
145
+ if not self._confirm('Going to cherry-pick\n"""\n%s"""\nto %s.' % (
146
+ self._run_git_command(['show', '-s', self._revision]), self._branch)):
147
+ return
148
+ self._create_checkout()
149
+ self._perform_cherry_pick()
150
+ self._upload_and_land()
151
+
152
+ def _cleanup(self):
153
+ if not self._needs_cleanup:
154
+ return
155
+
156
+ if self._workdir:
157
+ logging.debug('Deleting %s', self._workdir)
158
+ if os.name == 'nt':
159
+ try:
160
+ # Use rmdir to properly handle the junctions we created.
161
+ subprocess.check_call(
162
+ ['rmdir', '/s', '/q', self._workdir], shell=True)
163
+ except subprocess.CalledProcessError:
164
+ logging.error(
165
+ 'Failed to delete workdir %r. Please remove it manually.',
166
+ self._workdir)
167
+ else:
168
+ shutil.rmtree(self._workdir)
169
+ self._workdir = None
170
+ if self._branch_name:
171
+ self._run_git_command(['branch', '-D', self._branch_name])
172
+
173
+ @staticmethod
174
+ def _confirm(message):
175
+ """Show a confirmation prompt with the given message.
176
+
177
+ Returns:
178
+ A bool representing whether the user wishes to continue.
179
+ """
180
+ result = ''
181
+ while result not in ('y', 'n'):
182
+ try:
183
+ result = raw_input('%s Continue (y/n)? ' % message)
184
+ except EOFError:
185
+ result = 'n'
186
+ return result == 'y'
187
+
188
+ def _check_inputs(self):
189
+ """Check the input arguments and ensure the parent repo is up to date."""
190
+
191
+ if not os.path.isdir(self._parent_repo):
192
+ raise Error('Invalid parent repo path %r' % self._parent_repo)
193
+
194
+ self._run_git_command(['--help'], error_message='Unable to run git')
195
+ self._run_git_command(['status'],
196
+ error_message='%r is not a valid git repo' %
197
+ os.path.abspath(self._parent_repo))
198
+ self._run_git_command(['fetch', 'origin'],
199
+ error_message='Failed to fetch origin')
200
+ self._run_git_command(
201
+ ['rev-parse', '%s^{commit}' % self._branch_ref],
202
+ error_message='Branch %s not found' % self._branch_ref)
203
+ self._run_git_command(
204
+ ['rev-parse', '%s^{commit}' % self._revision],
205
+ error_message='Revision "%s" not found' % self._revision)
206
+
207
+ FILES_TO_LINK = [
208
+ 'refs',
209
+ 'logs/refs',
210
+ 'info/refs',
211
+ 'info/exclude',
212
+ 'objects',
213
+ 'hooks',
214
+ 'packed-refs',
215
+ 'remotes',
216
+ 'rr-cache',
217
+ 'svn',
218
+ ]
219
+ FILES_TO_COPY = ['config', 'HEAD']
220
+
221
+ def _create_checkout(self):
222
+ """Creates a checkout to use for cherry-picking.
223
+
224
+ This creates a checkout similarly to git-new-workdir. Most of the .git
225
+ directory is shared with the |self._parent_repo| using symlinks. This
226
+ differs from git-new-workdir in that the config is forked instead of shared.
227
+ This is so the new workdir can be a sparse checkout without affecting
228
+ |self._parent_repo|.
229
+ """
230
+ parent_git_dir = os.path.join(self._parent_repo, self._run_git_command(
231
+ ['rev-parse', '--git-dir']).strip())
232
+ self._workdir = tempfile.mkdtemp(prefix='drover_%s_' % self._branch)
233
+ logging.debug('Creating checkout in %s', self._workdir)
234
+ git_dir = os.path.join(self._workdir, '.git')
235
+ git_common.make_workdir_common(parent_git_dir, git_dir, self.FILES_TO_LINK,
236
+ self.FILES_TO_COPY, mk_symlink)
237
+ self._run_git_command(['config', 'core.sparsecheckout', 'true'])
238
+ with open(os.path.join(git_dir, 'info', 'sparse-checkout'), 'w') as f:
239
+ f.write('/codereview.settings')
240
+
241
+ branch_name = os.path.split(self._workdir)[-1]
242
+ self._run_git_command(['checkout', '-b', branch_name, self._branch_ref])
243
+ self._branch_name = branch_name
244
+
245
+ def _perform_cherry_pick(self):
246
+ try:
247
+ self._run_git_command(['cherry-pick', '-x', self._revision],
248
+ error_message='Patch failed to apply')
249
+ except Error:
250
+ self._prepare_manual_resolve()
251
+ self._save_state()
252
+ self._needs_cleanup = False
253
+ raise PatchError(self._workdir)
254
+
255
+ def _save_state(self):
256
+ """Saves the state of this Drover instances to the workdir."""
257
+ with open(os.path.join(self._workdir, '.git', 'drover'), 'wb') as f:
258
+ cPickle.dump(self, f)
259
+
260
+ def _prepare_manual_resolve(self):
261
+ """Prepare the workdir for the user to manually resolve the cherry-pick."""
262
+ # Files that have been deleted between branch and cherry-pick will not have
263
+ # their skip-worktree bit set so set it manually for those files to avoid
264
+ # git status incorrectly listing them as unstaged deletes.
265
+ repo_status = self._run_git_command(['status', '--porcelain']).splitlines()
266
+ extra_files = [f[3:] for f in repo_status if f[:2] == ' D']
267
+ if extra_files:
268
+ self._run_git_command(['update-index', '--skip-worktree', '--'] +
269
+ extra_files)
270
+
271
+ def _upload_and_land(self):
272
+ if self._dry_run:
273
+ logging.info('--dry_run enabled; not landing.')
274
+ return True
275
+
276
+ self._run_git_command(['reset', '--hard'])
277
+ self._run_git_command(['cl', 'upload'],
278
+ error_message='Upload failed',
279
+ interactive=True)
280
+
281
+ if not self._confirm('About to land on %s.' % self._branch):
282
+ return False
283
+ self._run_git_command(['cl', 'land', '--bypass-hooks'], interactive=True)
284
+ return True
285
+
286
+ def _run_git_command(self, args, error_message=None, interactive=False):
287
+ """Runs a git command.
288
+
289
+ Args:
290
+ args: A list of strings containing the args to pass to git.
291
+ error_message: A string containing the error message to report if the
292
+ command fails.
293
+ interactive: A bool containing whether the command requires user
294
+ interaction. If false, the command will be provided with no input and
295
+ the output is captured.
296
+
297
+ Raises:
298
+ Error: The command failed to complete successfully.
299
+ """
300
+ cwd = self._workdir if self._workdir else self._parent_repo
301
+ logging.debug('Running git %s (cwd %r)', ' '.join('%s' % arg
302
+ for arg in args), cwd)
303
+
304
+ run = subprocess.check_call if interactive else subprocess.check_output
305
+
306
+ # Discard stderr unless verbose is enabled.
307
+ stderr = None if self._verbose else _DEV_NULL_FILE
308
+
309
+ try:
310
+ return run(['git'] + args, shell=False, cwd=cwd, stderr=stderr)
311
+ except (OSError, subprocess.CalledProcessError) as e:
312
+ if error_message:
313
+ raise Error(error_message)
314
+ else:
315
+ raise Error('Command %r failed: %s' % (' '.join(args), e))
316
+
317
+
318
+ def cherry_pick_change(branch, revision, parent_repo, dry_run, verbose=False):
319
+ """Cherry-picks a change into a branch.
320
+
321
+ Args:
322
+ branch: A string containing the release branch number to which to
323
+ cherry-pick.
324
+ revision: A string containing the revision to cherry-pick. It can be any
325
+ string that git-rev-parse can identify as referring to a single
326
+ revision.
327
+ parent_repo: A string containing the path to the parent repo to use for this
328
+ cherry-pick.
329
+ dry_run: A bool containing whether to stop before uploading the
330
+ cherry-pick cl.
331
+ verbose: A bool containing whether to print verbose logging.
332
+
333
+ Raises:
334
+ Error: An error occurred while attempting to cherry-pick |cl| to |branch|.
335
+ """
336
+ drover = _Drover(branch, revision, parent_repo, dry_run, verbose)
337
+ drover.run()
338
+
339
+
340
+ def continue_cherry_pick(workdir):
341
+ """Continues a cherry-pick that required manual resolution.
342
+
343
+ Args:
344
+ workdir: A string containing the path to the workdir used by drover.
345
+ """
346
+ _Drover.resume(workdir)
347
+
348
+
349
+ def abort_cherry_pick(workdir):
350
+ """Aborts a cherry-pick that required manual resolution.
351
+
352
+ Args:
353
+ workdir: A string containing the path to the workdir used by drover.
354
+ """
355
+ _Drover.abort(workdir)
356
+
357
+
358
+ def main():
359
+ parser = argparse.ArgumentParser(
360
+ description='Cherry-pick a change into a release branch.')
361
+ group = parser.add_mutually_exclusive_group(required=True)
362
+ parser.add_argument(
363
+ '--branch',
364
+ type=str,
365
+ metavar='<branch>',
366
+ help='the name of the branch to which to cherry-pick; e.g. 1234')
367
+ group.add_argument(
368
+ '--cherry-pick',
369
+ type=str,
370
+ metavar='<change>',
371
+ help=('the change to cherry-pick; this can be any string '
372
+ 'that unambiguously refers to a revision not involving HEAD'))
373
+ group.add_argument(
374
+ '--continue',
375
+ type=str,
376
+ nargs='?',
377
+ dest='resume',
378
+ const=os.path.abspath('.'),
379
+ metavar='path_to_workdir',
380
+ help='Continue a drover cherry-pick after resolving conflicts')
381
+ group.add_argument('--abort',
382
+ type=str,
383
+ nargs='?',
384
+ const=os.path.abspath('.'),
385
+ metavar='path_to_workdir',
386
+ help='Abort a drover cherry-pick')
387
+ parser.add_argument(
388
+ '--parent_checkout',
389
+ type=str,
390
+ default=os.path.abspath('.'),
391
+ metavar='<path_to_parent_checkout>',
392
+ help=('the path to the chromium checkout to use as the source for a '
393
+ 'creating git-new-workdir workdir to use for cherry-picking; '
394
+ 'if unspecified, the current directory is used'))
395
+ parser.add_argument(
396
+ '--dry-run',
397
+ action='store_true',
398
+ default=False,
399
+ help=("don't actually upload and land; "
400
+ "just check that cherry-picking would succeed"))
401
+ parser.add_argument('-v',
402
+ '--verbose',
403
+ action='store_true',
404
+ default=False,
405
+ help='show verbose logging')
406
+ options = parser.parse_args()
407
+ try:
408
+ if options.resume:
409
+ _Drover.resume(options.resume)
410
+ elif options.abort:
411
+ _Drover.abort(options.abort)
412
+ else:
413
+ if not options.branch:
414
+ parser.error('argument --branch is required for --cherry-pick')
415
+ cherry_pick_change(options.branch, options.cherry_pick,
416
+ options.parent_checkout, options.dry_run,
417
+ options.verbose)
418
+ except Error as e:
419
+ print 'Error:', e.message
420
+ sys.exit(128)
421
+
422
+
423
+ if __name__ == '__main__':
424
+ main()