summaryrefslogtreecommitdiffstats
path: root/project.py
Commit message (Collapse)AuthorAgeFilesLines
...
* sync: Enable use of git clone --referenceShawn O. Pearce2010-10-291-7/+94
| | | | | | | | | Use git clone to initialize a new repository, and when possible allow callers to use --reference to reuse an existing checkout as the initial object storage area for the new checkout. Change-Id: Ie27f760247f311ce484c6d3e85a90d94da2febfc Signed-off-by: Shawn O. Pearce <sop@google.com>
* upload -t: Automatically include local branch nameShawn O. Pearce2010-07-151-4/+13
| | | | | | | | | | | If the -t flag is given to upload, the local branch name is automatically sent to Gerrit Code Review as the topic branch name for the change(s). This requires the server to be Gerrit Code Review v2.1.3-53-gd50c94e or later, which isn't widely deployed right now, so the default is opt-out. Change-Id: I034fcacb405b7cb909147152db427fe69dd7bcbf Signed-off-by: Shawn O. Pearce <sop@google.com>
* Warn users before uploading if there are local changesAnthony Newnam2010-07-151-0/+21
| | | | | Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40 Signed-off-by: Shawn O. Pearce <sop@google.com>
* sync: Try fetching a tag as a last resort before giving upJulius Gustavsson2010-07-151-3/+18
| | | | | | | | | | | | | | If a tagged commit is not reachable by the fetch refspec configured for the git (usually refs/heads/*) it will not be downloaded by 'git fetch'. The tag can however be downloaded with 'git fetch --tags' or 'git fetch tag <tag>'. This patch fixes the situation when a tag is not found after a 'git fetch'. Repo will issue 'git fetch tag <tag>' before giving up completely. Change-Id: I87796a5e1d51fcf398f346a274b7a069df37599a Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow files to be copied into new foldersMatthew Buckett2010-05-271-0/+4
| | | | Change-Id: I7f169e32be5a4328bb87ce7c2ff4b6529e925126
* Automatically install Gerrit Code Review's commit-msg hookv1.6.9Shawn O. Pearce2010-03-061-4/+18
| | | | | | | | | | | | | Most users of repo are also using Gerrit Code Review, and will want the commit-msg hook to be automatically installed into their local projects so that Change-Ids are assigned when commits are created, not when they are first uploaded. (cherry picked from commit a949fa5d202f0a1f812d7630f3e5bf0f02ca4e98 but squashed with latest hook script from version 2.1.2) Change-Id: Ie68b2d60ac85d8c2285d2e1e6a4536eb76695547 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fail sync when encountering "N commits behind."Daniel Sandler2010-03-041-4/+3
| | | | | | | | | | This is almost always something the user needs to address before continuing work, so promoting it to a failure (rather than simply an informational message) seems the right way to go. As a side-effect, repo will now exit with a non-zero status code in this situation, so pipelines of the form `repo sync && make` will fail if there are branches that are stalled due to uploaded but unmerged patches.
* Check that we are not overwriting a local repository when syncing.v1.6.8.11Nico Sallembien2010-01-201-1/+4
| | | | | | | | If a local git repository exists within the same folder as a new project that is added, when the user syncs the repo, the sync will overwrite the local files under the project's .git repository with its own symlinks. Make sure that we do not overwrite 'normal' files in repo and throw an error when that happens.
* sync: Fix split call on malformed email addressesv1.6.8.9Shawn O. Pearce2009-12-301-1/+1
| | | | | | | | | | | | | If an email address in a commit object contains a space, like a few malformed ones on the Linux kernel, we still want to split only on the first space. Unfortunately my brain was too damaged by Perl and originally wrote the split asking for 2 results; in Python split's argument is how many splits to perform. Here we want only 1 split, to break apart the commit identity from the email address on the same line. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Silence 'Current branch %s is up to date' during syncShawn O. Pearce2009-06-031-3/+1
| | | | | | | | We accidentally introduced this message during 1.6.8 by always invoking `git rebase` when there were no new commits from the upstream, but the user had local commits. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix unnecessary self in project.pyShawn O. Pearce2009-06-011-1/+1
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change project.revision to revisionExpr and revisionIdShawn O. Pearce2009-05-291-91/+89
| | | | | | | | | The revisionExpr field now holds an expression from the manifest, such as "refs/heads/master", while revisionId holds the current commit-ish SHA-1 of the revisionExpr. Currently that is only filled in if the manifest points directly to a SHA-1. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change DWIMery hack for dealing with rewound remote branchShawn O. Pearce2009-05-291-35/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | The trick of looking at the reflog for the remote tracking branch and only going back one commit works some of the time, but not all of the time. Its sort of relying on the fact that the user didn't use `repo sync -n` or `git fetch` to only update the tracking branches and skip the working directory update. Doing this right requires looking through the history of the SHA-1 source (what the upstream used to be) and finding a spot where the DAG diveraged away suddenly, and consider that to be the rewind point. That's really difficult to do, as we don't have a clear picture of what that old point was. A close approximation is to list all of the commits that are in HEAD, but not the new upstream, and rebase all of those where the committer email address is this user's email address. In most cases, this will effectively rebase only the user's new original work. If the user is the project maintainer and rewound the branch themselves, and they don't want all of the commits they have created to be rebased onto the new upstream, they should handle the rebase on their own, after the sync is complete. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Refactor how projects parse remotes so it can be replacedShawn O. Pearce2009-05-291-12/+13
| | | | | | | | | We now feed Project a RemoteSpec, instead of the Remote directly from the XmlManifest. This way the RemoteSpec already has the full project URL, rather than just the base, permitting other types of manifests to produce the URL in their own style. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Remove support for the extra <remote> definitions in manifestsShawn O. Pearce2009-05-191-15/+0
| | | | | | | | | These aren't that widely used, and actually make it difficult for users to fully mirror a forest of repositories, and then permit someone else to clone off that forest, rather then the original upstream servers. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Automatically guess Gerrit change number in "repo upload --replace"v1.6.7.4Ficus Kirkpatrick2009-05-051-0/+13
| | | | | This feature only works if you have one commit to replace right now (the common case).
* Perform copy file activity when creating a new work directoryv1.6.7.1Shawn O. Pearce2009-04-211-0/+1
| | | | | | | | | | | | Performance improvements in repo sync caused us to skip out of the initial Sync_LocalHalf without ever running CopyFiles, so we didn't create the top level Makefile in new clients whose manifest request one with a <copyfile> element. Now we run CopyFiles after the initial read-tree that populates the project working directory. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix 'repo sync' rebase logic on a published branchv1.6.7Shawn O. Pearce2009-04-211-6/+3
| | | | | | | | | If the current branch is published, but all published commits are merged into the manifest revision, but there is also at least one unpublished commit on the current branch, we should rebase the unpublished commit, rather than creating a merge commit. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Automatically use SSH control master support during syncShawn O. Pearce2009-04-181-1/+9
| | | | | | | | | By creating a background ssh "control master" process which lives for the duration of our sync cycle we can easily cut the time for a no-op sync of 132 projects from 60s to 18s. Bug: REPO-11 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Highlight projects which still have sync failures during 'repo status'Shawn O. Pearce2009-04-181-3/+15
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Modify 'repo abandon' to be more like 'repo checkout' and 'repo start'Shawn O. Pearce2009-04-181-10/+30
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Improve checkout performance for the common unmodified caseShawn O. Pearce2009-04-181-11/+32
| | | | | | | | | Most projects will have their branch heads matching in all branches, so switching between them should be just a matter of updating the work tree's HEAD symref. This can be done in pure Python, saving quite a bit of time over forking 'git checkout'. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add progress meter to 'repo start'Shawn O. Pearce2009-04-181-2/+4
| | | | | | | | | | This is mostly useful if the number of projects to switch is many (e.g. all of Android) and a large number of them are behind the current manifest revision. We wind up needing to run git just to make the working tree match, and that often makes the command take a couple of seconds longer than we'd like. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Make usage of open safer by setting binary mode and closing fdsShawn O. Pearce2009-04-181-4/+6
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Speed up 'repo start' by removing some forksShawn O. Pearce2009-04-181-22/+60
| | | | | | | | | | Its quite common for most projects to be matching the current manifest revision, as most developers only modify one or two projects at any one time. We can speed up `repo start foo` (that impacts the entire client) by performing most of the branch creation and switch operations in pure Python, and thus avoid 4 forks per project. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Remove unused methods from project.ReviewableBranchShawn O. Pearce2009-04-181-10/+0
| | | | | | | | These used to be used back when we had Gerrit 1.x support and used HTTP based uploads to transmit changes for review. Since we moved entirely to Gerrit 2.x, these are no longer called. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Only fetch repo once-per-day under normal 'repo sync' usageShawn O. Pearce2009-04-181-0/+8
| | | | | | | | | | | Its unlikely that a new version of repo will be delivered in any given day, so we now check only once every 24 hours to see if repo has been updated. This reduces the sync cost, as we no longer need to contact the repo distribution servers every time we do a sync. repo selfupdate can still be used to force a check. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Avoid git fork on the common case of repo not changingShawn O. Pearce2009-04-181-1/+19
| | | | | | | | | Usually repo is upgraded only once a week, if that often. Most of the time we invoke HasChanges on the repo project (or even on the manifest project) the current HEAD will resolve to the same SHA-1 as the remote tracking ref, and there are therefore no changes. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Avoid unnecessary git symbolic-ref calls during repo syncShawn O. Pearce2009-04-171-3/+6
| | | | | | | | If the m/BRANCH ref is already pointing at the value set in the manifest there is no reason to set it again. Leave it alone, thus saving a full fork+exec call. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Improve repo sync performance by avoid git forksShawn O. Pearce2009-04-171-15/+49
| | | | | | | | | | | By resolving the current HEAD and the manifest revision using pure Python, we can in the common case of "no changes" avoid a lot of git operations and directly jump out of the local sync method. This reduces the no-op `repo sync -l` time for Android's 114 projects from more than 6s to under 0.8s. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Implement git ref reading purely in PythonShawn O. Pearce2009-04-171-26/+4
| | | | | | | | | | | | | | | | | Its much faster to read the refs from 114 projects when the reader is pure Python and just doing file IO than forking 114 git commands and parsing their output. The reader caches refs based upon file mtimes. If any single ref file has been modified since the last read, we re-read the entire repository's ref namespace. This simplifies the code as we don't need to worry about shooting down symbolic-refs, but it may cause more IO than is necessary if only one ref gets updated. This change drops `repo branches` in Android from 1.658s to 0.206s. Likewise, `repo sync` improves dramatically as well. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Implement 'git symbolic-ref HEAD' in PythonShawn O. Pearce2009-04-171-8/+11
| | | | | | | | This is invoked once per project in `repo sync`. Taking it out saves about 1/114 of a second, so on a large set of projects like Android it can save up to a full second of sync time. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Remove confusing message from repo sync outputShawn O. Pearce2009-04-171-1/+0
| | | | | | | | Someone pointed out this message isn't always the truth; so we shouldn't print it. The code path is executed when there are published commits, yet our output talks about unpublished ones. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change repo sync to be more friendly when updating the treev1.6.6Shawn O. Pearce2009-04-161-56/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | We now try to sync all projects that can be done safely first, before we start rebasing user commits over the upstream. This has the nice effect of making the local tree as close to the upstream as possible before the user has to start resolving merge conflicts, as that extra information in other projects may aid in the conflict resolution. Informational output is buffered and delayed until calculation for all projects has been done, so that the user gets one concise list of notice messages, rather than it interrupting the progress meter. Fast-forward output is now prefixed with the project header, so the user can see which project that update is taking place in, and make some relation of the diffstat back to the project name. Rebase output is now prefixed with the project header, so that if the rebase fails, the user can see which project we were operating on and can try to address the failure themselves. Since rebase sits on a detached HEAD, we now look for an in-progress rebase during sync, so we can alert the user that the given project is in a state we cannot handle. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Refactor error message display in project.pyShawn O. Pearce2009-04-161-3/+5
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Use default rebase during sync instead of rebase -iShawn O. Pearce2009-04-161-2/+2
| | | | | | | | | | | | | | | rebase interactive (aka rebase -i) has changed in newer versions of git, and doesn't always generate the sequence of commits the same way it used to. It also doesn't handle having a previously applied commit try to be applied again. The default rebase algorithm is better suited to our needs. It uses --ignore-if-in-upstream when generating the patch series for git-am, and git-am with its 3-way fallback is able to handle a rename case just as well as the cherry-pick variant used by -m. Its also a generally faster implementation. Signed-off-by: Shawn O. Pearce <sop@google.com>
* status: tell the user the working tree is cleanShawn O. Pearce2009-04-101-1/+2
| | | | | | | | | If there is nothing output at all, tell the user the working tree is completely clean. It just gives them a bit more of a warm-fuzzy feeling knowing repo and until the end. It also more closely matches with the output of git status. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo sync -d' to detach projects from their current topicShawn O. Pearce2009-04-101-2/+2
| | | | | | | | | | The -d flag moves the project back to a detached HEAD state, matching what is listed in the manifest. This can be useful to set a client to something stable (or at least well-known), such as before a sequence of 'repo download' commands are used to get some changes for testing. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Make 'repo start' restartable upon failuresShawn O. Pearce2009-04-101-8/+23
| | | | | | | | | | | | | | | | | | | | If `repo start foo` fails due to uncommitted and unmergeable changes in a single project, we have switched half of the projects over to the new target branches, but didn't on the one that failed to move. This change improves the situation by doing three things differently: - We keep going when we encounter an error, so other projects that can successfully switch still switch. - We ignore projects whose current branch is already on the requested name; they are logically already setup. - We checkout the branch if it already exists, rather than trying to recreate the branch. Bug: REPO-22 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't capture stdout during 'repo checkout'Shawn O. Pearce2009-04-101-1/+1
| | | | | | | There isn't any great value in buffering stdout into memory coming from git checkout. So don't bother doing it. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add a repo branches subcommand to describe current branchesShawn O. Pearce2009-04-101-0/+26
| | | | | | | | We now display a summary of the available topic branches in this client, based upon a sorted union of all existing projects. Bug: REPO-21 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add checkout command.Wink Saville2009-04-101-0/+14
| | | | | | | Teach repo how to checkout a branch in all projects or a list of specific projects. Bug: REPO-21
* Add repo manifest -o to save a manifestv1.6.2Shawn O. Pearce2009-03-051-6/+8
| | | | | | | | | This can be useful to create a new manifest from an existing client, especially if the client wants to use the "-r" option to set each project's revision to the current commit SHA-1, making a sort of a tag file that can be used to recreate this exact state elsewhere. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Set core.bare to true on mirror repositoriesv1.6.1Shawn O. Pearce2009-03-031-1/+5
| | | | | | | | When creating a mirror repository we will always be using a bare repository. Setting $GIT_DIR/config to have core.bare = true is reasonable and helps Git to recognize the environment it is in. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Get rid of the horrible android import work around hackShawn O. Pearce2009-03-031-25/+0
| | | | | | | | | | | | | | | | | | | Months ago when the Android Open Source Project launched we had some import errors that had to be fixed and worked over. These hacks were here to help users update their clients to newer versions of the imported code. Its very likely all clients have either been deleted, or have been updated and have the fixed imports. So we don't need this hack in repo anymore. If a very ancient client still existed, it would need to be created from scratch anyway, due to the Android cupcake branch merging into master and the manifest changes not being able to be handled correctly by repo. A new client wouldn't have the incorrectly imported code in it, and thus wouldn't need this hack. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix repo status when there are renamed/copied filesShawn O. Pearce2009-03-031-1/+1
| | | | | | | | | I missed a parameter in the format string, but still provided the value in the parameter list, so the format failed to produce an output message. Bug: REPO-15 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Report better errors when a project revision is invalidShawn O. Pearce2009-03-021-0/+7
| | | | | | | | | If a manifest specifies an invalid revision property, give the user a better error message detaling the problem, instead of an ugly Python traceback with a strange Git error message. Bug: REPO-2 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix repo prune output to sort by branch nameShawn O. Pearce2009-03-021-1/+1
| | | | | | We didn't always sort the output. Now we do. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix repo prune to work on git 1.6.1-rc3~5 and laterShawn O. Pearce2009-03-021-11/+8
| | | | | | | | | | | | | | | | | | | | | Prior to git 1.6.1-rc3~5 the output of 'git branch -d' matched: Deleted branch (.*)\. where the subgroup grabbed the branch name. In v1.6.1-rc3~5 (aka a126ed0a01e265d7f3b2972a34e85636e12e6d34) Brandon Casey changed the output to include the SHA-1 of the branch name, now matching the pattern: Deleted branch (.*) \([0-9a-f]*\)\. Instead of parsing the output of git branch we now re-obtain the list of branches after the deletion attempt and perform a set difference in memory to determine which branches we were able to successfully delete. Bug: REPO-9 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Remove the protobuf based HTTP upload code pathShawn O. Pearce2009-01-261-28/+1
| | | | | | | | | Now that Gerrit2 has been released and the only supported upload protocol is direct git push over SSH we no longer need the large and complex protobuf client library, or the upload chunking logic in gerrit_upload.py. Signed-off-by: Shawn O. Pearce <sop@google.com>