Commit Graph

45 Commits (238650f0b1dbcbde64c1024ead94aa33116cfbe7)

Author SHA1 Message Date
Yiwei Zhang da2ef92c9f fail gracefully if git map-branches is called in cog
Bug: 339231299
Change-Id: I65c96463be51bb7da32b44c280d75622842612c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5540669
Commit-Queue: Josip Sokcevic <sokcevic@chromium.org>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
10 months ago
David Benjamin 40a3fc4722 Use get_config to look up whether a branch is dormant
get_config is implemented by caching git config --list -z, rather than
shelling out for every key one-by-one. This reduces git map-branches
time on my machine from 1.2s to 0.6s.

Change-Id: I999f4b893d248c2f71a36ec0f2594e0cdf08a248
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5498461
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Gavin Mak <gavinmak@google.com>
10 months ago
David Benjamin 54b27c0a13 Don't shell out to git to resolve upstream branches unnecessarily
Even though we already know the parent is origin/main, every branch that
is parented to origin/main ends up shelling out to git in the upstream()
function, just to double-check that origin/main exists.

If the parent has already been registered, don't bother repeating the
work. This cuts out about half of the times that git map-branches shells
out to git and reduces it from 1.7s to 1.2s on my machine.

Change-Id: Ic5fdaaa5bc62ed8a3574f5a28f9f783093dacc2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5498460
Reviewed-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Auto-Submit: David Benjamin <davidben@chromium.org>
10 months ago
Gavin Mak edba22d4eb Fix multiline comment formatting
Many incorrectly formatted comments exist from the switch to
4 space indent: https://crrev.com/c/4836379

Bug: 1514505
Change-Id: I6366f9da812919bd35b999f18fa8a49b7a66c09b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5153633
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
1 year 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
Gavin Mak cc97655889 Reland "Drop py2 support in gerrit and git related files"
This is a reland of commit b5c7f4b46c

Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1475402
Change-Id: I194180494071777b7b9dd91a5c8edabbbf5484c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811218
Reviewed-by: Joanna Wang <jojwang@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Aravind Vasudevan ed935cf29b Remove deadcode from depot_tools scripts
Removing some deadcode from depot_tools scripts. More follow-up CLs will
be made after this to remove more dead code.

R=sokcevic,gavinmak

Change-Id: Iad20e9e1737e49c1370248d32c6317cf2be63de4
Bug: 1475776
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811216
Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
Reviewed-by: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak 42674f5d2d Revert "Drop py2 support in gerrit and git related files"
This reverts commit b5c7f4b46c.

Reason for revert: missing a replace for urlparse.urlparse

Original change's description:
> Drop py2 support in gerrit and git related files
>
> python3 is the only supported version of python in depot_tools.
>
> Bug: 1475402
> Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
> Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
> Commit-Queue: Gavin Mak <gavinmak@google.com>

Bug: 1475402
Change-Id: Idd00fdfe0b3d62785da2789a7dfcc9fbc79b6385
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4811623
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Gavin Mak b5c7f4b46c Drop py2 support in gerrit and git related files
python3 is the only supported version of python in depot_tools.

Bug: 1475402
Change-Id: Ie4ee18d297081b3aa0206b8d7ce6461819bff0ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4809560
Reviewed-by: Josip Sokcevic <sokcevic@chromium.org>
Commit-Queue: Gavin Mak <gavinmak@google.com>
2 years ago
Orr Bernstein b7e16d28f6 Support dormant branches in the git map-branches output.
This adds support in two ways:
1. Displays a "(dormant)" marker as part of each branch's line when the
   verbosity level is four or above. ('git bmap -v -v -v -v ...'). It's
   worth noting that, with verbosity level 4, each line is now 119
   characters long; verbosity level 3 is 107.
2. Enables callers to hide dormant branches using a new '--hide-dormant'
   option. If the dormant branch is the parent of non-dormant branches,
   it's still shown, despite being dormant, so that it can continue to
   serve as the parent line for non-dormant branches.

