summaryrefslogtreecommitdiffstats
path: root/subcmds/init.py
Commit message (Collapse)AuthorAgeFilesLines
* init: Add --no-clone-bundle optionHu xiuyun2016-08-151-1/+10
| | | | | Bug: Issue 218 Change-Id: I42ba1f5fb9168875da0df6bdf4fe44c8d6498d54
* init: Respect --quiet option when synching manifest repositoryDavid Pursehouse2016-08-151-1/+1
| | | | Change-Id: Ib58b7dd971670e0888e6428333050700e776b0de
* A couple of fixes to the init command's -p option.Pascal Muetschard2015-10-221-2/+2
| | | | | | | | | Adds windows as one of the allowed platforms flags. Fixes -p foo to append 'platform-foo', instead of each letter (list.extend expects a list and thus appends each char in the string, rather than the string itself). Change-Id: I73a92127ac29a32fc31b335cc54a246302904140
* init: don't call urllib.parseAnthony King2015-06-041-2/+2
| | | | | | it's actually urllib.parse.urlparse Change-Id: Ie3532e54625e887c8682d92b932ea21a629e8d60
* Revert "Implementation of manifest defined githooks"v1.12.20Jonathan Nieder2015-03-171-48/+1
| | | | | | | | | | | | | | | This reverts commit 38e4387f8eb8cffd6359d726c38a7c524fef07e3. A "repo init" followed by "repo sync" is meant to be as safe as "git clone". In particular it should not run arbitrary code provided by the manifest owner. It would still be nice to have support for manifest-defined git hooks --- they'd just need a prompt like the upload RepoHook has. Hopefully a later change can bring them back. Change-Id: I5ecd90fb5c2ed64f103d856d1ffcba38a47b062d Signed-off-by: Jonathan Nieder <jrn@google.com>
* Implementation of manifest defined githooksJimmie Wester2015-02-031-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When working within a team or corporation it is often useful/required to use predefined git templates. This change teaches repo to use a per-remote git hook template structure. The implementation is done as a continuation of the existing projecthook functionality. The terminology is therefore defined as projecthooks. The downloaded projecthooks are stored in the .repo directory as a metaproject separating them from the users project forest. The projecthooks are downloaded and set up when doing a repo init and updated for each new repo init. When downloading a mirror the projecthooks gits are not added to the bare forest since the intention is to ensure that the latest are used (allows for company policy enforcement). The projecthooks are defined in the manifest file in the remote element as a subnode, the name refers to the project name on the server referred to in the remote. <remote name="myremote ..> <projecthook name="myprojecthookgit" revision="myrevision"/> </remote> The hooks found in the projecthook revision supersede the stock hooks found in repo. This removes the need for updating the projecthook gits for repo stock hook changes. Change-Id: I6796b7b0342c1f83c35f4b3e46782581b069a561 Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com> Signed-off-by: Ian Kumlien <ian.kumlien@gmail.com>
* pylint fixes for project.pyAnthony King2015-01-221-1/+1
| | | | | | Fix all the formatting warnings and unused variables Change-Id: I17d88a23572303879530077f3a80451de5417fbb
* Add --archive option to init to sync using git archiveJulien Campergue2013-12-101-0/+21
| | | | | | | | | | | | | | | This significantly reduces sync time and used brandwidth as only a tar of each project's revision is checked out, but git is not accessible from projects anymore. This is relevant when git is not needed in projects but sync speed/brandwidth may be important like on CI servers when building several versions from scratch regularly for example. Archive is not supported over http/https. Change-Id: I48c3c7de2cd5a1faec33e295fcdafbc7807d0e4d Signed-off-by: Julien Campergue <julien.campergue@parrot.com>
* Move Python version checking to a separate moduleDavid Pursehouse2013-05-231-4/+4
| | | | | | | | | | | | | | | | | Add a new module with methods for checking the Python version. Instead of handling Python3 imports with try...except blocks, first check the python version and then import the relevant modules. This makes the code a bit cleaner and will result in less diff when/if we remove support for Python < 3 later. Use the same mechanism to handle `input` vs. `raw_input` and add suppression of pylint warnings caused by redefinition of the built-in method `input`. Change-Id: Ia403e525b88d77640a741ac50382146e7d635924 Also-by: Chirayu Desai <cdesai@cyanogenmod.org> Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* Use reference also for manifest gitVictor Boivie2013-05-121-1/+22
| | | | | | | | | | | | | | | | | When running 'repo init --reference=<mirror>', the mirror will be used for all projects except the manifest project. This is because the _InitGitDir function uses the 'repo.reference' git config value specified in the manifest git, which has no effect when creating the manifest git as that value will be set after the git has been successfully cloned. Information about where the manifest git is located on the server is only known when performing the 'repo init', so that information has to be provided when cloning the git in order for it to set up a proper mapping. Change-Id: I47a2c8b3267a4065965058718ce1def4ecb34d5a Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* Special handling for manifest group "default"David Holmer2013-04-031-3/+4
| | | | | | | | | | | | | | | | | | | | | Change Details: * Make "default" a special manifest group that matches any project that does not have the special project group "notdefault" * Use "default" instead of "all,-notdefault" when user does not specify manifest group * Expand -g option help to include example usage of manifest groups Change Benefits: * Allow a more intuitive and expressive manifest groups specification: * "default" instead of "all,-notdefault" * "default,foo" instead of "all,-notdefault,foo" * "default,-foo" instead of "all,-notdefault,-foo" * "foo,-default" which has no equivalent * Default manifest groups behavior can be restored by the command 'repo init -g default'. This is significantly more intuitive than the current equivalent command 'repo init -g all,-notdefault'. Change-Id: I6d0673791d64a650110a917c248bcebb23b279d3
* Fix: missing space in information message after repo initDavid Pursehouse2013-01-291-1/+1
| | | | | | | | | | | In the information message displayed after running repo init, there is a missing space: If this is not the directory in which you want to initializerepo Add a space. Change-Id: I20467673ba7481cfe782ba58ff6ed2f7ce9824a5
* Better error message when using --mirror in existing workspaceDavid Pursehouse2013-01-291-2/+4
| | | | | | | | | | | | | | | If repo init is run with the --mirror option, repo checks if there is already a workspace initialized in the current location, and if so, exits with an error message: --mirror not supported on existing client This error can cause confusion; the users do not understand what is wrong and what they need to do to fix it. Change the error message to make it a bit clearer. Change-Id: Ifd06ef64fd264bd1117e4184c49afe0345b75d8c
* Allow init command to set options from environment variablesDavid Pursehouse2012-11-171-0/+4
| | | | | | | | The manifest URL and mirror location can be specified in environment variables which will be used if the options are not passed on the command line Change-Id: Ida87968b4a91189822c3738f835e2631e10b847e
* Tidy up code formatting a bit moreDavid Pursehouse2012-11-141-2/+2
| | | | | | | | | | | | Enable the following Pylint warnings: C0322: Operator not preceded by a space C0323: Operator not followed by a space C0324: Comma not followed by a space And make the necessary fixes. Change-Id: I74d74283ad5138cbaf28d492b18614eb355ff9fe
* Change print statements to work in python3Sarah Owens2012-11-131-24/+28
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Convert prompt answers to lower case before checkingDavid Pursehouse2012-11-141-1/+1
| | | | | | | | When prompting for yes/no answers, convert the answer to lower case before comparing. This makes it easier to catch answers like "Yes", "yes", and "YES" with a comparison only for "yes". Change-Id: I06da8281cec81a7438ebb46ddaf3344d12abe1eb
* Even more coding style cleanupDavid Pursehouse2012-10-301-1/+1
| | | | | | | | | | | 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
* Show user about not initializing repo in current directoryYang Zhenhui2012-10-261-7/+16
| | | | | | | | | | | | | If the parent of current directory has an initialized repo, for example, if the current directory is '/home/users/harry/platform/ics', and there is an initialized repo in harry's home directory '/home/users/harry/.repo', when user run 'repo init' command, repo is always initialized to parent directory in '/home/users/harry/.repo', but most of time user intends to initialize repo in the current directory, this patch tells user how to do it. Change-Id: Id7a76fb18ec0af243432c29605140d60f3de85ca
* Use modern Python exception syntaxSarah Owens2012-10-231-1/+1
| | | | | | | | | | | "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
* Merge "Coding style cleanup"Conley Owens2012-10-091-5/+3
|\
| * Coding style cleanupDavid Pursehouse2012-10-091-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Expand ~ to user's home directory for --referenceVictor Boivie2012-10-081-0/+4
|/ | | | | | | This allows a user to have a 'repo init' as: $ repo init -u ... --reference=~/mirror Change-Id: Ib85b7c8ffca9d732132c68fe9a8d7f0ab1fa9288
* Allow projects to be specified as notdefaultConley Owens2012-09-051-3/+3
| | | | | | | | | | | | Instead of every group being in the group "default", every project is now in the group "all". A group that should not be downloaded by default may be added to the group "notdefault". This allows all group names to be positive (instead of removing groups directly in the manifest with -default) and offers a clear way of selecting every project (--groups all). Change-Id: I99cd70309adb1f8460db3bbc6eff46bdcd22256f
* init: Improved help text for the --mirror optionDavid Pursehouse2012-08-231-1/+2
| | | | Change-Id: Ia6032865f9296b29524c2c25b72bd8e175b30489
* Fix switching manifest branches using repo init -bFlorian Vallee2012-06-131-0/+3
| | | | | | | | | | | | | | | | See repo issue #46 : https://code.google.com/p/git-repo/issues/detail?id=46 When using repo init -b on an already existing repository, the next sync will try to rebase changes coming from the old manifest branch onto the new, leading in the best case scenario to conflicts and in the worst case scenario to an incorrect "mixed up" manifest. This patch fixes this by deleting the "default" branch in the local manifest repository when the -d init switch is used, thus forcing repo to perform a fresh checkout of the new manifest branch Change-Id: I379e4875ec5357d8614d1197b6afbe58f9606751
* Fix syntax errors in subcmds/init.pyColin Cross2012-04-231-3/+2
| | | | | | | | | Fixes three errors: Python doesn't like the line wrap after 'and'. platform.system is a function, needs to be platform.system(). Typo all_platfroms instead of all_platforms. Change-Id: Ia875e521bc01ae2eb321ec62d839173c00f86c2d
* Add a --platform flagConley Owens2012-04-231-1/+22
| | | | | | | | | | Projects may optionally specify their platform (eg, groups="platform-linux" in the manifest). By default, repo will automatically detect the platform. However, users may specify --platform=[auto|all|linux|darwin]. Change-Id: Ie678851fb2fec5b0938aede01f16c53138a16537
* Refine groups functionalityConley Owens2012-04-231-2/+8
| | | | | | | | | | | | | | | Every project is in group "default". "-default" does not remove it from this project. All group names specified in the manifest are positive names as opposed to a mix of negative and positive. Specified groups are resolved in order. If init is supplied with --groups="group1,-group2", the following describes the project selection when syncing: * all projects in "group1" will be added, and * all projects in "group2" will be removed. Change-Id: I1df3dcdb64bbd4cd80d675f9b2d3becbf721f661
* Add manifest groupsv1.8.2Colin Cross2012-04-131-0/+6
| | | | | | | | | | | | | | | | | 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>
* Revert "Default repo manifest settings in git config"v1.7.8.1Shawn O. Pearce2011-11-301-36/+3
| | | | | | | This reverts commit ee1c2f5717fcc137ab887a4aae8a08d50a539b9a. This breaks a lot of buildbot systems. Rolling it back for now until we can understand what the breakage was and how to fix it.
* Don't prompt the user for name/email unless necessaryVictor Boivie2011-11-291-1/+26
| | | | | | | | | | | | If the user has already configured a workspace, use these values when re-running 'repo init'. Otherwise, if the user has global name and e-mail set, use these. It's always possible to override this and be prompted by specifying --config-name when running 'repo init'. Change-Id: If45f0e4b14884071439fb02709dc5cb53f070f60
* Default repo manifest settings in git configVictor Boivie2011-11-291-3/+36
| | | | | | | | | | | | | | | | | | | | | | A default manifest URL can be specified using: git config --global repo-manifest.<id>.url <url> A default manifest server can be specified using: git config --global repo-manifest.<id>.server <url> A default git mirror reference can be specified using: git config --global repo-manifest.<id>.reference <path> This will allow the user to use 'repo init -u <id>' as a shorter alternative to specifying the full URL. Also, manifest server will not have to be specified in the manifest XML and the reference will not have to be specified on the command line. If they are, they will override these default values however. Change-Id: Ifdbc160bd5909ec7df9efb0c5d7136f1d9351754 Signed-off-by: Victor Boivie <victor.boivie@sonyericsson.com>
* repo: capitalize default prompt charMike Frysinger2011-11-291-2/+2
| | | | | | | | | It is common in command line tools to indicate what the default answer will be if the user simply hits enter. In repo, the display is just "y/n" with no indication as to which is the default. So change the n to N in the messages since that is how repo operates. Change-Id: I81819ae630355072eb0365e59168b0921289498f
* sync: Support downloading bundle to initialize repositoryv1.7.7Shawn O. Pearce2011-09-281-3/+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>
* Add a --depth option to repo init.v1.7.5Doug Anderson2011-06-091-0/+24
| | | | Change-Id: Id30fb4a85f4f8a1847420b0b51a86060041eb5bf
* Fixed problems w/ 2nd repo init if first repo init had bad URL.Doug Anderson2011-04-071-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the simplest fix: if we had problems syncing the manifest.git directory and we were the ones that created it, we should delete it. This doesn't try to do anything complex like try to recover from a .repo directory that got broken in some other way. This is filed as: <http://crosbug.com/13403> TEST=manual Init once with a bad URL: $ repo init -u http://foobar.example.com Getting manifest ... from http://foobar.example.com Connection closed by 172.22.121.77 error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs fatal: HTTP request failed fatal: cannot obtain manifest http://foobar.example.com Init again: identical to the first. Good: $ repo init -u http://foobar.example.com Getting manifest ... from http://foobar.example.com Connection closed by 172.22.121.77 error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs fatal: HTTP request failed fatal: cannot obtain manifest http://foobar.example.com Init with correct URL: $ repo init -u http://git.chromium.org/git/manifest -m minilayout.xml Getting manifest ... from http://git.chromium.org/git/manifest [ ... cut ... ] repo initialized in /.../repoiniterr Try a bad URL after a good one; it doesn't get saved (good): $ repo init -u http://foobar.example.com Connection closed by 172.22.121.77 error: Couldn't resolve host 'foobar.example.com' while accessing http://foobar.example.com/info/refs fatal: HTTP request failed fatal: cannot obtain manifest http://foobar.example.com Just to confirm, I can still do a good one after a bad... $ repo init -u http://git.chromium.org/git/manifest -m minilayout.xml Your Name [George Washington]: Your Email [george@washington.example.com]: Your identity is: George Washington <george@washington.example.com> is this correct [y/n]? y repo initialized in /.../repoiniterr Change-Id: I1692821a330d97b1d218b2e191a93245b33f2362
* sync: Enable use of git clone --referenceShawn O. Pearce2010-10-291-1/+13
| | | | | | | | | 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>
* Allow 'y' as a valid response when confirming identityv1.6.9.1Nico Sallembien2010-04-011-2/+3
| | | | | I prefer having to type only one character rather than all three, and it seems like other confirmation prompts use the same style.
* Try to prevent 'repo sync' as a user namev1.6.8.6Shawn O. Pearce2009-07-021-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | When someone copies and pastes a setup line from a web page, they might actually copy 'repo sync' onto the clipboard and wind up pasting it into the "Your Name" prompt. This means they will initialize their client with the user name of "repo sync", creating some rather funny looking commits later on. For example: To setup your source tree: mkdir ~/code cd ~/code repo init -u git://.... repo sync If this entire block was just blindly copy and pasted into the terminal, the shell won't read "repo sync" but "repo init" will. By showing the user their full identity string, and asking them to confirm it before we continue, we can give the hapless user a chance to recover from this mistake, without unfairly harming those who were actually named 'repo' by their parents. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Refactor git version detection for reuseShawn O. Pearce2009-06-121-15/+2
| | | | | | | | This way we can use it to detect feature support in the underlying git, such as new options or commands that have been added in more recent versions. Signed-off-by: Shawn O. Pearce <sop@google.com>
* Change project.revision to revisionExpr and revisionIdShawn O. Pearce2009-05-291-3/+3
| | | | | | | | | 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>
* Refactor how projects parse remotes so it can be replacedShawn O. Pearce2009-05-291-1/+0
| | | | | | | | | 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>
* Improve the help text for 'repo init'Shawn O. Pearce2009-04-181-3/+14
| | | | Signed-off-by: Shawn O. Pearce <sop@google.com>
* Clarify options that control the repo executable versionShawn O. Pearce2009-04-181-1/+1
| | | | 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-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Make 'repo start' restartable upon failuresShawn O. Pearce2009-04-101-1/+3
| | | | | | | | | | | | | | | | | | | | 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>
* 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>