summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* 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-182-3/+19
| | | | | | | | | | | 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>
* Only display a progress meter once we spend 0.5 seconds on a taskShawn O. Pearce2009-04-181-1/+10
| | | | | | | | | | | | | | | The point of the progress meter is to let the user know that the task is progressing, and give them a chance to estimate when it will be complete. If the task completes in under 0.5 seconds then it is sufficiently fast enough that the user doesn't need to be kept up-to-date on its progress; in fact showing the meter may just slow the task down waiting on the tty to redraw. We now delay the progress meter 0.5 seconds (or 1 second if the Python time.time() function isn't accurate enough) to avoid any really fast tasks, like a no-op local sync. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Disable the progress meter when trace is enabledShawn O. Pearce2009-04-181-0/+7
| | | | | | | | | The trace output often interfers with the progress meter, so its easier to just disable the progress meter if trace is active. Its already verbose enough to let the user know we are working, which is all the progress meter is there for anyway. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix `repo --trace` to show ref and config loadsShawn O. Pearce2009-04-185-17/+47
| | | | | | | | | The value of the varible TRACE was copied during the import, which happens before the --trace option can be processed. So instead we now use a function to determine if the value is set, as the function can be safely copied early during import. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Enable tracing of ref scans and config unpicklingShawn O. Pearce2009-04-172-1/+9
| | | | | | | | These are not as expensive as spawning a git command, but they are not free either. We want to keep track of how many times we wind up calling them on any particular operation. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Avoid unnecessary git symbolic-ref calls during repo syncShawn O. Pearce2009-04-172-5/+18
| | | | | | | | 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>
* Pickle parsed git config filesShawn O. Pearce2009-04-171-0/+38
| | | | | | | | | | | | | | | | We now cache the output of `git config --list` for each of our GitConfig instances in a Python pickle file. These can be read back in using only the Python interpreter at a much faster rate than we can fork+exec the git config process. If the corresponding git config file has a newer modification timestamp than the pickle file, we delete the pickle file and regenerate it. This ensures that any edits made by the user will be taken into account the next time we consult the file. This reduces the time for a no-op repo sync from 0.847s to 0.269s. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Improve repo sync performance by avoid git forksShawn O. Pearce2009-04-172-15/+60
| | | | | | | | | | | 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-172-26/+137
| | | | | | | | | | | | | | | | | 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>
* Only compute commits in repo upload if we need to show a promptShawn O. Pearce2009-04-171-2/+3
| | | | | | | | If the user has disabled a prompt, skip the two commands we use to obtain the list of commits and the date of the branch. These will never be displayed and just waste the end-user's time. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow review.URL.autoupload to skip prompting during `repo upload`Shawn O. Pearce2009-04-171-12/+44
| | | | | | | | | | | | If review.URL.autoupload is set to true in a project's .git/config or in ~/.gitconfig then `repo upload` will automatically upload, and skip prompting the end-user. Conversely, if review.URL.autoupload is set to false, then repo will refuse to upload to that project. Bug: REPO-25 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Supporrt mixed case subsection names in Git config filesShawn O. Pearce2009-04-171-11/+15
| | | | | | | | | | | | | | In the case of: [url "Foo"] insteadOf = Bar We should return "Bar" for the key "url.Foo.insteadof", but not for the key "url.foo.insteadof". This requires splitting the key into its components and only lower casing the section and value name, leaving the subsection portion alone. 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-164-62/+175
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Don't divide by zero in progress meterShawn O. Pearce2009-04-161-14/+27
| | | | | | | | | If there are no projects to fetch, the progress meter would have divided by zero during `repo sync`, and that throws a ZeroDivisionError. Instead we report the progress with an unknown amount remaining. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Document 'repo status' outputShawn O. Pearce2009-04-131-0/+38
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix formatting of 'repo help sync'Shawn O. Pearce2009-04-131-0/+1
| | | | | | The formatting for the enviroment variable section was incorrect. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Cleanup checkout help to match other commandsShawn O. Pearce2009-04-131-4/+6
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo selfupdate' to upgrade only repoShawn O. Pearce2009-04-132-15/+83
| | | | | | | Users may want to upgrade only repo to the latest release, but leave their working tree state alone and avoid 'repo sync'. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo grep' to support searching all projectsv1.6.5Shawn O. Pearce2009-04-101-0/+243
| | | | | | | | | Users can now use 'repo grep' to search all projects, rather than 'repo forall -c git grep'. Its not only shorter to type, but it also filters results better by highlighting which projects matched in the client workspace. Signed-off-by: Shawn O. Pearce <sop@google.com>
* status: tell the user the working tree is cleanShawn O. Pearce2009-04-102-3/+11
| | | | | | | | | 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 a project progress meter to 'repo sync'Shawn O. Pearce2009-04-102-1/+53
| | | | | | | | This way users can see how much is left during fetch. Its especially useful when most syncs are no-ops but there are hundreds of repositories to poll. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo sync -l' to only do local operationsShawn O. Pearce2009-04-101-25/+33
| | | | | | | | | | | | | This permits usage of 'repo sync' while offline, as we bypass the network based portions of the code and do only the local sync. An example use case might be: repo sync -n ; # while we have network ... some time later ... repo sync -l ; # while without network, come up to date Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo sync -d' to detach projects from their current topicShawn O. Pearce2009-04-102-3/+17
| | | | | | | | | | 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>
* Add 'repo sync -n' to only do the network transferShawn O. Pearce2009-04-101-0/+7
| | | | | | | | This makes it easier to update all repositories, without actually impacting the working directory, or learning about how to use `repo forall -c 'git fetch $REPO_REMOTE' `. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Hide the internal sync --repo-upgraded flag from usersShawn O. Pearce2009-04-101-1/+2
| | | | | | | | This is only meant to be passed through while repo upgrades itself during a sync. It should never be something a user invokes on their own. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Make 'repo start' restartable upon failuresShawn O. Pearce2009-04-103-10/+35
| | | | | | | | | | | | | | | | | | | | 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-102-0/+176
| | | | | | | | 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-102-0/+59
| | | | | | | Teach repo how to checkout a branch in all projects or a list of specific projects. Bug: REPO-21
* Don't start the pager if stdout is a pipev1.6.4Shawn O. Pearce2009-04-011-1/+1
| | | | | | | | | | | | | | | The repo script often uses a pager by default and will produce control characters (coloring) to standard output when using the pager, even if the output is redirected to another pipe or script. This is because the pager setup checked for the terminal presence on FD 0, and in case of redirection FD 0 is still attached to the terminal. Instead require that both FD 0 and FD 1 are connected to the terminal in order to start the pager. Bug: REPO-19, b.android.com/2004 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Only lookup review server '/ssh_info' once per repo processShawn O. Pearce2009-03-251-19/+33
| | | | | | | | If the user has multiple projects to upload changes to, and they are all going to the same review server, we only need to query the '/ssh_info' data once. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Produce a useful error if /ssh_info was HTML and not plain textShawn O. Pearce2009-03-251-0/+5
| | | | | | | | | | | | | | If /ssh_info is protected by an HTML based login page, we may get back a "200 OK" response from the server with some HTML document asking us to authenticate. This can't be parsed into a host name and port number, so we shouldn't even try. Valid host names and decimal port numbers cannot contain '<', but an unexpected HTML login page would. So we test for '<' to give us a fair indicator that the content isn't what we think it is, and bail out. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Handle review URLs pointing directly at GerritShawn O. Pearce2009-03-251-3/+6
| | | | | | | | | | | | If a review URL is set to 'http://host/Gerrit' because the user thinks that is the correct way to point repo at Gerrit, we should be a bit more flexible and fix the URL by dropping the '/Gerrit' suffix and replace it with '/ssh_info'. Likewise, if a review URL points already at '/ssh_info' for a Gerrit instance, we should leave it alone. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't bother listing branch URLs during uploadShawn O. Pearce2009-03-191-3/+0
| | | | | | | | | | | Modern Gerrit2 automatically outputs the URL for each commit to stderr as it creates the records. Dumping the URL ourselves is unnecessary additional output, and worse is just an approximate guess for the correct web URL. Gerrit might not live at the top level directory for the server, or might even prefer a different hostname for web connections than what is listed in the manifest. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix repo re-init in a mirror to not promptShawn O. Pearce2009-03-191-2/+2
| | | | | | | | | On a mirror client we don't prompt for user.name,user.email as the data is only necessary if you will make new commits. On a re-init we were testing the command line option, not the existing IsMirror property from the manifest configuration file. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Allow repo init to restart if URL was initially invalidv1.6.3Shawn O. Pearce2009-03-171-1/+1
| | | | | | | This allows the user to run "repo init -u" again after an initial attempt failed due to an invalid URL. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Give a more friendly error in 'repo init' if manifest url is invalidShawn O. Pearce2009-03-171-1/+5
| | | | | | | | Instead of a stack trace ending in origin/master not existing we now tell the user the manifest url is invalid if 'git fetch' has failed out early. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Set forall environment variables to empty string if NoneShawn O. Pearce2009-03-171-7/+12
| | | | | | | | If the value obtained is None we now set the variable to '' instead, in an attempt to make execve() happier about our 3rd argument, the env dictionary. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Support "repo init -b foo && repo sync" to switch baselinesShawn O. Pearce2009-03-091-1/+2
| | | | | | | | We now correctly support re-initializing an existing client to point to a different branch of the same manifest repository, effectively allowing the client to switch the baseline it is operating on. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Don't permit "repo init --mirror" in an existing clientShawn O. Pearce2009-03-091-2/+7
| | | | | | | | | | Simply setting repo.mirror true doesn't make a client into a mirror. The on-disk layout is completely wrong for a mirror repository, and until we fix our layout for a non-mirror client to more closely resemble the upstream we can't do anything to easily turn on or turn off the mirror status flag. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add global --trace command line optionShawn O. Pearce2009-03-091-0/+6
| | | | | | | | This has the same effect as saying "export REPO_TRACE=1" in your shell prior to starting repo, but is documented in the command usage and perhaps easier to use. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add repo manifest -o to save a manifestv1.6.2Shawn O. Pearce2009-03-053-13/+118
| | | | | | | | | 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>
* Add a 'repo manifest' command whose help is the manifest file formatShawn O. Pearce2009-03-043-46/+99
| | | | | | | This should make it easier for users to discover the file format on their own, and read about it. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Tell users how to see the complete list of commandsShawn O. Pearce2009-03-041-0/+1
| | | | | | Using "repo help --all" may not be obvious. Signed-off-by: Shawn O. Pearce <sop@google.com>