Change-Id: I0504419fd12357563288b5d53bc49ca68a876e8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4654849
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Orr Bernstein <orrb@google.com>
2 years ago
Christian Flach a2658217d2 git-map-branches: Fix --show-subject for branches that are gone
Without this change, the script would try to query the subject of
branches that no longer exist (these are shown as
`{branch-name:GONE}` in the output of the command).

Bug: None
Change-Id: Ia8dafe428654a1ab995dcd0be794e6fd9e25bc7a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4078970
Commit-Queue: Christian Flach <cmfcmf@chromium.org>
Reviewed-by: Joanna Wang <jojwang@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 306b03b191 Collect metrics on git_map_branches
R=calamity@chromium.org

Change-Id: Iee4634462c598685032c8a5ffcfd3b9766726958
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3482664
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: Christopher Lam <calamity@chromium.org>
Commit-Queue: Christopher Lam <calamity@chromium.org>
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
Gavin Mak 8d7201bc3c Modify git map-branches to show the number of commits on a branch
Currently, for a given branch, map-branches displays the number of
commits ahead and behind it is. This change replaces ahead with
commits, representing the number of commits a branch has, starting from
its base commit, and more accurately reflects the state of a repo.

Bug:1128716
Change-Id: I7c070b4efd452d82d878e1cfb7c20d1c80f38ec7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2412991
Commit-Queue: Gavin Mak <gavinmak@google.com>
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
5 years ago
Andrii Shyshkalov 1ee78cdaac git cl: use short URLs in `git cl status`.
This also applies to git map-branches.

R=ehmaldonado

Change-Id: Ica9bc92660716c15cbdd6bfd77b93f08bd0d8f9b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2099329
Commit-Queue: Andrii Shyshkalov <tandrii@google.com>
Auto-Submit: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Edward Lemur 2bac03e8a1 git-map-branches: Fix Python 3 errors.
When no -v flag is given, the verbosity defaults to None instead of 0,
so set 0 as a default.

Bug: 1058315
Change-Id: Id69e62550b33cd18bb1e5aed9cdc3c94f1488516
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2088193
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Marc-Antoine Ruel 8e57b4bc55 python3 improvements
Ran:
  vi $(git grep --name-only iteritems | grep -v third_party)
  vi $(git grep --name-only itervalues | grep -v third_party)
  vi $(git grep --name-only 'print ' | grep -v third_party)

and edited the files quickly with adhoc macros. Then ran in recipes/:
  ./recipes.py test train

There was only a small subset of files that had been updated to use
six.iteritems() and six.itervalues(). Since the dataset size that is
being used in gclient is small (pretty much always below 200 items),
it's better to just switch to .items() right away and take the temporary
performance hit, so that we don't need to come back to rewrite the code.

Recipe-Nontrivial-Roll: build
Bug: 984182
Change-Id: I5faf11486b66b0d73c9098ab0f2ce1b15a45c53e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1854900
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Marc-Antoine Ruel <maruel@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
Raul Tambre 80ee78e7fa Convert print statements to Python 3 style
Ran "2to3 -w -n -f print ./" and manually added imports.
Ran "^\s*print " and "\s+print " to find batch/shell scripts, comments and the like with embedded code, and updated them manually.
Also manually added imports to files, which used print as a function, but were missing the import.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: Id777e4d4df4adcdfdab1b18bde89f235ef491b9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1595684
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
6 years ago
Clemens Hammacher 793183d37d Make `git map-branches` detect and report cycles
I just made a bunch of branches disappear from `git map-branches` by
creating a big cycle (none of them were a root, thus none was listed at
all). This CL makes `git map-branches` check for such cycles and report
them as warnings.

R=iannucci@chromium.org

Change-Id: I723b327282a1c90bc9da5438777653e48f8bfd1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1528985
Auto-Submit: Clemens Hammacher <clemensh@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Clemens Hammacher 03640c7fe5 Extend documentation for `git map-branches`
Document the -v and --no-color options.

