Fix semantics of git new-branch --upstream

Currently, the "--upstream A" option for new-branch behaves totally
different than "--upstream_current". While "--upstream A" checks out
branch A and then creates a new branch which tracks A,
"--upstream_current" creates a new branch for the current HEAD and sets
the upstream to the previously checked out branch.

As the documentation does not mention that any of the options changes
the currently-checked-out commit (HEAD), this CL changes the semantics
of "git new-branch --upstream A B" to be identical to "git checkout -b B
&& git branch --set-upstream-to A".

It also slightly extends the documentation to mention that in any case
the new branch is based on HEAD.

R=iannucci@chromium.org

Change-Id: Ic335d2caf27cb6afca1b8bc5a008424c0e880fca
Reviewed-on: https://chromium-review.googlesource.com/c/1350748
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Auto-Submit: Clemens Hammacher <clemensh@chromium.org>
5 files changed
tree: ed1d6de90a3b4d33a3fb6b7de1d7f9d49b049f3c
  1. bootstrap/
  2. fetch_configs/
  3. git-templates/
  4. infra/
  5. man/
  6. recipes/
  7. support/
  8. testing_support/
  9. tests/
  10. third_party/
  11. win_toolchain/
  12. zsh-goodies/
  13. .gitattributes
  14. .gitignore
  15. .style.yapf
  16. annotated_gclient.py
  17. appengine_mapper.py
  18. auth.py
  19. autoninja
  20. autoninja.bat
  21. autoninja.py
  22. breakpad.py
  23. buildbucket.py
  24. checkout.py
  25. cipd
  26. cipd.bat
  27. cipd.ps1
  28. cipd_bin_setup.bat
  29. cipd_bin_setup.sh
  30. cipd_client_version
  31. cipd_client_version.digests
  32. cipd_manifest.txt
  33. cipd_manifest.versions
  34. cit
  35. cit.bat
  36. cit.py
  37. clang-format
  38. clang-format.bat
  39. clang_format.py
  40. clang_format_merge_driver
  41. clang_format_merge_driver.bat
  42. clang_format_merge_driver.py
  43. codereview.settings
  44. compile_single_file
  45. compile_single_file.bat
  46. compile_single_file.py
  47. cpplint.bat
  48. cpplint.py
  49. cpplint_chromium.py
  50. dart_format.py
  51. depot-tools-auth
  52. depot-tools-auth.bat
  53. depot-tools-auth.py
  54. detect_host_arch.py
  55. download_from_google_storage
  56. download_from_google_storage.bat
  57. download_from_google_storage.py
  58. ensure_bootstrap
  59. fetch
  60. fetch.bat
  61. fetch.py
  62. fix_encoding.py
  63. gclient
  64. gclient-new-workdir.py
  65. gclient.bat
  66. gclient.py
  67. gclient_completion.sh
  68. gclient_eval.py
  69. gclient_scm.py
  70. gclient_utils.py
  71. gerrit_client.py
  72. gerrit_util.py
  73. git-cache
  74. git-cl
  75. git-crrev-parse
  76. git-drover
  77. git-find-releases
  78. git-footers
  79. git-freeze
  80. git-gs
  81. git-hyper-blame
  82. git-map
  83. git-map-branches
  84. git-mark-merge-base
  85. git-nav-downstream
  86. git-nav-upstream
  87. git-new-branch
  88. git-number
  89. git-rebase-update
  90. git-rename-branch
  91. git-reparent-branch
  92. git-retry
  93. git-runhooks
  94. git-squash-branch
  95. git-thaw
  96. git-upstream-diff
  97. git_cache.py
  98. git_cl.py
  99. git_cl_completion.sh
  100. git_common.py
  101. git_dates.py
  102. git_drover.py
  103. git_find_releases.py
  104. git_footers.py
  105. git_freezer.py
  106. git_hyper_blame.py
  107. git_map.py
  108. git_map_branches.py
  109. git_mark_merge_base.py
  110. git_nav_downstream.py
  111. git_new_branch.py
  112. git_number.py
  113. git_rebase_update.py
  114. git_rename_branch.py
  115. git_reparent_branch.py
  116. git_retry.py
  117. git_squash_branch.py
  118. git_upstream_diff.py
  119. gn
  120. gn.bat
  121. gn.py
  122. gsutil.py
  123. gsutil.vpython
  124. led
  125. led.bat
  126. LICENSE
  127. luci-auth
  128. luci-auth.bat
  129. mac_toolchain
  130. metrics.py
  131. metrics.README.md
  132. metrics_utils.py
  133. my_activity.py
  134. my_reviews.py
  135. ninja
  136. ninja-linux32
  137. ninja-linux64
  138. ninja-mac
  139. ninja.exe
  140. ninjalog_uploader.py
  141. ninjalog_uploader_wrapper.py
  142. OWNERS
  143. owners.py
  144. owners_finder.py
  145. patch.py
  146. post_build_ninja_summary.py
  147. PRESUBMIT.py
  148. presubmit_canned_checks.py
  149. presubmit_support.py
  150. profile.xml
  151. prpc
  152. prpc.bat
  153. pylint
  154. pylint.py
  155. pylintrc
  156. python_runner.sh
  157. README.gclient.md
  158. README.git-cl.md
  159. README.md
  160. README.testing
  161. repo
  162. rietveld.py
  163. roll-dep
  164. roll-dep-svn
  165. roll-dep-svn.bat
  166. roll-dep.bat
  167. roll_dep.py
  168. roll_dep_svn.py
  169. scm.py
  170. setup_color.py
  171. split_cl.py
  172. subcommand.py
  173. subprocess2.py
  174. update_depot_tools
  175. update_depot_tools.bat
  176. update_depot_tools_toggle.py
  177. upload_metrics.py
  178. upload_to_google_storage.py
  179. vpython
  180. vpython.bat
  181. WATCHLISTS
  182. watchlists.py
  183. weekly
  184. wtf
  185. yapf
  186. yapf.bat
README.md

depot_tools

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

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.

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

To update cpplint.py, please submit the change upstream first at https://github.com/google/styleguide/tree/gh-pages/cpplint then copy it down.