Skip to content

Commit fb2b8eb

Browse files
Create the Next Generation of depot_tools. Eh.
Review URL: http://codereview.chromium.org/92087 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@14349 0039d316-1c4b-4281-b951-d872f2087c98
0 parents  commit fb2b8eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+11450
-0
lines changed

LICENSE

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
2+
//
3+
// Redistribution and use in source and binary forms, with or without
4+
// modification, are permitted provided that the following conditions are
5+
// met:
6+
//
7+
// * Redistributions of source code must retain the above copyright
8+
// notice, this list of conditions and the following disclaimer.
9+
// * Redistributions in binary form must reproduce the above
10+
// copyright notice, this list of conditions and the following disclaimer
11+
// in the documentation and/or other materials provided with the
12+
// distribution.
13+
// * Neither the name of Google Inc. nor the names of its
14+
// contributors may be used to endorse or promote products derived from
15+
// this software without specific prior written permission.
16+
//
17+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
This package contains tools for working with Chromium development.
2+
3+
The "gclient" wrapper knows how to keep this repository updated to
4+
the latest versions of these tools as found at:
5+
6+
http://src.chromium.org/svn/trunk/tools/depot_tools
7+
8+
This package contains:
9+
10+
chrome-update-create-task.bat
11+
Creates a scheduled task to do an automatic local chromium build every day.
12+
13+
gcl
14+
A tool for uploading and managing code reviews on the Chromium
15+
project, using the Rietveld code review tool. More info at:
16+
http://code.google.com/p/rietveld/
17+
18+
gclient
19+
A script for managing a workspace with modular dependencies that
20+
are each checked out independently from different repositories.
21+
More info at:
22+
http://code.google.com/p/gclient/
23+
24+
hammer
25+
A wrapper script for building Chromium with the SCons software
26+
construction tool. More info at:
27+
http://www.scons.org/
28+
29+
revert
30+
A small tool to quickly revert a change.
31+
32+
33+
Note: svn and python will be installed automatically if not accessible (on
34+
Windows only).
35+
36+
To update this distribution manually, run bootstrap\update.bat on Windows,
37+
or bootstrap/update.sh on Linux or Mac.
38+
39+
To disable automatic updating, set the environment variable DEPOT_TOOLS_UPDATE=1

README.git-cl

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# git-cl -- a git-command for integrating reviews on Rietveld
2+
# Copyright (C) 2008 Evan Martin <[email protected]>
3+
4+
== Background
5+
Rietveld, also known as http://codereview.appspot.com, is a nice tool
6+
for code reviews. You upload a patch (and some other data) and it lets
7+
others comment on your patch.
8+
9+
For more on how this all works conceptually, please see README.codereview.
10+
The remainder of this document is the nuts and bolts of using git-cl.
11+
12+
== Install
13+
Copy (symlink) it into your path somewhere, along with Rietveld
14+
upload.py.
15+
16+
== Setup
17+
Run this from your git checkout and answer some questions:
18+
$ git cl config
19+
20+
== How to use it
21+
Make a new branch. Write some code. Commit it locally. Send it for
22+
review:
23+
$ git cl upload
24+
By default, it diffs against whatever branch the current branch is
25+
tracking (see "git checkout --track"). An optional last argument is
26+
passed to "git diff", allowing reviews against other heads.
27+
28+
You'll be asked some questions, and the review issue number will be
29+
associated with your current git branch, so subsequent calls to upload
30+
will update that review rather than making a new one.
31+
32+
== git-svn integration
33+
Review looks good? Commit the code:
34+
$ git cl dcommit
35+
This does a git-svn dcommit, with a twist: all changes in the diff
36+
will be squashed into a single commit, and the description of the commit
37+
is taken directly from the Rietveld description. This command also accepts
38+
arguments to "git diff", much like upload.
39+
Try "git cl dcommit --help" for more options.
40+
41+
== Extra commands
42+
Print some status info:
43+
$ git cl status
44+
45+
Edit the issue association on the current branch:
46+
$ git cl issue 1234
47+
48+
Patch in a review:
49+
$ git cl patch <url to full patch>
50+
Try "git cl patch --help" for more options.
51+
52+
vim: tw=72 :

