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