summaryrefslogtreecommitdiffstats
path: root/error.py
Commit message (Collapse)AuthorAgeFilesLines
* error: fix typosAnthony King2015-06-041-2/+2
| | | | Change-Id: I09c47024ef54c360ea3c15c5d4f169e13444e412
* More verbose errors for NoManifestExceptions.Dan Sandler2014-03-111-0/+7
| | | | | | | | | | | | | | | | The old "manifest required for this command -- please run init" is replaced by a more helpful message that lists the command repo was trying to execute (with arguments) as well as the str() of the NoManifestException. For example: > error: in `sync`: [Errno 2] No such file or directory: > 'path/to/.repo/manifests/.git/HEAD' > error: manifest missing or unreadable -- please run init Other failure points in basic command parsing and dispatch are more clearly explained in the same fashion. Change-Id: I6212e5c648bc5d57e27145d55a5391ca565e4149
* Raise a NoManifestException when the manifest DNEConley Owens2012-11-151-0/+4
| | | | | | | | | When a command (eg, `repo forall`) expects the manifest project to exist, but there is no manifest, an IOException gets raised. This change defines a new Exception type to be raised in these cases and raises it when project.py fails to read the manifest. Change-Id: Iac576c293a37f7d8f60cd4f6aa95b2c97f9e7957
* More coding style cleanupDavid Pursehouse2012-10-221-1/+7
| | | | | | | | | | | | | | | | 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
* Coding style cleanupDavid Pursehouse2012-10-091-2/+2
| | | | | | | | | | | | | | | 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 `ImportError` classDavid Pursehouse2012-10-041-9/+0
| | | | | | | | | The definition of `ImportError` redefines the Python built-in class of the same name. It is not used anywhere, so remove it. Change-Id: I557ce28c93a3306fff72873dc6f477330fc33128
* Add manifest groupsv1.8.2Colin Cross2012-04-131-0/+12
| | | | | | | | | | | | | | | | | Allows specifying a list of groups with a -g argument to repo init. The groups act on a group= attribute specified on projects in the manifest. All projects are implicitly labelled with "default" unless they are explicitly labelled "-default". Prefixing a group with "-" removes matching projects from the list of projects to sync. If any non-inverted manifest groups are specified, the default label is ignored. Change-Id: I3a0dd7a93a8a1756205de1d03eee8c00906af0e5 Reviewed-on: https://gerrit-review.googlesource.com/34570 Reviewed-by: Shawn Pearce <sop@google.com> Tested-by: Shawn Pearce <sop@google.com>
* sync: Support downloading bundle to initialize repositoryv1.7.7Shawn O. Pearce2011-09-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Support repo-level pre-upload hook and prep for future hooks.v1.7.4Doug Anderson2011-03-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All repo-level hooks are expected to live in a single project at the top level of that project. The name of the hooks project is provided in the manifest.xml. The manifest also lists which hooks are enabled to make it obvious if a file somehow failed to sync down (or got deleted). Before running any hook, we will prompt the user to make sure that it is OK. A user can deny running the hook, allow once, or allow "forever" (until hooks change). This tries to keep with the git spirit of not automatically running anything on the user's computer that got synced down. Note that individual repo commands can add always options to avoid these prompts as they see fit (see below for the 'upload' options). When hooks are run, they are loaded into the current interpreter (the one running repo) and their main() function is run. This mechanism is used (instead of using subprocess) to make it easier to expand to a richer hook interface in the future. During loading, the interpreter's sys.path is updated to contain the directory containing the hooks so that hooks can be split into multiple files. The upload command has two options that control hook behavior: - no-verify=False, verify=False (DEFAULT): If stdout is a tty, can prompt about running upload hooks if needed. If user denies running hooks, the upload is cancelled. If stdout is not a tty and we would need to prompt about upload hooks, upload is cancelled. - no-verify=False, verify=True: Always run upload hooks with no prompt. - no-verify=True, verify=False: Never run upload hooks, but upload anyway (AKA bypass hooks). - no-verify=True, verify=True: Invalid Sample bit of manifest.xml code for enabling hooks (assumes you have a project named 'hooks' where hooks are stored): <repo-hooks in-project="hooks" enabled-list="pre-upload" /> Sample main() function in pre-upload.py in hooks directory: def main(project_list, **kwargs): print ('These projects will be uploaded: %s' % ', '.join(project_list)) print ('I am being a good boy and ignoring anything in kwargs\n' 'that I don\'t understand.') print 'I fail 50% of the time. How flaky.' if random.random() <= .5: raise Exception('Pre-upload hook failed. Have a nice day.') Change-Id: I5cefa2cd5865c72589263cf8e2f152a43c122f70
* Document any crashes from the user's text editorv1.6.8.4Shawn O. Pearce2009-06-241-0/+5
| | | | | | | | Rather than failing with no information, display the child exit status and the command line we tried to use to edit a text file. There may be some useful information to help understand the crash. 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-0/+2
| | | | | | | | | | | | | | | | | | | | 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>
* Initial Contributionv1.0The Android Open Source Project2008-10-211-0/+66