README.git-cl.codereview

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
The git-cl README describes the git-cl command set. This document
2+
describes how code review and git work together in general, intended
3+
for people familiar with git but unfamiliar with the code review
4+
process supported by Rietveld.
5+
6+
== Concepts and terms
7+
A Rietveld review is for discussion of a single change or patch. You
8+
upload a proposed change, the reviewer comments on your change, and
9+
then you can upload a revised version of your change. Rietveld stores
10+
the history of uploaded patches as well as the comments, and can
11+
compute diffs in between these patches. The history of a patch is
12+
very much like a small branch in git, but since Rietveld is
13+
VCS-agnostic the concepts don't map perfectly. The identifier for a
14+
single review+patches+comments in Rietveld is called an "issue".
15+
16+
Rietveld provides a basic uploader that understands git. This program
17+
is used by git-cl, and is included in the git-cl repo as upload.py.
18+
19+
== Basic interaction with git
20+
The fundamental problem you encounter when you try to mix git and code
21+
review is that with git it's nice to commit code locally, while during
22+
a code review you're often requested to change something about your
23+
code. There are a few different ways you can handle this workflow
24+
with git:
25+
26+
1) Rewriting a single commit. Say the origin commit is O, and you
27+
commit your initial work in a commit A, making your history like
28+
O--A. After review comments, you commit --amend, effectively
29+
erasing A and making a new commit A', so history is now O--A'.
30+
(Equivalently, you can use git reset --soft or git rebase -i.)
31+
32+
2) Writing follow-up commits. Initial work is again in A, and after
33+
review comments, you write a new commit B so your history looks
34+
like O--A--B. When you upload the revised patch, you upload the
35+
diff of O..B, not A..B; you always upload the full diff of what
36+
you're proposing to change.
37+
38+
The Rietveld patch uploader just takes arguments to "git diff", so
39+
either of the above workflows work fine. If all you want to do is
40+
upload a patch, you can use the upload.py provided by Rietveld with
41+
arguments like this:
42+
43+
upload.py --server server.com <args to "git diff">
44+
45+
The first time you upload, it creates a new issue; for follow-ups on
46+
the same issue, you need to provide the issue number:
47+
48+
upload.py --server server.com --issue 1234 <args to "git diff">
49+
50+
== git-cl to the rescue
51+
git-cl simplifies the above in the following ways:
52+
53+
1) "git cl config" puts a persistent --server setting in your .git/config.
54+
55+
2) The first time you upload an issue, the issue number is associated with
56+
the current *branch*. If you upload again, it will upload on the same
57+
issue. (Note that this association is tied to a branch, not a commit,
58+
which means you need a separate branch per review.)
59+
60+
3) If your branch is "tracking" (in the "git checkout --track" sense)
61+
another one (like origin/master), calls to "git cl upload" will
62+
diff against that branch by default. (You can still pass arguments
63+
to "git diff" on the command line, if necessary.)
64+
65+
In the common case, this means that calling simply "git cl upload"
66+
will always upload the correct diff to the correct place.
67+
68+
== Patch series
69+
The above is all you need to know for working on a single patch.
70+
71+
Things get much more complicated when you have a series of commits
72+
that you want to get reviewed. Say your history looks like
73+
O--A--B--C. If you want to upload that as a single review, everything
74+
works just as above.
75+
76+
But what if you upload each of A, B, and C as separate reviews?
77+
What if you then need to change A?
78+
79+
1) One option is rewriting history: write a new commit A', then use
80+
git rebase -i to insert that diff in as O--A--A'--B--C as well as
81+
squash it. This is sometimes not possible if B and C have touched
82+
some lines affected by A'.
83+
84+
2) Another option, and the one espoused by software like topgit, is for
85+
you to have separate branches for A, B, and C, and after writing A'
86+
you merge it into each of those branches. (topgit automates this
87+
merging process.) This is also what is recommended by git-cl, which
88+
likes having different branch identifiers to hang the issue number
89+
off of. Your history ends up looking like:
90+
91+
O---A---B---C
92+
\ \ \
93+
A'--B'--C'
94+
95+
Which is ugly, but it accurately tracks the real history of your work, can
96+
be thrown away at the end by committing A+A' as a single "squash" commit.
97+
98+
In practice, this comes up pretty rarely. Suggestions for better workflows
99+
are welcome.

bootstrap/gclient.bat

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
@echo off
2+
:: Copyright (c) 2009 The Chromium Authors. All rights reserved.
3+
:: Use of this source code is governed by a BSD-style license that can be
4+
:: found in the LICENSE file.
5+
6+
:: This batch file will try to sync the root directory and call back gclient.
7+
8+
setlocal
9+
10+
:: Shall skip automatic update?
11+
IF "%DEPOT_TOOLS_UPDATE%" == "0" GOTO gclient
12+
13+
:: We can't sync if ..\.svn\. doesn't exist.
14+
IF NOT EXIST "%~dp0..\.svn" GOTO gclient
15+
16+
:: Sync the .. directory to update the bootstrap at the same time.
17+
call svn -q up "%~dp0.."
18+
19+
:gclient
20+
:: Defer control.
21+
python "%~dp0\..\gclient.py" %*

bootstrap/gclient.sh

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
# This script will try to sync the root and bootstrap directories.
7+
8+
base_dir=$(dirname "$0")
9+
10+
# Skip if $DEPOT_TOOLS_UPDATE==0 or ../.svn/. doesn't exist.
11+
if [ "X$DEPOT_TOOLS_UPDATE" != "X0" -a -e "$base_dir/../.svn" ]
12+
then
13+
# Update the root directory.
14+
svn -q up "$base_dir/.."
15+
fi
16+
17+
exec python "$base_dir/../gclient.py" "$@"
18+

0 commit comments

Comments
 (0)