summaryrefslogtreecommitdiffstats
path: root/main.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Remove magic hackDavid Pursehouse2012-11-141-9/+1
| | | | | | | | | | | | | It should be assumed that on modern development environments, python is accessible to /usr/bin/env Change the shebang as necessary and remove the magic hack. This also means losing the -E option on the call to python, so that PYTHONPATH and PYTHONHOME will be respected and local configuration problems in those vars would be noticed Change-Id: I6f0708ca7693f05a4c3621c338f03619563ba630
* Merge "Print an error message when aborted by user"Conley Owens2012-11-121-0/+1
|\
| * Print an error message when aborted by userDavid Pursehouse2012-11-131-0/+1
| | | | | | | | Change-Id: If7378c5deaace0ac6ab2be961e38644d9373557d
* | Merge "Handle manifest parse errors in main"Conley Owens2012-11-121-0/+4
|\|
| * Handle manifest parse errors in mainDavid Pursehouse2012-11-131-0/+4
| | | | | | | | | | | | | | | | Add handling of manifest parse errors in the main method, and print an error. This will prevent python tracebacks being dumped in many cases. Change-Id: I75e73539afa34049f73c993dbfda203f1ad33b45
* | Merge "Change usages of xrange() to range()"Conley Owens2012-11-121-1/+1
|\ \ | |/ |/|
| * Change usages of xrange() to range()Sarah Owens2012-11-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In Python3, range() creates a generator rather than a list. None of the parameters in the ranges changed looked large enough to create an impact in memory in Python2. Note: the only use of range() was for iteration and did not need to be changed. This is part of a series of changes to introduce Python3 support. Change-Id: I50b665f9296ea160a5076c71f36a65f76e47029f
* | Fix pylint warning W0108: Lambda may not be necessaryDavid Pursehouse2012-11-071-4/+3
|/ | | | | | Remove unnecessary usage of lambda. Change-Id: I06d41933057d60d15d307ee800cca052a44754c6
* Use python3 urllib when urllib2 not availableSarah Owens2012-10-311-13/+22
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I605b145791053c1f2d7bf3c907c5a68649b21d12
* Even more coding style cleanupDavid Pursehouse2012-10-301-1/+0
| | | | | | | | | | | Fixing some more pylint warnings: W1401: Anomalous backslash in string W0623: Redefining name 'name' from outer scope W0702: No exception type(s) specified E0102: name: function already defined line n Change-Id: I5afcdb4771ce210390a79981937806e30900a93c
* Update PGP keys during _PostRepoUpgrade in `sync`Conley Owens2012-10-251-9/+9
| | | | | | | | Previously, if a key was added, a client wouldn't add the key during the sync step. This would cause issues if a new key were added and a subsequent release were signed by that key. Change-Id: I4fac317573cd9d0e8da62aa42e00faf08bfeb26c
* Use modern Python exception syntaxSarah Owens2012-10-231-5/+5
| | | | | | | | | | | "except Exception as e" instead of "except Exception, e" This is part of a transition to supporting Python 3. Python >= 2.6 support "as" syntax. Note: this removes Python 2.5 support. Change-Id: I309599f3981bba2b46111c43102bee38ff132803
* More coding style cleanupDavid Pursehouse2012-10-221-1/+1
| | | | | | | | | | | | | | | | Fixing more issues found with pylint. Some that were supposed to have been fixed in the previous sweep (Ie0db839e) but were missed: C0321: More than one statement on a single line W0622: Redefining built-in 'name' And some more: W0631: Using possibly undefined loop variable 'name' W0223: Method 'name' is abstract in class 'name' but is not overridden W0231: __init__ method from base class 'name' is not called Change-Id: Ie119183708609d6279e973057a385fde864230c3
* Support HTTP authentication using user input as fallbackJoonCheol Park2012-10-121-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If repo could not find authentication credentials from ~/.netrc, this patch tries to get user and password from user's console input. This could be a good choice if user doesn't want to save his plain password in ~/.netrc or if user doesn't know about the netrc usage. The user will be prompted only if authentication infomation does not exist in the password manager. Since main.py firstly loads auth infomation from ~/.netrc, this will be executed only as fallback mechanism. Example: $ repo upload . Upload project xxx/ to remote branch master: branch yyy ( 1 commit, ...): to https://review.zzz.com/gerrit/ (y/N)? y (repo may try to access to https://review.zzz.com/gerrit/ssh_info and will get the 401 HTTP Basic Authentication response from server. If no authentication info in ~/.netrc, This patch will ask username/passwd) Authorization Required (Message from Web Server) User: pororo Password: .... [OK ] xxx/ Change-Id: Ia348a4609ac40060d9093c7dc8d7c2560020455a
* Rename "dir" variablesMickaël Salaün2012-10-101-2/+2
| | | | | | | The variable name "dir" conflicts with the name of a Python built-in function: http://docs.python.org/library/functions.html#dir Change-Id: I850f3ec8df7563dc85e21f2876fe5e6550ca2d8f
* Coding style cleanupDavid Pursehouse2012-10-091-5/+5
| | | | | | | | | | | | | | | Fix the following issues reported by pylint: C0321: More than one statement on a single line W0622: Redefining built-in 'name' W0612: Unused variable 'name' W0613: Unused argument 'name' W0102: Dangerous default value 'value' as argument W0105: String statement has no effect Also fixed a few cases of inconsistent indentation. Change-Id: Ie0db839e7c57d576cff12d8c055fe87030d00744
* Remove unused importsDavid Pursehouse2012-08-231-1/+0
| | | | | | There are several imports that are not used. Remove them. Change-Id: I2ac3be66827bd68d3faedcef7d6bbf30ea01d3f2
* Add support for Apache Digest authentication for repo init.Xiaodong Xu2012-03-141-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | repo tool supports only Basic authentication for now. For those who want to use this tool to manage their own projects, in case the administrator has configured the Apache server with Digest authentication method, users will fail to be authenticated when they run the command 'repo init'. Add the digest authentication password manager to the handler list will fix this issue. Since Git HTTP protocol will require the user be authenticated for fetch operation first before pushing commits to the remote, it is unlikely for the administrator to implement anonymous read (aka pull) access and write access (aka push) for authenticated user. Both read and write have to be authenticated. Be aware that the user may have to add an extra line in his ~/.netrc file: ------------------- account example.com ------------------- where 'example.com' is the realm for Apache Digest authentication. Change-Id: I76eb27b205554426d9ce1965deaaf727b87916cd Signed-off-by: Xiaodong Xu <stid.smth@gmail.com>
* Describe the repo launch version in `repo version`Shawn O. Pearce2011-11-291-0/+4
| | | | | | | | | | | | repo version v1.7.8 (from https://android.googlesource.com/tools/repo.git) repo launcher version 1.14 (from /home/sop/bin/repo) git version 1.7.8.rc2.256.gcc761 Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) [GCC 4.4.3] Change-Id: Ifcbe5b0e226a1a6ca85455eb62e4da5e9a0f0ca0
* Propagate result codes from subcmds to sys.exit().Daniel Sandler2011-11-291-10/+17
| | | | | | | Allows scripts driving repo to know when git failures have occurred, not just repo internal errors. Change-Id: Id20fbbb405c35a148e72c87b822da3f3bf93839c
* Fix sync on Python 2.6.6v1.7.7.4Shawn O. Pearce2011-10-111-0/+2
| | | | | | | | | | Python 2.6.6 has the same bug as Python 2.7, where HTTP authentication just stops working, but does not have the setter method to clear the retry counter. Work around by setting the field directly if it exists. Change-Id: I6a742e606bb7750dc66c33fc7c5d1310541db2c8 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix Python 2.4 supportShawn O. Pearce2011-10-111-1/+8
| | | | | Change-Id: I89521ae52fa564f0d849cc51e71fee65b3c47bab Signed-off-by: Shawn O. Pearce <sop@google.com>
* Work around Python 2.7 urllib2 bugShawn O. Pearce2011-10-111-1/+10
| | | | | | | | | | | | | | | If the remote is using authenticated HTTP, but does not have $GIT_URL/clone.bundle files in each repository, an initial sync would fail around 8 projects in due to the library not resetting the number of failures after getting a 404. Work around this by updating the retry counter ourselves. The urllib2 library is also not thread-safe. Make it somewhat safer by wrapping the critical section with a lock. Change-Id: I886e2750ef4793cbe2150c3b5396eb9f10974f7f Signed-off-by: Shawn O. Pearce <sop@google.com>
* sync: Support downloading bundle to initialize repositoryv1.7.7Shawn O. Pearce2011-09-281-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | An HTTP (or HTTPS) based remote server may now offer a 'clone.bundle' file in each repository's Git directory. Over an http:// or https:// remote repo will first ask for '$URL/clone.bundle', and if present download this to bootstrap the local client, rather than relying on the native Git transport to initialize the new repository. Bundles may be hosted elsewhere. The client automatically follows a HTTP 302 redirect to acquire the bundle file. This allows servers to direct clients to cached copies residing on content delivery networks, where the bundle may be closer to the end-user. Bundle downloads are resumeable from where they last left off, allowing clients to initialize large repositories even when the connection gets interrupted. If a bundle does not exist for a repository (a HTTP 404 response code is returned for '$URL/clone.bundle'), the native Git transport is used instead. If the client is performing a shallow sync, the bundle transport is not used, as there is no way to embed shallow data into the bundle. Change-Id: I05dad17792fd6fd20635a0f71589566e557cc743 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Ignore missing ~/.netrcv1.7.6.1Shawn O. Pearce2011-09-231-0/+2
| | | | | Change-Id: Ifa6065d57a6cb11ad57ddd44bc88d9690fe234ab Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add global option --time to track executionShawn O. Pearce2011-09-221-1/+18
| | | | | | | | | This prints a simple line after a command ends, providing information about how long it executed for using real wall clock time. Its mostly useful for looking at sync times. Change-Id: Ie0997df0a0f90150270835d94b58a01a10bc3956 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Support ~/.netrc for HTTP Basic authenticationShawn O. Pearce2011-09-191-0/+12
| | | | | | | | | If repo tries to access a URL over HTTP and the user needs to authenticate, offer a match from ~/.netrc. This matches behavior with the Git command line client. Change-Id: I803f3c5d562177ea0330941350cff3cc1e1bef08 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Enhance HTTP supportShawn O. Pearce2011-09-191-2/+58
| | | | | | | | | | | | | | Setting REPO_CURL_VERBOSE=1 in the environment will register a debug level HTTPHandler on the urllib2 library, showing HTTP requests and responses on the stderr channel of repo. During any HTTP or HTTPS request created inside of the repo process, a custom User-Agent header is now defined: User-Agent: git-repo/1.7.5 (Linux) git/1.7.7 Python/2.6.5 Change-Id: Ia5026fb1e1500659bd2af27416d85e205048bf26 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Honor http_proxy variable globallyShawn O. Pearce2011-09-111-0/+8
| | | | | | | | If the http_proxy environment variable was set, honor it during the entire repo session for any Python created HTTP connections. Change-Id: Ib4ae833cb2cdd47ab0126949f6b399d2c142887d Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add "repo branch" as an alias for "repo branches"Mike Lockwood2011-01-091-0/+2
| | | | | | | For those of us that are used to typing "git branch". Signed-off-by: Mike Lockwood <lockwood@android.com> (cherry picked from commit 33f0e786bb35ea11da1e3d1746c431da5f1d93eb)
* Fixed race condition in 'repo sync -jN' that would open multiple masters.v1.7.2Doug Anderson2010-12-211-1/+2
| | | | | | | | This fixes the SSH Control Masters to be managed in a thread-safe fashion. This is important because "repo sync -jN" uses threads to sync more than one repository at the same time. The problem didn't show up earlier because it was masked if all of the threads tried to connect to the same host that was used on the "repo init" line.
* Refactor Manifest to be XmlManifestShawn O. Pearce2009-05-291-2/+2
| | | | | | | | We'll soon be supporting two different manifest formats, but we can't immediately remove support for the current XML one that is in wide spread use within Android. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Automatically use SSH control master support during syncShawn O. Pearce2009-04-181-1/+5
| | | | | | | | | 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>
* Add -p to `repo forall` to improve output formattingShawn O. Pearce2009-04-181-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to read log output from many projects at once it can be difficult to make sense of which messages came from where. For many professional developers it is common to want to view the last week's worth of your work, so you can write a weekly summary of your activity for your status report. This is easier with the new -p option: repo forall -pc git log --reverse --since=1.week.ago --author=sop produces a report of all commits written by me in the last week, formatted in a paged output display, with headers inserted in front of each project's output. Where this can be even more useful is with git log's pickaxe, e.g. now we can use: repo forall -pc git log -Sbar v1.0..v1.1 to locate all additions or removals of the symbol 'bar' since v1.0, up to and including v1.1. Before displaying the matching commits in a project, a project header is shown, giving the user some context information for the matching results. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Fix `repo --trace` to show ref and config loadsShawn O. Pearce2009-04-181-2/+2
| | | | | | | | | 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>
* 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>
* Don't permit users to run repo status in a mirror clientShawn O. Pearce2009-03-031-1/+9
| | | | | | | | | | | | | | | | If a client was created with "repo init --mirror" then there are no working directories present, and no files checked out. Using a command like "repo status" in this context makes no sense, and actually throws back a Pytyon traceback at the console when the underlying commands fail out. We now tag commands with the MirrorSafeCommand type if they are able to be executed within a mirror directory safely. Using a command in a mirror which lacks this base class results in a useful error letting you know the command isn't supported. Bug: REPO-14 Signed-off-by: Shawn O. Pearce <sop@google.com>
* Add 'repo version' to describe what code we are runningShawn O. Pearce2009-03-021-0/+10
| | | | | | | I meant to have this in here, so clients can more easily report what version of repo they are running. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Report better errors when a project revision is invalidShawn O. Pearce2009-03-021-0/+4
| | | | | | | | | 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>
* Install a default pre-auto-gc hook in all repositoriesShawn O. Pearce2008-11-031-3/+5
| | | | | | | | | | | | | | | | | | | | 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>
* Move the Editor configuration out of Manifest's constructorShawn O. Pearce2008-10-291-0/+2
| | | | | | | | 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>
* Remove the Python 2.4 dependency and use just 'python'v1.0.1Shawn O. Pearce2008-10-211-1/+1
| | | | | | | | | 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>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+198