In order to clarify the intellectual property license granted with Contributions from any person or entity, the Android Open Source Project (the "Project") must have a Contributor License Grant ("Grant") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and the Android Open Source Project Leads (the "Project Leads"); it does not change your rights to use your own Contributions for any other purpose.
This version of the Grant allows an entity (the "Corporation") to submit Contributions to the Project Leads, to authorize Contributions submitted by its designated employees to the Project Leads, and to grant copyright and patent licenses thereto. If you have not already done so, please complete and send an original signed Grant to
Scanned agreements may also be emailed in PDF form to cla-submissions@google.com
If necessary, you may send it by facsimile to (650) 887-1625. Please read this document carefully before signing and keep a copy for your records.
diff --git a/pdk/docs/source/cla-individual.jd b/pdk/docs/source/cla-individual.jd
index 1433318b6..8890be87e 100644
--- a/pdk/docs/source/cla-individual.jd
+++ b/pdk/docs/source/cla-individual.jd
@@ -1,16 +1,14 @@
-page.title=Android Compatibility - Compatibility Test Suite
+page.title=Contributor License Agreement for Individuals
doc.type=source
@jd:body
-
Please visit thecode review tool
+Please visit the code review tool
to execute the grant online.This page provides the text of the Individual Contributor License Grant for your quick review.
In order to clarify the intellectual property license granted with Contributions from any person or entity, the Android Open Source Project (the "Project") must have a Contributor License Grant ("Grant") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and the Android Open Source Project Leads (the "Project Leads"); it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and send an original signed Grant to
-
Google Inc.
Attn: Open Source Program Office
1600 Amphitheatre Pkwy
Building 43
Mountain View, CA 94043
U.S.A.
-
Scanned agreements may also be emailed in PDF form to cla-submissions@google.com, sent by facsimile to (650) 887-1625, orsigned electronically
+
Google Inc.
Attn: Open Source Program Office
1600 Amphitheatre Pkwy
Building 43
Mountain View, CA 94043
U.S.A.
+
Scanned agreements may also be emailed in PDF form to cla-submissions@google.com, sent by facsimile to (650) 887-1625, or signed electronically
.
Please read this document carefully before signing and keep a copy for your records.
diff --git a/pdk/docs/source/code-lines.jd b/pdk/docs/source/code-lines.jd
new file mode 100644
index 000000000..61b400d5e
--- /dev/null
+++ b/pdk/docs/source/code-lines.jd
@@ -0,0 +1,77 @@
+page.title=Android Code-Lines
+doc.type=source
+@jd:body
+
The Android Open Source Project maintains a complete software stack intended
+to be ported by OEMs and other device implementors to run on actual hardware.
+Accordingly, we maintain a number of "code lines" to clearly separate the
+current stable version of Android from unstable experimental work.
+
The chart below depicts at a conceptual level how AOSP manages code and
+releases. We're referring to these as "code lines" instead of "branches"
+simply because at any given moment there may be more than one branch extant
+for a given "code line". For instance, when a release is cut, sometimes that
+will become a new branch in git, and sometimes not, based on the needs of the
+moment.
+

