Commit Graph

19 Commits (main)

Author SHA1 Message Date
Gavin Mak bba50600f8 Track origin/lkgr when using --lkgr flag in new-branch
Passing --lkgr tracks the local "lkgr" branch which may not exist.
"origin/lkgr" is a better default since that should exist for projects
that have a lkgr.

Bug: 366394191
Change-Id: I2a0ce1a4d8540ce2e3ca06ef892e288c9892cf0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5876340
Auto-Submit: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
5 months ago
Yiwei Zhang da41d62982 fail gracefully if git new-branch is called in cog
Bug: 339231299
Change-Id: I21084c12815c82f7c0a90b5755de4d5551b6d94d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540434
Auto-Submit: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
10 months ago
Mike Frysinger 124bb8e53c switch to 4 space indent
Leave the recipes/ code at 2 space to match the rest of the recipes
project in other repos.

Reformatted using:
files=( $(
	git ls-tree -r --name-only HEAD | \
		grep -Ev -e '^(third_party|recipes)/' | \
		grep '\.py$';
	git grep -l '#!/usr/bin/env.*python' | grep -v '\.py$'
) )
parallel ./yapf -i -- "${files[@]}"
~/chromiumos/chromite/contrib/reflow_overlong_comments "${files[@]}"

The files that still had strings that were too long were manually
reformatted because they were easy and only a few issues.
autoninja.py
clang_format.py
download_from_google_storage.py
fix_encoding.py
gclient_utils.py
git_cache.py
git_common.py
git_map_branches.py
git_reparent_branch.py
gn.py
my_activity.py
owners_finder.py
presubmit_canned_checks.py
reclient_helper.py
reclientreport.py
roll_dep.py
rustfmt.py
siso.py
split_cl.py
subcommand.py
subprocess2.py
swift_format.py
upload_to_google_storage.py

These files still had lines (strings) that were too long, so the pylint
warnings were suppressed with a TODO.
auth.py
gclient.py
gclient_eval.py
gclient_paths.py
gclient_scm.py
gerrit_util.py
git_cl.py
presubmit_canned_checks.py
presubmit_support.py
scm.py

Change-Id: Ia6535c4f2c48d46b589ec1e791dde6c6b2ea858f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4836379
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
2 years ago
Josip Sokcevic 4de5deacd4 Explicitly run everything with python3
R=aravindvasudev@google.com, gavinmak@google.com

Change-Id: Iaa5e960c6226dea3a0814c7cb778d952eafb1502
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3525960
Reviewed-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
3 years ago
Josip Sokcevic 9c0dc3026e Replace non-inclusive terms
Bug: 1118410, 1118413, 1118422, 1118424, 1118426
Bug: 1118428, 1118430, 1118434, 1118438, 1118442
Bug: 1118453, 1118454
Recipe-Nontrivial-Roll: chromiumos
Recipe-Nontrivial-Roll: build
Change-Id: I43e6305f8c3136774f01b57f12bb442bcb863371
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2551388
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
4 years ago
Edward Lemur 8410164ab1 git-cl: Fix invocation of git new-branch
Bug: 1054787, 1051631
Change-Id: Ib36740a3f8158977897431c5b52e5ecbdaeb16b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2068506
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Edward Lemur 9bb7b96c4d git-rebase-update: Make tests run on Python 3.
Bug: 1009809
Change-Id: I47c9a468b2922248b823ebae5e71863a698c30f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1889166
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lesmes 98eda3f3e4 Revert "depot_tools: Run Python scripts using vpython (Part 1)"
This reverts commit d6186f9936.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> depot_tools: Run Python scripts using vpython (Part 1)
> 
> Tbr: iannucci@chromium.org
> Bug: 984182
> Change-Id: If36722e190d305f89d63dce91d0a600ddc34ebe3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748589
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=iannucci@chromium.org,ehmaldonado@chromium.org

Change-Id: I7686985852608d0703bcbbab137df1ce82b29723
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 984182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1749853
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur d6186f9936 depot_tools: Run Python scripts using vpython (Part 1)
Tbr: iannucci@chromium.org
Bug: 984182
Change-Id: If36722e190d305f89d63dce91d0a600ddc34ebe3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748589
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Clemens Hammacher 19238fc343 Revert "Fix semantics of git new-branch --upstream"
This reverts commit ba83229a73.