R=iannucci@chromium.org

Change-Id: I07624403f591b23cc5701aa8201124fdfdb65781
Reviewed-on: https://chromium-review.googlesource.com/c/1360710
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
6 years ago
Aaron Gable fe2f380df8 Update help text for git-map-branches
R=lgarron@chromium.org

Bug: 758435
Change-Id: I557cf5027636e8cf30d3971071723bf2b9333f9e
Reviewed-on: https://chromium-review.googlesource.com/639036
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
Aaron Gable 6761b9df4a git-map-branches: support no-parent when showing subjects
If one of the "branches" being shown by 'git map-branches' is
the pseudo-branch "{NO_UPSTREAM}", and the user has asked the
command to print the subject line of each branch, it would
crash. This change causes it to gracefully handle that case.

R=lgarron@chromium.org

Bug: 758428
Change-Id: Id0ff1c6fd90b5efbb07e118ae088e3999c234b67
Reviewed-on: https://chromium-review.googlesource.com/639190
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
8 years ago
anatoly techtonik 222840fb5f Show colored explanation in git map-branches -h
Bug:

Change-Id: Ie624d20ecff2afd274043620fbb2edcbcee857c6
Reviewed-on: https://chromium-review.googlesource.com/476670
Commit-Queue: anatoly techtonik <techtonik@gmail.com>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
8 years ago
techtonik 2e24812dd3 map-branches: Fix crash with --show-subject when branch name matches files
Traceback (most recent call last):
  ...
  File "...\\git_map_branches.py", line 303, in main
    mapper.start()
  File "...\\git_map_branches.py", line 169, in start
    self.__append_branch(root)
  File "...\\git_map_branches.py", line 272, in __append_branch
    self.__append_branch(child, depth=depth + 1)
  File "...\\git_map_branches.py", line 267, in __append_branch
    line.append(run('log', '-n1', '--format=%s', branch))
  File "...\git_common.py", line 599, in run
    return run_with_stderr(*cmd, **kwargs)[0]
  File "...\git_common.py", line 668, in run_with_stderr
    raise subprocess2.CalledProcessError(retcode, cmd, os.getcwd(), ret, err)
subprocess2.CalledProcessError: Command '...\\git.bat -c color.ui=never log -n1 --format=%s readme' returned non-zero exit status 128 in ...
fatal: ambiguous argument 'readme': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

BUG=

Review-Url: https://codereview.chromium.org/2153803002
9 years ago
asanka 97f3949a4d [git-map-branches] Show CL status verbatim.
git-map-branches -v -v -v currently indicates the status of the CL using
a color. This change adds the status string alongside the CL to match
the output of 'git-cl status'.

  $ git map-branches -v -v -v

Before:
  A        354ccf6 [ ahead 1 ] https://codereview...
    B      e701150 [ ahead 1 ] https://codereview...
      C *  094cedd [ ahead 1 ] https://codereview...

After:
  A        354ccf6 [ ahead 1 ] https://codereview... (commit)
    B      e701150 [ ahead 1 ] https://codereview... (lgtm)
      C *  094cedd [ ahead 1 ] https://codereview... (waiting)

R=dpranke@chromium.org
BUG=none

Review-Url: https://codereview.chromium.org/2138703003
9 years ago
clemensh@chromium.org cbd7dc3ce5 Use CLs more consistently instead of branch names
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=300132

Review-Url: https://codereview.chromium.org/1893563002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300673 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
iannucci@chromium.org 596cd5c95d Fix coloring madness in depot_tools.
'setup_color' now contains logic to correctly detect:
  * cmd
  * cmd pipe
  * msys bash
  * msys pipe
  * cmd running inside msys bash (git-command)
  * cmd pipe running inside msys bash (git-command > outfile)