+
Notes and Explanations
+
+- A release corresponds to a formal version of the Android platform, such
+as 1.5, 2.0, and so on. Generally speaking, a release of the platform
+corresponds to a version of the
SdkVersion field used in
+AndroidManifest.xml files, and defined in frameworks/base/api in
+the source tree.
+- An upstream project is an open-source project from which the Android
+stack is pulling code. These include obvious projects such as the Linux kernel
+and WebKit, but over time we are migrating some of the semi-autonomous
+Android projects (such as Dalvik, the Android SDK tools, Bionic, and so on) to
+work as "upstream" projects. These will be developed entirely in the public
+tree, and snapshots will be periodically pulled into releases.
+- The diagram refers to "Eclair" and "Flan"; however, they are simply
+placeholders, and the diagram actually reflects the overall release and
+branching strategy.
+- At all times, the Release code-line (which may actually consist of
+more than one actual branch in git) is considered the sole canonical source
+code for a given Android platform. OEMs and other groups building devices
+should pull only from a Release branch.
+- We will be setting up an "Experimental" code-line to capture changes from
+the community, so that they can be iterated on, with an eye toward stability.
+- Changes that prove stable will eventually be pulled into a Release
+branch. Note that this will only apply to bug fixes, app improvements, and
+other things that do not affect the APIs of the platform.
+- Changes will be pulled into Release branches from upstream projects
+(include the Android "upstream" projects) as necessary.
+- The "n+1"th version (that is, next major version of the framework and
+platform APIs) will be developed by Google internally. (See below for
+details.)
+- Changes will be pulled from upstream, Release, and Experimental branches
+into Google's private branch as necessary.
+- When the platform APIs for the next version have stabilized and been fully
+tested, Google will cut a release of the next platform version. (This
+specifically refers to a new
SdkVersion.) This will also
+correspond to the internal code-line being made a public Release branch, and the
+new current platform code-line.
+- When a new platform version is cut, a corresponding Experimental
+code-line.
+
+
About Private Code-Lines
+
The source management strategy above includes a code-line that Google will
+keep private. The reason for this is to focus attention on the current public
+version of Android.
+
OEMs and other device builders naturally want to ship devices with the
+latest version of Android. Similarly, application developers don't want to
+deal with more extant platform versions than strictly necessary. Meanwhile,
+Google retains responsibility for the strategic direction of Android as a
+platform and a product. Our approach is based on focusing on a small number of
+flagship devices to drive features, and secure protections of Android-related
+intellectual property through patents and the like.
+
As a result, Google frequently has possession of confidential
+information of third parties, and we must refrain from revealing patentable
+features until we've secured the appropriate protections. Meanwhile, there are
+real risks to the platform arising from having too many platform versions
+extant at once. For these reasons, we have structured the open-source project
+-- including third-party contributions -- to focus on the currently-public
+stable version of Android. "Deep development" on the next version of the
+platform will happen in private, until it's ready to become an official
+release.
+
We recognize that many contributors will disagree with this approach. We
+respect that others may have a different point of view; however, this is the
+approach that we feel is best, and the one we've chosen to implement.
diff --git a/pdk/docs/source/code-style.jd b/pdk/docs/source/code-style.jd
index 540ac997e..3122ea88c 100644
--- a/pdk/docs/source/code-style.jd
+++ b/pdk/docs/source/code-style.jd
@@ -1,8 +1,6 @@
-page.title=Android Compatibility - Compatibility Test Suite
+page.title=Code Style Guidelines for Contributors
doc.type=source
@jd:body
-
Code Style Guide
-
Android Code Style Rules
The rules below are not guidelines or recommendations, but strict rules.You may not disregard the rules we list below
@@ -29,12 +27,12 @@ except as approved on a need-to-use basis.
-
There are conventions for using Android's Java libraries and tools. In some cases, the convention has changed in important ways and older code might use a deprecated pattern or library. When working with such code, it's okay to continue the existing style (seeConsistency
+
There are conventions for using Android's Java libraries and tools. In some cases, the convention has changed in important ways and older code might use a deprecated pattern or library. When working with such code, it's okay to continue the existing style (see Consistency
). When creating new components never use deprecated libraries.
-
Programs are much easier to maintain when all files have a consistent style. We follow the standard Java coding style, as defined by Sun in theirCode Conventions for the Java Programming Language
+
Programs are much easier to maintain when all files have a consistent style. We follow the standard Java coding style, as defined by Sun in their Code Conventions for the Java Programming Language
, with a few exceptions and additions. This style guide is comprehensive and detailed and is in common usage in the Java community.
In addition, we enforce the following style rules:
@@ -108,7 +106,7 @@ Sometimes it is tempting to write code that completely ignores an exception like
void setServerPort(String value) throws ConfigurationException {
try {
serverPort = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new ConfigurationException("Port " + value + " is not valid.");
}
Handle the error gracefully and substitute an appropriate value in the catch {} block.
-/** Set port. If value is not a valid number, 80 is substituted. */
void setServerPort(String value) {
try {
serverPort = Integer.parseInt(value);
} catch (NumberFormatException e) {
serverPort = 80; // default port for server
}
+/** Set port. If value is not a valid number, 80 is substituted. */
void setServerPort(String value) {
try {
serverPort = Integer.parseInt(value);
} catch (NumberFormatException e) {
serverPort = 80; // default port for server
}
Catch the Exception and throw a new RuntimeException. This is dangerous: only do it if you are positive that if this error occurs, the appropriate thing to do is crash.
/** Set port. If value is not a valid number, die. */
void setServerPort(String value) {
try {
serverPort = Integer.parseInt(value);
} catch (NumberFormatException e) {
throw new RuntimeException("port " + value " is invalid, ", e);
}
@@ -120,7 +118,7 @@ Note that the original exception is passed to the constructor for RuntimeExcepti
Sometimes it is tempting to be lazy when catching exceptions and do something like this:
-try {
someComplicatedIOFunction(); // may throw IOException
someComplicatedParsingFunction(); // may throw ParsingException
someComplicatedSecurityFunction(); // may throw SecurityException
// phew, made it all the way
} catch (Exception e) { // I'll just catch all exceptions
handleError(); // with one generic handler!
}
+try {
someComplicatedIOFunction(); // may throw IOException
someComplicatedParsingFunction(); // may throw ParsingException
someComplicatedSecurityFunction(); // may throw SecurityException
// phew, made it all the way
} catch (Exception e) { // I'll just catch all exceptions
handleError(); // with one generic handler!
}
You should not do this. In almost all cases it is inappropriate to catch generic Exception or Throwable, preferably not Throwable, because it includes Error exceptions as well. It is very dangerous. It means that Exceptions you never expected (including RuntimeExceptions like ClassCastException) end up getting caught in application-level error handling. It obscures the failure handling properties of your code. It means if someone adds a new type of Exception in the code you're calling, the compiler won't help you realize you need to handle that error differently. And in most cases you shouldn't be handling different types of exception the same way, anyway.
There are rare exceptions to this rule: certain test code and top-level code where you want to catch all kinds of errors (to prevent them from showing up in a UI, or to keep a batch job running). In that case you may catch generic Exception (or Throwable) and handle the error appropriately. You should think very carefully before doing this, though, and put in comments explaining why it is safe in this place.
@@ -176,17 +174,17 @@ Wildcards in imports
Every file should have a copyright statement at the top. Then a package statement and import statements should follow, each block separated by a blank line. And then there is the class or interface declaration. In the Javadoc comments, describe what the class or interface does.
-/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.foo;
import android.os.Blah;
import android.view.Yada;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Does X and Y and provides an abstraction for Z.
*/
public class Foo {
...
}
-Every class and nontrivial public method you writemust
+
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.foo;
import android.os.Blah;
import android.view.Yada;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Does X and Y and provides an abstraction for Z.
*/
public class Foo {
...
}
+Every class and nontrivial public method you write must
contain a Javadoc comment with at least one sentence describing what the class or method does. This sentence should start with a 3rd person descriptive verb. Examples:
-/** Returns the correctly rounded positive square root of a double value. */
static double sqrt(double a) {
}
/**
* Constructs a new String by converting the specified array of
* bytes using the platform's default character encoding.
*/
public String(byte[] bytes) {
}
+/** Returns the correctly rounded positive square root of a double value. */
static double sqrt(double a) {
}
/**
* Constructs a new String by converting the specified array of
* bytes using the platform's default character encoding.
*/
public String(byte[] bytes) {
}
You do not need to write Javadoc for trivial get and set methods such as setFoo() if all your Javadoc would say is "sets Foo". If the method does something more complex (such as enforcing a constraint or having an important side effect), then you must document it. And if it's not obvious what the property "Foo" means, you should document it.
Every method you write, whether public or otherwise, would benefit from Javadoc. Public methods are part of an API and therefore require Javadoc.
-Android does not currently enforce a specific style for writing Javadoc comments, but youshould
-follow theSun Javadoc conventions
+Android does not currently enforce a specific style for writing Javadoc comments, but you should
+follow the Sun Javadoc conventions
.
@@ -199,10 +197,10 @@ Item 29). By doing so, you increase the readability and maintainability of your
One exception to this rule concerns try-catch statements. If a variable is initialized with the return value of a method that throws a checked exception, it must be initialized inside a try block. If the value must be used outside of the try block, then it must be declared before the try block, where it cannot yet be sensibly initialized:
-// Instantiate class cl, which represents some sort of Set
Set s = null;
try {
s = (Set) cl.newInstance();
} catch(IllegalAccessException e) {
throw new IllegalArgumentException(cl + " not accessible");
} catch(InstantiationException e) {
throw new IllegalArgumentException(cl + " not instantiable");
}
// Exercise the set
s.addAll(Arrays.asList(args));
+// Instantiate class cl, which represents some sort of Set
Set s = null;
try {
s = (Set) cl.newInstance();
} catch(IllegalAccessException e) {
throw new IllegalArgumentException(cl + " not accessible");
} catch(InstantiationException e) {
throw new IllegalArgumentException(cl + " not instantiable");
}
// Exercise the set
s.addAll(Arrays.asList(args));
But even this case can be avoided by encapsulating the try-catch block in a method:
-Set createSet(Class cl) {
// Instantiate class cl, which represents some sort of Set
try {
return (Set) cl.newInstance();
} catch(IllegalAccessException e) {
throw new IllegalArgumentException(cl + " not accessible");
} catch(InstantiationException e) {
throw new IllegalArgumentException(cl + " not instantiable");
}
}
...
// Exercise the set
Set s = createSet(cl);
s.addAll(Arrays.asList(args));
+Set createSet(Class cl) {
// Instantiate class cl, which represents some sort of Set
try {
return (Set) cl.newInstance();
} catch(IllegalAccessException e) {
throw new IllegalArgumentException(cl + " not accessible");
} catch(InstantiationException e) {
throw new IllegalArgumentException(cl + " not instantiable");
}
}
...
// Exercise the set
Set s = createSet(cl);
s.addAll(Arrays.asList(args));
Loop variables should be declared in the for statement itself unless there is a compelling reason to do otherwise:
for (int i = 0; i n; i++) {
doSomething(i);
}
for (Iterator i = c.iterator(); i.hasNext(); ) {
doSomethingElse(i.next());
}
Imports
@@ -232,9 +230,9 @@ The use and location of static imports have been mildly controversial issues. So
We use 8 space indents for line wraps, including function calls and assignments. For example, this is correct:
-Instrument i
= someLongExpression(that, wouldNotFit, on, one, line);
+Instrument i
= someLongExpression(that, wouldNotFit, on, one, line);
and this is not correct:
-Instrument i
= someLongExpression(that, wouldNotFit, on, one, line);
+Instrument i
= someLongExpression(that, wouldNotFit, on, one, line);
- Non-public, non-static field names start with m.
@@ -256,10 +254,10 @@ and this is not correct:
class MyClass {
int func() {
if (something) {
// ...
} else if (somethingElse) {
// ...
} else {
// ...
}
}
}
We require braces around the statements for a conditional. Except, if the entire conditional (the condition and the body) fit on one line, you may (but are not obligated to) put it all on one line. That is, this is legal:
-if (condition) {
body; // ok
}
if (condition) body; // ok
+if (condition) {
body; // ok
}
if (condition) body; // ok
but this is still illegal:
-if (condition)
body; // bad
+if (condition)
body; // bad
Each line of text in your code should be at most 100 characters long.
@@ -277,18 +275,18 @@ Java 1.5 Annotations
Android -standard practices for the three predefined annotations in Java 1.5's are:
-@DeprecatedThe @Deprecated annotation must be used whenever the use of the annotated element is discouraged. If you use the @Deprecated annotation, you must also have a @deprecated Javadoc tag and it should name an alternate implementation. In addition, remember that a @Deprecated method isstill
+@DeprecatedThe @Deprecated annotation must be used whenever the use of the annotated element is discouraged. If you use the @Deprecated annotation, you must also have a @deprecated Javadoc tag and it should name an alternate implementation. In addition, remember that a @Deprecated method is still
supposed to work.
If you see old code that has a @deprecated Javadoc tag, please add the @Deprecated annotation.
@OverrideThe @Override annotation must be used whenever a method overrides the declaration or implementation from a super-class.
For example, if you use the {@inheritdocs} Javadoc tag, and derive from a class (not an interface), you must also annotate that the method @Overrides the parent class's method.
-@SuppressWarningsThe @SuppressWarnings annotation should only be used under circumstances where it is impossible to eliminate a warning. If a warning passes this "impossible to eliminate" test, the@SuppressWarnings annotationmust
+@SuppressWarningsThe @SuppressWarnings annotation should only be used under circumstances where it is impossible to eliminate a warning. If a warning passes this "impossible to eliminate" test, the@SuppressWarnings annotation must
be used, so as to ensure that all warnings reflect actual problems in the code.
When a @SuppressWarnings annotation is necessary, it must be prefixed with a TODO comment that explains the "impossible to eliminate" condition. This will normally identify an offending class that has an awkward interface. For example:
-// TODO: The third-party class com.third.useful.Utility.rotate() needs generics
@SuppressWarnings({"generic-cast"})
ListStringblix = Utility.rotate(blax);
+// TODO: The third-party class com.third.useful.Utility.rotate() needs generics
@SuppressWarnings({"generic-cast"})
ListStringblix = Utility.rotate(blax);
When a @SuppressWarnings annotation is required, the code should be refactored to isolate the software elements where the annotation applies.
@@ -336,8 +334,8 @@ When a @SuppressWarnings annotation is required, the code should be refactored t
Both the JDK and the Android code bases are very inconsistent with regards to acronyms, therefore, it is virtually impossible to be consistent with the code around you. Bite the bullet, and treat acronyms as words.
-For further justifications of this style rule, seeEffective Java
-Item 38 andJava Puzzlers
+
For further justifications of this style rule, see Effective Java
+Item 38 and Java Puzzlers
Number 68.
TODO style
diff --git a/pdk/docs/source/documentation.jd b/pdk/docs/source/documentation.jd
index 8be570173..4eae07184 100644
--- a/pdk/docs/source/documentation.jd
+++ b/pdk/docs/source/documentation.jd
@@ -1,14 +1,12 @@
-page.title=Android Compatibility - Compatibility Test Suite
+page.title=Documentation Resources
doc.type=source
@jd:body
-Documentation
-
-
+
As this page grows, it will include resources for wireless operators and handset manufacturers as well as for platform developers.
-Resources for platform developers
+Resources for platform developers
-
+
Google I/O videos:
-
+
Getting started with the Android source code:
-
+
Repo and Git resources:
-
+
Documentation on specific tasks:
diff --git a/pdk/docs/source/download.jd b/pdk/docs/source/download.jd
index 9f675121d..065a70897 100644
--- a/pdk/docs/source/download.jd
+++ b/pdk/docs/source/download.jd
@@ -1,83 +1,16 @@
-page.title=Android Compatibility - Compatibility Test Suite
+page.title=Get Android Source Code
doc.type=source
@jd:body
-
Get source
-
-
-
-
| For information about current problems and fixes, see Known issues
-. |
-
-
-
-
This document describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine.
Related reading:
-
- For an overview of the entire code-review and code-update process, see Workflow
+
What's in the source?
-For a description of all the projects that make up the Android source code, see
Project layout
-. To see snapshots and histories of the files available in the public Android repositories, visit the
GitWeb
+
To see snapshots and histories of the files available in the public Android repositories, visit the
GitWeb
web interface.
The source is approximentely 2.1GB in size.You will need 6GB free to complete the build.
@@ -241,7 +174,9 @@ file:
# set the number of open files to be 1024
ulimit -S -n 1024
Installing Repo
-
Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Using Repo and Git
+
Repo is a tool that makes it easier to work with Git in the context of
+Android. For more information about Repo, see Using Repo and Git
.
To install, initialize, and configure Repo, follow these steps:
- Make sure you have a~/bindirectory in your home directory, and check to be sure that this bin directory is in your path:
@@ -304,10 +239,10 @@ Getting the files
To pull down files to your working directory from the repositories as specified in the default manifest, run
$ repo sync
For more aboutrepo syncand other Repo commands, see
-Using Repo and Git
+Using Repo and Git
.
-
The Android source files will be located in your working directory under their project
-names.
+
The Android source files will be located in your working
+directory under their project names.
@@ -335,7 +270,7 @@ Building the code
$ export ANDROID_JAVA_HOME=$JAVA_HOME
Using an IDE
-
To learn about reporting an issue and searching previously reported issues,
see
-Report bugs
+Report bugs
.
-For information about editing the files and uploading changes to the code-review server, see Contribute
+For information about editing the files and uploading changes to the
+code-review server, see Contribute
.
diff --git a/pdk/docs/source/git-repo.jd b/pdk/docs/source/git-repo.jd
index cc996260d..97bd2eaf8 100644
--- a/pdk/docs/source/git-repo.jd
+++ b/pdk/docs/source/git-repo.jd
@@ -1,104 +1,11 @@
-page.title=Android Compatibility - Compatibility Test Suite
+page.title=Using Repo and Git
doc.type=source
@jd:body
-Using Repo and Git
-
-
To work with the Android code, you will need to use both Git and Repo.
- Git
is an open-source version-control system designed to handle very large projects that are distributed over multiple repositories. In the context of Android, we use Git for local operations such as local branching, commits, diffs, and edits.
- Repo
-is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to ourrevision control system
+is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to our revision control system
, and automates parts of the Android development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The repocommand is an executable Python script that you can put anywhere in your path.
In working with the Android source files, you will use Repo for across-network operations. For example, with a single Repo command you can download files from multiple repositories into your local working directory.
@@ -112,59 +19,59 @@ Why Git?
One of the challenges in setting up the Android project was figuring out how to best support the outside community--from the hobbiest community to large OEMs building mass-market consumer devices. We wanted components to be replaceable, and we wanted interesting components to be able to grow a life of their own outside of Android. We first chose a distributed revision control system, then further narrowed it down to Git.
Already a Git user?
-In most situations, you can use Git instead of Repo, or mix Repo and Git commands to form complex commands. Using Repo for basic across-network operations will make your work much simpler, however. For more information about Git, see the list of resources on ourDocumentation
+In most situations, you can use Git instead of Repo, or mix Repo and Git commands to form complex commands. Using Repo for basic across-network operations will make your work much simpler, however. For more information about Git, see the list of resources on our Documentation
page.
-Task reference
-The task list below shows a summary of how to do common Repo and Git tasks. For complete quick-start information and examples, see
Get source
+Task reference
+The task list below shows a summary of how to do common Repo and Git tasks. For complete quick-start information and examples, see
Get source
.
-Installing Repo
-$ curl http://android.git.kernel.org/repo ~/bin/repo
$ chmod a+x ~/bin/repo
-$ mkdir
working-directory-name
-
$ cd
working-directory-name
-$ repo init-u git://android.git.kernel.org/platform/manifest.git
+Installing Repo
+$ curl http://android.git.kernel.org/repo ~/bin/repo
$ chmod a+x ~/bin/repo
+$ mkdir
working-directory-name
+
$ cd
working-directory-name
+$ repo init-u git://android.git.kernel.org/platform/manifest.git
Synchronizing your client
-To synchronize the files for all available
projects
-:
$ repo sync
To synchronize the files for selected projects:
$ repo sync
project1 project2 ...
+To synchronize the files for all available
projects
+:
$ repo sync
To synchronize the files for selected projects:
$ repo sync
project1 project2 ...
Why use topic branches?
-Start a topic branch in your local work environment whenever you begin a change, for example when you begin work on a bug or new feature.
A topic branch is not a copy of the original files; it is a pointer to a particular commit. This makes creating local branches and switching among them a light-weight operation. By using branches, you canisolateone aspect of your work from the others. For an interesting article about using topic branches, see
Separating topic branches
+Start a topic branch in your local work environment whenever you begin a change, for example when you begin work on a bug or new feature.
A topic branch is not a copy of the original files; it is a pointer to a particular commit. This makes creating local branches and switching among them a light-weight operation. By using branches, you canisolateone aspect of your work from the others. For an interesting article about using topic branches, see
Separating topic branches
.
Creating topic branches
-To start a topic branch using Repo:
$ repo start
branchname
-
To verify that your new branch was created:
$ repo status
+To start a topic branch using Repo:
$ repo start branchname
+
To verify that your new branch was created:
$ repo status
Using topic branches
-To assign the branch to a particular project:
$ repo startbranch
+To assign the branch to a particular project:
$ repo start branch
name project
-
To switch back and forth among branches that you have created in your local work environment:
$ git checkoutbranchname
-
To see a list of existing branches:
$ git branch
or...
$ repo branches
The name of the current branch will be preceded by an asterisk.
+
To switch back and forth among branches that you have created in your local work environment:
$ git checkout
branchname
+
To see a list of existing branches:
$ git branch
or...
$ repo branches
The name of the current branch will be preceded by an asterisk.
Note:
A bug might be causing repo sync to reset the local topic branch. If git branch shows * (no branch) after you run repo sync, then run git checkoutagain.
Viewing client status
-To list the state of your files:
$ repo status
To see uncommitted edits:
$ repo diff
Therepo diffcommand shows every local edit that you have made that would
not
+To list the state of your files:
$ repo status
To see uncommitted edits:
$ repo diff
Therepo diffcommand shows every local edit that you have made that would
not
go into the commit, if you were to commit right now.
To see every edit that would go into the commit if you were to commit right now, you need a Git command, git diff. Before running it, be sure you are down in the project directory:
$ cd ~/
workingdirectory
/
project
-
$ git diff --cached
+
$ git diff --cached
Recovering sync conflicts
If a repo sync shows sync conflicts:
- View the files that are unmerged (status code = U).
- Edit the conflict regions as necessary.
-- Change into the relevant project directory, run git add and git commit for the files in question, and then "rebase" the changes. For example:
$ cd bionic
$ git add bionic/*
$ git commit
$ git rebase --continue
-- When the rebase is complete start the entire sync again:
$ repo syncbionicproj2
+ - Change into the relevant project directory, run git add and git commit for the files in question, and then "rebase" the changes. For example:
$ cd bionic
$ git add bionic/*
$ git commit
$ git rebase --continue
+- When the rebase is complete start the entire sync again:
$ repo syncbionic proj2
proj3
...
@@ -172,13 +79,13 @@ If a repo sync shows sync conflicts:
- View the files that are unmerged
-Cleaning up your client files
-To update your local working directory after changes are merged in Gerrit:
$repo sync
To safely remove stale topic branches:
$ repo prune
+Cleaning up your client files
+To update your local working directory after changes are merged in Gerrit:
$repo sync
To safely remove stale topic branches:
$ repo prune
Deleting a client
-Deleting a client willpermanently delete
-any changes you have not yet uploaded for review.Becauseall state information is stored in your client, you only need to delete the directory from your filesystem:
$ cd~
-
$ rm -rfworking-directory-name
+Deleting a client will permanently delete
+any changes you have not yet uploaded for review.Becauseall state information is stored in your client, you only need to delete the directory from your filesystem:
$ cd ~
+
$ rm -rf working-directory-name
Scripting common tasks
@@ -196,14 +103,14 @@ You can use Repo to run the same program across all projects:
$ repo fora
]
The -c argument is evaluated through /bin/sh and any arguments after it are passed through as shell positional parameters.
Repo command reference
-Repo usage takes the following form:
repocommand options
-
Optional elements are shown in brackets[ ]. Once Repo is installed, you can get information about any command by running
repo helpcommand
+Repo usage takes the following form:
repo command options
+
Optional elements are shown in brackets[ ]. Once Repo is installed, you can get information about any command by running
repo help command
init
-repo init -uurl
+repo init -u url
[options
-]
Installs Repo in the current directory. This creates a .repo/ directory that contains Git repositories for the Repo source code and the standard Android manifest files. The .repo/ directory also containsmanifest.xml, which is a symlink to the selected manifest in the .repo/manifests/ directory.
The -u argument specifies a URL from which to retrieve a manifest repository. For example:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
To select a manifest file within the repository, use the -m option. (If no manifest name is selected, the default is default.xml.)For example:
$ repo init -ugit://android.git.kernel.org/platform/manifest.git-m dalkvik-plus.xml
To specify a revision, that is, a particular manifest-branch, use the -b option. For example:
$ repo init -ugit://android.git.kernel.org/platform/manifest.git-b release-1.0
To see other repo init options, run
$ repo help init
Note:
+]
Installs Repo in the current directory. This creates a .repo/ directory that contains Git repositories for the Repo source code and the standard Android manifest files. The .repo/ directory also containsmanifest.xml, which is a symlink to the selected manifest in the .repo/manifests/ directory.
The -u argument specifies a URL from which to retrieve a manifest repository. For example:
$ repo init -u git://android.git.kernel.org/platform/manifest.git
To select a manifest file within the repository, use the -m option. (If no manifest name is selected, the default is default.xml.)For example:
$ repo init -ugit://android.git.kernel.org/platform/manifest.git-m dalkvik-plus.xml
To specify a revision, that is, a particular manifest-branch, use the -b option. For example:
$ repo init -ugit://android.git.kernel.org/platform/manifest.git-b release-1.0
To see other repo init options, run
$ repo help init
Note:
For all remaining Repo commands, the current working directory must either be the parent directory of .repo/ or a subdirectory of the parent directory.
sync
@@ -220,8 +127,8 @@ repo sync [project-list
When you run repo sync, this is what happens:
- If the project has never been synchronized, then repo sync is equivalent to git clone. All branches in the remote repository are copied to the local project directory.
-- If the project has already been synchronized once, then repo sync is equivalent to:
git remote update
git rebase origin/branch
-
wherebranch
+ - If the project has already been synchronized once, then repo sync is equivalent to:
git remote update
git rebase origin/branch
+
where branch
is the currently checked-out branch in the local project directory. If the local branch is not tracking a branch in the remote repository, then no synchronization will occur for the project.
If the git rebase operation results in merge conflicts, you will need to use the normal Git commands (for example, git rebase --continue) to resolve the conflicts.
The repo sync command also updates the private repositories in the .repo/ directory.
@@ -229,7 +136,7 @@ is the currently checked-out branch in the local project directory. If the local
upload
repo upload [
project-list
-]
For the specified projects, Repo compares the local branches to the remote branches updated during the last repo sync. Repo will prompt you to select one or more of the branches that have not yet been uploaded for review.
After you select one or more branches, all commits on the selected branches are transmitted to Gerrit over an SSH connection.You will need to configure an SSH key to enable upload authorization.Visit
SSH Keys
+]
For the specified projects, Repo compares the local branches to the remote branches updated during the last repo sync. Repo will prompt you to select one or more of the branches that have not yet been uploaded for review.
After you select one or more branches, all commits on the selected branches are transmitted to Gerrit over an SSH connection.You will need to configure an SSH key to enable upload authorization.Visit
SSH Keys
within the user settings panel to register your public keys with Gerrit.To enable password-less uploads, consider using ssh-agent on your client system.
When Gerrit receives the object data over its SSH server, it will turn each commit into a change so that reviewers can comment on each commit individually.
To combine several "checkpoint" commits together into a single commit, use git rebase -i before you run repo upload.
You can specify project-list as a list of names or a list of paths to local source directories for the projects:
repo upload [
proj1
proj2
...
@@ -238,13 +145,13 @@ within the user settings panel to register your public keys with Gerrit.To enabl
]
If you run repo upload without any arguments, it will search all the projects for changes to upload.
To make edits to changes after they have been uploaded, you should use a tool likegit rebase -ior git commit --amend to update your local commits.
After your edits are complete:
- Make sure the updated branch is the currently checked out branch.
-- Use repo upload --replaceproj1
+
- Use repo upload --replace proj1
to open the change matching editor.
- For each commit in the series, enter the Gerrit change Id inside the brackets:
-
# Replacing from branch foo
[ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific...
[ 2829 ] ec18b4ba Update proto client to support patch set replacments
[ 3022 ] c99883fe Teach 'repo upload --replace' how to add replacement patch se...
# Insert change numbers in the brackets to add a new patch set.
# To create a new change record, leave the brackets empty.
After the upload is complete the changes will have an additional Patch Set (e.g. Patch Set 2, Patch Set 3, ...).
+
# Replacing from branch foo
[ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific...
[ 2829 ] ec18b4ba Update proto client to support patch set replacments
[ 3022 ] c99883fe Teach 'repo upload --replace' how to add replacement patch se...
# Insert change numbers in the brackets to add a new patch set.
# To create a new change record, leave the brackets empty.
After the upload is complete the changes will have an additional Patch Set (e.g. Patch Set 2, Patch Set 3, ...).
diff
@@ -256,28 +163,28 @@ repo diff [
project-list
projN
]
Options:
-h, --helpmeans show this help message and exit.
-download
-repo download
target
+download
+repo download
target
change
-
Downloads the specified change into the specified local directory. (Added to Repo as of version 1.0.4.)
For example, to download
change 1241
+
Downloads the specified change into the specified local directory. (Added to Repo as of version 1.0.4.)
For example, to download
change 1241
into your platform/frameworks/base directory:
$ repo download platform/frameworks/base 1241
A"repo sync"should effectively remove any commits retrieved via "repo download".Or, you can check out the remote branch; e.g., "git checkout m/master".
Note:
-As of Jan. 26, 2009, there is a mirroring lag of approximately 5 minutes between when a change is visible on the web in
Gerrit
+As of Jan. 26, 2009, there is a mirroring lag of approximately 5 minutes between when a change is visible on the web in
Gerrit
and when repo download will be able to find it, because changes are actually downloaded off the git://android.git.kernel.org/ mirror farm. There will always be a slight mirroring lag as Gerrit pushes newly uploaded changes out to the mirror farm.
forall
repo forall [
project-list
-] -c
command
+] -c
command
[
arg.
-..]
Runs a shell command in each project.
You can specify project-list as a list of names or a list of paths to local source directories for the projects
+..]
Runs a shell command in each project.
You can specify project-list as a list of names or a list of paths to local source directories for the projects
help
repo help [
command
]
Displays detailed help about a command.
-prune
+prune
repo prune [
project-list
]
Prunes (deletes) topics that are already merged.
You can specify project-list as a list of names or a list of paths to local source directories for the projects:
repo prune [
proj1
proj2
@@ -288,10 +195,10 @@ repo prune [
project-list
start
-repo start
newbranchname
+repo start
newbranchname
[
project-list
-]
Starts a new branch for development.
The
newbranchname
-argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default.
The
project-list
+]
Starts a new branch for development.
The newbranchname
+argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default.
The project-list
specifies which projects will participate in this topic branch. You can specify project-list as a list of names or a list of paths to local working directories for the projects:
repo start default [proj1
proj2
...
@@ -307,7 +214,7 @@ repo status [project-list
...
projN
-]
To see the status for only the current branch, run
repo status .
The status information will be listed by project. For each file in the project, a two-letter code is used:
+]
To see the status for only the current branch, run
repo status .
The status information will be listed by project. For each file in the project, a two-letter code is used: