Commit Graph

1886 Commits

Author SHA1 Message Date
Shawn O. Pearce
c99883fee9 Teach 'repo upload --replace' how to add replacement patch sets
Users are prompted with the list of known changes we are about
to upload, and they can fill out the current change numbers for
any changes which already exist in the data store.  For each of
those changes the change number and commit id is sent as part of
the upload request, so Gerrit can insert the new commit as a new
patch set of the existing change, rather than make a new change.

This facility permits developers to replace a patch so they can
address comments made on a prior version of the same change.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-12 09:12:19 -08:00
Shawn O. Pearce
ec18b4bac4 Update proto client to support patch set replacments
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-12 09:12:19 -08:00
Shawn O. Pearce
35f2596c27 Refactor part of GetUploadableBranches to lookup one specific branch
This way project.GetUploadableBranch(project.CurrentBranch) can tell
us how (if at all) to upload the currently checked out branch.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-12 09:12:17 -08:00
Shawn O. Pearce
5d40e26201 Treat missing attributes as None when parsing the manifest
Some of our code assumes that a property is None.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-06 11:23:27 -08:00
Shawn O. Pearce
70939e2f73 Add <add-remote to-project="..."> to inject additional remotes
This way users can add forks they know about to an existing project
that was already declared in the primary manifest.  This is mostly
useful with the Linux kernel project, where multiple forks is quite
common for the main upstream tree (e.g. Linus' tree), a platform
architecture tree (e.g. ARM) and a device specific tree (e.g. the
msm7k tree used by Android).

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-06 11:23:08 -08:00
Shawn O. Pearce
ae6e0949d1 Add <remote project-name="..."> attribute within projects
By setting a project-name on a remote nested within a project forks
of a project like the Linux kernel can be easily handled by fetching
all relevant forks into the same client side project under different
remote names.  Developers can create branches off different remotes
using `git checkout --track -b $myname $remote/$branch` and later
`repo upload` automatically redirects to the proper fork project
in the code review server.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-06 11:23:06 -08:00
Shawn O. Pearce
339ba9f6f7 Use remote.*.projectname to indicate the target project for upload
This way "forks" of a project, e.g. the linux kernel, can be setup to
use different destination projects in the review server by creating
different remotes in the client side Git repository.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-06 09:52:51 -08:00
Shawn O. Pearce
70cd4ab270 Add some short documentation about the local manifest
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-06 08:48:44 -08:00
Shawn O. Pearce
e284ad1d1a Add 'repo init --mirror' to download a complete forrest
The mirror option downloads a complete forrest (as described by the
manifest) and creates a replica of the remote repositories rather
than a client working directory.  This permits other clients to
sync off the mirror site.

A mirror can be positioned in a "DMZ", where the mirror executes
"repo sync" to obtain changes from the external upstream and
clients inside the protected zone operate off the mirror only,
and therefore do not require direct git:// access to the external
upstream repositories.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-05 18:08:32 -08:00
Shawn O. Pearce
3e5481999d Add a basic outline of the repo manifest file format
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-04 11:19:36 -08:00
Shawn O. Pearce
d3c388391e Update proto_client to notify the user when auth cookies are accessed
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-04 10:49:04 -08:00
Shawn O. Pearce
2450a2987a Assume the manifest branch matches the branch name in Git
Whatever branch name we checked the manifest out from is the name
we want to reflect throughout the rest of the projects, e.g. within
the special "m/" remote space.

This reduces the difference between different branches within the
manifest file.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-04 09:45:59 -08:00
Shawn O. Pearce
f5c25a68d8 Cleanup stale manifest migration code from manifest.py
Prior to open-sourcing repo we had manifests in two different
layouts; one where the manifest was a straight-up git clone, and
one where the manifest was our bare repository with symlink work
tree format (identical to what our projects use).  Only the latter
form is created or used by repo at this point, so the transition
code to handle the straight-up git clone is not necessary.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-04 09:45:59 -08:00
Shawn O. Pearce
9fa44db94b Introduce 'repo abandon <branchname>' as an alias for 'git branch -D'
This destroys a local development branch, removing all history
of that branch from ever existing.  If the branch is currently
checked out we move back to the upstream revision.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-03 11:24:59 -08:00
Shawn O. Pearce
c9ef744c7b Install a default pre-auto-gc hook in all repositories
This hook is evaluated by `git gc --auto` to determine if it is a
good idea to execute a GC at this time, or defer it to some later
date.  When working on a laptop its a good idea to avoid GC if you
are on battery power as the extra CPU and disk IO would consume a
decent amount of the charge.

The hook is the standard sample hook from git.git contrib/hooks,
last modified in git.git by 84ed4c5d117d72f02cc918e413b9861a9d2846d7.
I added the GPLv2 header to the script to ensure the license notice
is clear, as it does not match repo's own APLv2 license.

We only update hooks during initial repository creation or on
a repo sync.  This way we don't incur huge overheads from the
hook stat operations during "repo status" or even the normal
"repo sync" cases.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-03 11:00:44 -08:00
Shawn O. Pearce
438ee1cad9 Catch symlink creation failures and report a better error
Some users have noticed that repo doesn't work on VFAT, as we
require a POSIX filesystem with POSIX symlink support.  Catching the
OSError during our symlink creation and raising a GitError with a
more descriptive message will help users to troubleshoot and fix
their own installation problems.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-11-03 09:59:36 -08:00
Shawn O. Pearce
23d7781c0b Don't print "Already up-to-date" during repo sync
If we are already up-to-date we just want to display no output.
This means we have to avoid calling "git merge" if there aren't
commits to be merged into the working directory.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-30 11:06:57 -07:00
Shawn O. Pearce
a54c527ae9 Fast-forward a fully merged topic branch during 'repo sync'
Instead of trying to rebase the changes on a topic branch that
has been fully merged into the upstream branch we track, we should
just fast-forward the topic branch to the new upstream revision.
This way the branch doesn't try to rewrite commits that are already
merged in the upstream.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-30 11:03:00 -07:00
Shawn O. Pearce
df830f1238 Remove import_tar, import_zip and the <snapshot> elements
Now that repo relies only on the git data stream (as it is much
faster to download through) we don't really need to be parsing the
<snapshot> elements within manifest.  Its a lot of complex code to
convert the tar (or zip) through to a fast import stream, and we
just aren't calling it anymore.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-30 09:21:43 -07:00
Shawn O. Pearce
90be5c0839 Cache the per-user configuration to avoid duplicate instances
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-29 15:24:34 -07:00
Shawn O. Pearce
7965f9fed0 Move the Editor configuration out of Manifest's constructor
This way we can build more than one Manifest instance in memory
and not muck around with the Editor configuration each time we
build a new instance.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-29 15:24:34 -07:00
Shawn O. Pearce
de646819b8 Don't flip out if there are no template hooks
Git may have been installed without its hooks directory, which
means we won't have any hooks in a repo created git repository.
Since we are just deleting the hooks it doesn't matter.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-29 14:38:12 -07:00
Shawn O. Pearce
bd4edc9a69 Stop downloading snapshots as native git:// is faster
Downloading and streaming a tar into Git is slower than just
letting the native git:// protocol handle the data transfer,
especially when there are multiple revisions available and
Git can perform delta compression across revisions.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-28 16:14:05 -07:00
Shawn O. Pearce
ce03a401c6 Stop hiding remote missing object errors
Hiding error messages from the remote peer is not a good idea,
as users should be made aware when the remote peer is not a
complete Git repository so they can alert the administrators
and have the repository corrected.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-28 16:12:03 -07:00
Shawn O. Pearce
45476c40c7 wrapper 1.6
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-28 08:46:15 -07:00
Shawn O. Pearce
1619134720 Added missing wait after git-version call in wrapper
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-28 08:44:18 -07:00
Shawn O. Pearce
7efd1a5b23 Remove unused import from gerrit_upload.py
Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-28 08:44:18 -07:00
Shawn O. Pearce
329c31da7d Repair any mis-directed android-1.0 annotated tags
The initial open source release of the Android 1.0 platform had
some problems with its Perforce->Git imports.  Google was forced
to rewrite some history to redirect users onto more stable upstream
sources and correct errors in the imports.

Not everyone has the correct android-1.0 tags, as some users did
manage to fetch the platform early, before the mirror sites crashed
and the history was rewritten.

This change is a band-aid to ensure any stale android-1.0 tags are
get updated to the corrected version.  It should be backed out at
some point in the near future, when we can be fairly certain that
everyone has the correct android-1.0 tags.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-24 09:17:25 -07:00
Shawn O. Pearce
5cc6679fb8 Support user supplied custom .repo/local_manifest.xml files
By creating a .repo/local_manifest.xml the user can add extra
projects into their client space, without touching the main
manifest script.

For example:

  $ cat .repo/local_manifest.xml
  <?xml version="1.0" encoding="UTF-8"?>
  <manifest>
   <project path="android-build"
            name="platform/build"
            remote="korg"
            revision="android-1.0" />
  </manifest>

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-23 16:20:14 -07:00
Shawn O. Pearce
632768bc65 Teach repo how to download changes to the local checkout
Now `repo download . 1402` would download the change numbered 1402
into the current project and check it out for the user, using a
detached HEAD.  `repo sync .` would back out of the change and
return to the upstream version.

Multiple projects can be fetched at once by listing them out on
the command line as different arguments.

Individual patch sets can be selected by adding a '/n' to indicate
the n-th patch set should be downloaded instead of the default of
patch set 1.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-23 14:43:28 -07:00
Shawn O. Pearce
0758d2f1d6 Show which user account each change was uploaded under
This way users are well aware of which account we used when the
uploads are complete, so they can be certain to sign into the web
application with that user identity.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-22 13:13:40 -07:00
Shawn O. Pearce
bb0ee80571 Change RPC client to only use Google Accounts for authentication
Hosted domain account (such as "@google.com" itself) don't work on the
Google App Engine service unless the user specifically creates their
own Google Account (https://www.google.com/accounts/NewAccount) with
the same email address.

When both such accounts exist we must *only* use the Google Account in
our auth request, as that is all Google App Engine will honor when we
send it the session cookie.

However, Google has internal servers that may also be running Gerrit
based applications.  In those case we must use the hosted auth login
for @google.com user accounts, as the internal servers honor only the
hosted account and not the public Google Account database.

In the future we may need to add other domains to the "HOSTED" list
if other Gerrit instances are setup on hosted domains and locked to
only those domain's user accounts, similar to how a server that is
internal to Google would be setup.  Since this is currently not a
likely occurrence I'm not worrying about making it configurable at
this juncture.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-22 13:10:29 -07:00
Shawn O. Pearce
02dbb6d120 Fix StopIteration exception during repo {sync,status}
If we run out of entries next() will throw StopIteration.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-21 13:59:08 -07:00
Shawn O. Pearce
7542d664de Remove the Python 2.4 dependency and use just 'python'
Many Linux distributions are including python2.5 by default, as
it is the latest stable release of the language.  Using python2.4
(and asking users to specifically install it) is just cruel and
unusual punishment.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-21 07:12:42 -07:00
Shawn O. Pearce
0734600ce0 Fix 'repo sync' when the remote reflog has only 1 entry
If the reflog for the upstream branch has only 1 entry in it, as
the branch has been updated only once, we can get back the 0{40}
object id from `git rev-parse upstream@{1}`, in which case we should
consider it to be the same as if upstream@{1} is not defined.

Signed-off-by: Shawn O. Pearce <sop@google.com>
2008-10-21 07:12:36 -07:00
The Android Open Source Project
cf31fe9b4f Initial Contribution 2008-10-21 07:00:00 -07:00