Reason for revert: After mail discussion we came to the conclusion that the old behavior makes more sense.

Original change's description:
> 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>

TBR=iannucci@chromium.org,tandrii@chromium.org,clemensh@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I7463935af172f0801c7da94d2de106a02fc4c42e
Reviewed-on: https://chromium-review.googlesource.com/c/1362972
Reviewed-by: Sergiy Belozorov <sergiyb@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
6 years ago
Clemens Hammacher ba83229a73 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>
6 years ago
Asanka Herath 53a115e67e Add a '--inject-current' option to 'git new-branch'
This option creates a new branch that sets itself as the upstream for
the current branch and adopts the current branch's upstream as its own.

What does it do?
----------------

Imagine we have the following set of branches (as `git map-branches -vv`
would show it):

  origin/master  00001111  [ ahead 1 ]
    foo          00002222  [ ahead 1 ]
      baz *      00003333  [ ahead 1 ]

'baz' is the current branch. If one were to issue the following command:

  $ git new-branch --inject-current bar

... then the branch layout will now look like this:

  origin/master  00001111  [ ahead 1 ]
    foo          00002222  [ ahead 1 ]
      bar *      00002222
        baz      00003333  [ ahead 1 ]

Why would you need this?
------------------------

When working on a single change or a sequence of changes organized into
dependent branches, this option lets you quickly create a new branch
with the correct upstreams so that you can peel off smaller cleanups and
potentially unrelated changes out of your main feature branch into
separate branches. These can then be uploaded as dependent CLs.

R=petermayo@chromium.org,iannucci@chromium.org

Change-Id: Id912f8e5c17e267fc52d74bdfac7bbcf87a50908
Reviewed-on: https://chromium-review.googlesource.com/987529
Commit-Queue: Asanka Herath <asanka@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
7 years ago
techtonik@gmail.com b14fccd608 Clarify how `new-branch` is different for --help
BUG=

Review URL: https://codereview.chromium.org/1875063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300032 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
sbc@chromium.org 013731e832 Handle KeyboardInterrupt consistently in python scripts
Handle KeyboardInterrupt gracefully rather the printing a
backtrace. Most users of these tools don't expect a
backtrace when then hit Ctrl-C.

Also, fix a few other inconsistencies found in the python
startup code of these different scripts:
- always call main function 'main' (rather than 'Main')
- always return 0 from main function
- if main takes args never include argv[0]

Review URL: https://codereview.chromium.org/955993006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294250 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
pgervais@chromium.org b9f2751b87 Added hyphen-only options
Some options have words separated by underscores. Added options with
same name and underscores replaced by hyphens.

BUG=400953

Review URL: https://codereview.chromium.org/436963005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@288366 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
agable@chromium.org 9c0f85130e Add newline to git-new-branch output.
R=iannucci@chromium.org, pgervais@chromium.org

Review URL: https://codereview.chromium.org/261843002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@267616 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
pgervais@chromium.org 022d06ef61 git new-branch displays an explanatory line.
BUG=

Review URL: https://codereview.chromium.org/253013004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@266905 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
iannucci@chromium.org 97231b5fb5 Fix bad interpreters.
Somehow some (but not all) git helper scripts got the wrong interpreter. This
fixes them to use /usr/bin/env.

TBR=agable@chromium.org
BUG=

Review URL: https://codereview.chromium.org/212293002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259522 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
iannucci@chromium.org c050a5b2be Add a family of git-commands to assist with the management of multiple CLs/branches.
git-rebase-update - ensure all branches are up to date
git-new-branch - create branches
git-rename-branch - rename a branch while preserving parentage relationships
git-reparent-branch - change the parent of a branch, including rebasing it correctly onto that new parent.
git-squash-branch - collapse a branch into a single commit
git-upstream-diff - show the diff between the current branch and it's upstream branch
git-mark-merge-base - explicitly set what you want the above tools to consider the merge-base for the current branch.

R=agable@chromium.org, hinoka@chromium.org, stip@chromium.org, szager@chromium.org
BUG=261738

Review URL: https://codereview.chromium.org/184253003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@259520 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago