[git_cl] Refactor EnsureAuthenticated logic.

This will allow us to implement EnsureAuthenticated for other
Authenticator implementations.

R=ayatane@chromium.org

Bug: 336351842
Change-Id: I5ff4efd45eb5baa6baa048842510ec6e18e1b8fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5588510
Auto-Submit: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Reviewed-by: Scott Lee <ddoman@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
2 files changed
tree: e5fa44764f0ca87cd27da3fce7801d866077dd65
  1. bootstrap/
  2. fetch_configs/
  3. hooks/
  4. infra/
  5. man/
  6. metadata/
  7. python-bin/
  8. python2-bin/
  9. recipes/
  10. testing_support/
  11. tests/
  12. third_party/
  13. win_toolchain/
  14. zsh-goodies/
  15. .cipd_impl.ps1
  16. .flake8
  17. .gitattributes
  18. .gitignore
  19. .isort.cfg
  20. .style.yapf
  21. .vpython3
  22. auth.py
  23. autoninja
  24. autoninja.bat
  25. autoninja.py
  26. bazel.py
  27. bb
  28. bb.bat
  29. black
  30. bootstrap_python3
  31. breakpad.py
  32. BUILD_OWNERS
  33. cipd
  34. cipd.bat
  35. cipd_bin_setup.bat
  36. cipd_bin_setup.sh
  37. cipd_client_version
  38. cipd_client_version.digests
  39. cipd_manifest.txt
  40. cipd_manifest.versions
  41. cipd_manifest_cros_python2.txt
  42. cipd_manifest_cros_python2.versions
  43. clang-format
  44. clang-format.bat
  45. clang_format.py
  46. codereview.settings
  47. compile_single_file
  48. compile_single_file.bat
  49. compile_single_file.py
  50. cpplint.bat
  51. cpplint.py
  52. cpplint_chromium.py
  53. cros
  54. CROS_OWNERS
  55. cros_python2.vpython
  56. detect_host_arch.py
  57. DIR_METADATA
  58. dirmd
  59. dirmd.bat
  60. download_from_google_storage
  61. download_from_google_storage.bat
  62. download_from_google_storage.py
  63. ensure_bootstrap
  64. fetch
  65. fetch.bat
  66. fetch.py
  67. gclient
  68. gclient-new-workdir.py
  69. gclient.bat
  70. gclient.py
  71. gclient_completion.sh
  72. gclient_eval.py
  73. gclient_paths.py
  74. gclient_scm.py
  75. gclient_utils.py
  76. gerrit_client.py
  77. gerrit_util.py
  78. git-cache
  79. git-cl
  80. git-credential-luci
  81. git-credential-luci.bat
  82. git-crrev-parse
  83. git-drover
  84. git-find-releases
  85. git-footers
  86. git-freeze
  87. git-gs
  88. git-hyper-blame
  89. git-map
  90. git-map-branches
  91. git-mark-merge-base
  92. git-nav-downstream
  93. git-nav-upstream
  94. git-new-branch
  95. git-number
  96. git-rebase-update
  97. git-rename-branch
  98. git-reparent-branch
  99. git-retry
  100. git-runhooks
  101. git-squash-branch
  102. git-thaw
  103. git-upstream-diff
  104. git_cache.py
  105. git_cl.py
  106. git_cl_completion.sh
  107. git_common.py
  108. git_completion.sh
  109. git_dates.py
  110. git_find_releases.py
  111. git_footers.py
  112. git_freezer.py
  113. git_hyper_blame.py
  114. git_map.py
  115. git_map_branches.py
  116. git_mark_merge_base.py
  117. git_nav_downstream.py
  118. git_new_branch.py
  119. git_number.py
  120. git_rebase_update.py
  121. git_rename_branch.py
  122. git_reparent_branch.py
  123. git_retry.py
  124. git_squash_branch.py
  125. git_upstream_diff.py
  126. gn
  127. gn.bat
  128. gn.py
  129. google-java-format
  130. google-java-format.bat
  131. google_java_format.py
  132. gsutil.py
  133. gsutil.py.bat
  134. gsutil.vpython3
  135. isort
  136. led
  137. led.bat
  138. LICENSE
  139. lockfile.py
  140. luci-auth
  141. luci-auth.bat
  142. LUCI_OWNERS
  143. lucicfg
  144. lucicfg.bat
  145. mac_toolchain
  146. metrics.py
  147. metrics.README.md
  148. metrics_utils.py
  149. my_activity.py
  150. newauth.py
  151. ninja
  152. ninja.bat
  153. ninja.py
  154. ninja_reclient.py
  155. ninjalog.README.md
  156. ninjalog_uploader.py
  157. ninjalog_uploader_wrapper.py
  158. OWNERS
  159. owners_client.py
  160. owners_finder.py
  161. pinpoint
  162. pinpoint.bat
  163. post_build_ninja_summary.py
  164. PRESUBMIT.py
  165. presubmit_canned_checks.py
  166. presubmit_diff.py
  167. presubmit_support.py
  168. prpc
  169. prpc.bat
  170. pylint-2.17
  171. pylint-2.17.bat
  172. pylint-2.6
  173. pylint-2.6.bat
  174. pylint-2.7
  175. pylint-2.7.bat
  176. pylint_main.py
  177. pylintrc
  178. pylintrc-2.17
  179. python_runner.sh
  180. rdb
  181. rdb.bat
  182. rdb_wrapper.py
  183. README.gclient.md
  184. README.git-cl.md
  185. README.md
  186. reclient_helper.py
  187. reclient_metrics
  188. reclient_metrics.bat
  189. reclient_metrics.py
  190. reclient_metrics.README.md
  191. RECLIENT_OWNERS
  192. reclientreport
  193. reclientreport.bat
  194. reclientreport.py
  195. repo
  196. repo_launcher
  197. roll-dep
  198. roll-dep.bat
  199. roll_dep.py
  200. rustfmt.py
  201. scm.py
  202. setup_color.py
  203. siso
  204. siso.bat
  205. siso.py
  206. split_cl.py
  207. subcommand.py
  208. subprocess2.py
  209. swift-format
  210. swift_format.py
  211. update_depot_tools
  212. update_depot_tools.bat
  213. update_depot_tools_toggle.py
  214. upload_metrics.py
  215. upload_to_google_storage.py
  216. upload_to_google_storage_first_class.py
  217. utils.py
  218. vpython3
  219. vpython3.bat
  220. WATCHLISTS
  221. watchlists.py
  222. whitespace.txt
  223. win32imports.py
  224. yapf
  225. yapf.bat
README.md

depot_tools

Tools for working with Chromium development. It requires python 3.8.

Tools

The most important tools are:

  • fetch: A gclient wrapper to checkout a project. Use fetch --help for more details.
  • gclient: A meta-checkout tool. Think repo or git submodules, except that it support OS-specific rules, e.g. do not checkout Windows only dependencies when checking out for Android. Use gclient help for more details and README.gclient.md.
  • git cl: A code review tool to interact with Rietveld or Gerrit. Use git cl help for more details and README.git-cl.md.
  • roll-dep: A gclient dependency management tool to submit a dep roll, updating a dependency to a newer revision.

There are a lot of git utilities included.

Updating

depot_tools updates itself automatically when running gclient tool. To disable auto update, set the environment variable DEPOT_TOOLS_UPDATE=0 or run ./update_depot_tools_toggle.py --disable.

To update package manually, run update_depot_tools.bat on Windows, or ./update_depot_tools on Linux or Mac.

On Windows only, running gclient will install git and python.

Contributing

To contribute change for review:

git new-branch <somename>
# Hack
git add .
git commit -a -m "Fixes goat teleporting"
# find reviewers
git cl owners
git log -- <yourfiles>

# Request a review.
git cl upload -r reviewer1@chromium.org,reviewer2@chromium.org --send-mail

# Edit change description if needed.
git cl desc

# If change is approved, flag it to be committed.
git cl set-commit

# If change needs more work.
git rebase-update
...
git cl upload -t "Fixes goat teleporter destination to be Australia"

See also open bugs, open reviews, forum or report problems.

cpplint.py

Until 2018, our cpplint.py was a copy of the upstream version at https://github.com/google/styleguide/tree/gh-pages/cpplint. Unfortunately, that repository is not maintained any more. If you want to update cpplint.py in depot_tools, just upload a patch to do so. We will figure out a long-term strategy via issue https://crbug.com/916550.

Note that the cpplint.py here is also used by the Tricium analyzer, so if the cpplint.py here changes, we should also update the copy used there.