R=brucedawson@chromium.org, dnj@chromium.org
BUG=600049

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299682 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
iannucci@chromium.org 0703ea2cc6 Multiple improvements to windows bash integration.
* `git bash` helper now will either:
    * launch an interactive bash prompt in the MinGW Terminal Emulator
    * launch a non-interactive bash shell if arguments are provided
  * `git bash` now includes python, python/Scripts and svn binaries in
    the PATH.
  * depot_tools' colorization now works in MinGW Terminal Emulator
  * batch scripts are now regenerated if any of them is missing.

R=agable@chromium.org, dnj@chromium.org, mmoss@chromium.org
BUG=598956

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299616 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
iannucci@chromium.org c0f8642119 Revert "Better tooling"
This reverts commit eed06d620f.

Accidental dcommit

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299615 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
iannucci@chromium.org eed06d620f Better tooling
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299614 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
jsbell@google.com 4f1fc3531c Don't highlight branches named 'origin-foo'
Logic for highlighting "origin/master" (etc) just looked for "origin"
as a prefix. Add the slash since "origin-foo" is a boring old valid
topic branch name.

R=iannucci@chromium.org, iannucci@google.com

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299486 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
sdefresne@chromium.org 32f122f882 Fix "git cl map-branches -vvv"
CL https://codereview.chromium.org/1172223002 changed the meaning of the
third value in the tuple returned by get_cl_statuses from a color to the
status of the branch and broke the formatting of output.

Convert the status to the color using color_for_status helper function.

BUG=499189

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295618 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
borenet@google.com 09156ec714 git map-branches: add --show-subject
BUG=

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294578 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
calamity@chromium.org ffde55c519 Make git-map-branches -vvv show CL status colors.
This CL makes git-map-branches show CL status colors like git cl status
when -vvv is used. Statuses are fetched in parallel for speed.

BUG=379849

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294414 0039d316-1c4b-4281-b951-d872f2087c98
10 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
calamity@chromium.org 4cd0a8b9d6 Fix map-branches issues and add coloring for 'branch-heads',
This CL fixes some issues with map-branches:
* Branches with no upstream were not being shown.
* -vv from a detached HEAD would crash
* GONE upstreams would crash when git cleaned up in a way that caused
  hash_one to fail

This CL also adds a blue coloring to branches that start with
'branch-heads' for Chromium release branches.

BUG=416530

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292083 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
iannucci@chromium.org 4c82eb519a Fix git-map-branches crashing on HEAD, and other minor quality-of-life
improvements.

  * No longer crash on HEAD
  * Always correctly highlight lines based on hash-matching-ness
  * Only import git_cl if you want it (it can be slow)
  * Print a message when NO branches are found (instead of blank output)

R=calamity@chromium.org, jsbell@chromium.org
BUG=410353

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291847 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
calamity@chromium.org 745ffa64a0 Skip tracking status in map-branches when -v flag is not supplied.
This CL prevents map-branches from loading the tracking status when
the -v flag is not supplied. This prevents the vanilla map-branches
from taking a potentially long time to retrieve the tracking status.

BUG=410137

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291846 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
calamity@chromium.org 9d2c880e98 Give git map-branches extra information behind -v and -vv flags.
This CL adds information to the git map-branches command. Invoking 
it map-branches with -v, will show tracking status of branches and
invoking with -vv will additionally show the Rietveld URL and the
branch hash.

BUG=None

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291776 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
iannucci@chromium.org a112f03fcf Fix git_nav_downstream.py when origin/master is checked out.
Also fix missing copyright notices.

R=agable@chromium.org
BUG=261738

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@256777 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
iannucci@chromium.org 8bc9b5c101 Add git-map and git-map-branches to depot_tools.
git-map: Show your local repo's history in a pseudo-graphical format from the command line.

git-map-branches: Show the topology of all of your branches, and their upstream relationships.

git-nav-upstream: Navigate (checkout) to the upstream branch of the current branch.

git-nav-downstream: Navigate (checkout) to a downstream branch of the current branch. If there's more than one downstream branch, then present a menu to select which one you want.

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

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

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