summaryrefslogtreecommitdiffstats
path: root/project.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Check for existence of refs upon initial fetchConley Owens2014-02-121-0/+6
| | | | | | | | | | | | | | | When we do an initial fetch and have not specified any branch etc, the following fetch command will not error: git fetch origin --tags +refs/heads/*:refs/remotes/origin/* In this change we make sure something got fetched and if not we report an error. This fixes the bug that occurs when we init using a bad manifest url and then are unable to init again (because a manifest project has been inited with no manifest). Change-Id: I6f8aaefc83a1837beb10b1ac90bea96dc8e61156
* Merge "Only fetch current branch on shallow clients"v1.12.8Conley Owens2014-01-291-4/+7
|\
| * Only fetch current branch on shallow clientsShawn Pearce2014-01-291-4/+7
| | | | | | | | | | | | | | | | Fetching a new branch on a shallow client may download the entire project history, as the depth parameter is not passed to git fetch. Force the fetch to only download the current branch. Change-Id: Ie17ce8eb5e3487c24d90b2cae8227319dea482c8
* | Merge "repo: Support multiple branches for the same project."Conley Owens2014-01-101-36/+82
|\ \
| * | repo: Support multiple branches for the same project.David James2013-10-141-36/+82
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is often useful to be able to include the same project more than once, but with different branches and placed in different paths in the workspace. Add this feature. This CL adds the concept of an object directory. The object directory stores objects that can be shared amongst several working trees. For newly synced repositories, we set up the git repo now to share its objects with an object repo. Each worktree for a given repo shares objects, but has an independent set of references and branches. This ensures that repo only has to update the objects once; however the references for each worktree are updated separately. Storing the references separately is needed to ensure that commits to a branch on one worktree will not change the HEAD commits of the others. One nice side effect of sharing objects between different worktrees is that you can easily cherry-pick changes between the two worktrees without needing to fetch them. Bug: Issue 141 Change-Id: I5e2f4e1a7abb56f9d3f310fa6fd0c17019330ecd
* | Merge "Canonicalize project hooks path before use"Conley Owens2014-01-091-2/+2
|\ \
| * | Canonicalize project hooks path before useJesse Hall2013-12-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the top-level .repo directory is moved somewhere else (e.g. a different drive) and replaced with a symlink, _InitHooks() will create broken symlinks. Resolving symlinks before computing the relative path for the symlink keeps the path within the repo tree, so the tree can be moved anywhere. Change-Id: Ifa5c07869e3477186ddd2c255c6c607f547bc1fe
* | | Add --archive option to init to sync using git archiveJulien Campergue2013-12-101-1/+62
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Fix print of git-remote-persistent-https errorConley Owens2013-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | If git-remote-persistent-https fails, we use an iter() and then subsequently a .read() on stderr. Python doesn't like this and gives the following error message: ValueError: Mixing iteration and read methods would lose data This change removes the use of iter() to avoid the issue. Change-Id: I980659b83229e2a559c20dcc7b116f8d2476abd5
* | Fix some python3 encoding issuesChirayu Desai2013-11-211-1/+1
|/ | | | | | * Add .decode('utf-8') where needed * Add 'b' to `open` where needed, and remove where unnecessary Change-Id: I0f03ecf9ed1a78e3b2f15f9469deb9aaab698657
* Accept all UTF-8 committer namesConley Owens2013-09-271-1/+1
| | | | Change-Id: I7d9d49a8bacf2dc332614d26cdfcc905be7a5290
* Wait for git-remote-persistent-https -print_config to exitDave Borowitz2013-09-251-1/+6
| | | | Change-Id: I5ab96e7c8575682217d440ddc52ecfdc8c35f179
* DownloadPatchSet: fetch the change only, and nothing else.Chirayu Desai2013-06-131-1/+0
| | | | | | | | | | | | * Previously, it would run `git fetch <remote.name> <change refspec> <remote.fetch>, which would fetch all the branches, even if 'sync-c' was set to true in the manifest. * Fix that, since all it needs to fetch is the change that was asked for, and nothing else. * For some more info, refer to the discussion on: I42a9d419b51f5da03f20a640ea68993cda4b6500 Change-Id: Ibc801695d56fc16e56f999e0f61393f54461785f
* Read cookie file from git-remote-persistent-https if applicableDave Borowitz2013-06-041-4/+29
| | | | | | | | | | | | | | git-remote-persistent-https proxy implementations may pass cookie file configuration to git-remote-https. When fetching bundles for persistent-http(s) URLs, use the -print_config flag (if supported) to extract this information from the proxy binary and pass it to curl, overriding http.cookiefile from .gitconfig. This adds a few ms overhead per clone.bundle fetch, which should be acceptable since it happens only on the initial clone, which takes much longer anyway. Change-Id: I03be8ebaf8d3005855d33998cd8ecd412e8ec287
* Ensure clone.bundle files have proper headerDave Borowitz2013-06-041-1/+12
| | | | | | | | | Server auth middleware may return a 200 from a clone.bundle request that is not a bundle file, but instead a login or access denied page. Instead of just checking the file size, actually check the first few bytes of the file to ensure it is a bundle file before proceeding. Change-Id: Icea07567c568a24fd838e5cf974c58f9e4abd7c0
* Send reviews to a different branch from fetchBryan Jacobs2013-05-241-5/+13
| | | | | | | | This adds the ability to have reviews pushed to a different branch from the one on which changes are based. This is useful for "gateway" systems without smartsync. Change-Id: I3a8a0fabcaf6055e62d3fb55f89c944e2f81569f
* Move Python version checking to a separate moduleDavid Pursehouse2013-05-231-3/+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-4/+5
| | | | | | | | | | | | | | | | | 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>
* Merge "Re-initialise repos git hooks when updating the forest"David Pursehouse2013-05-091-5/+12
|\
| * Re-initialise repos git hooks when updating the forestJimmie Wester2013-03-081-5/+12
| | | | | | | | | | | | | | | | | | | | | | Repo now re-initialises the git-hooks reference directory when updating the forest. This allows for any new template files to be made available throughout the project forest when updating the forest. Previous functionality required the user to recreate the forest. Change-Id: I9051265028a9e77d6139791547fff095bc195077 Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
* | Repo should not fetch tags for shallow projectsJimmie Wester2013-05-081-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Fetching all tags for a shallow git results in an inconstent git and forces git to fetch more than the depth specified. This change teaches repo not to fetch any tags in a repository initialised with the depth option. Change-Id: I557ead9f88fa0d6a19b1cb55b23bba1100fcb8f2 Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
* | Some fixes for supporting python3Chirayu Desai2013-04-181-21/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix imports. * Use python3 syntax. * Wrap map() calls with list(). * Use list() only wherever needed. (Thanks Conley!) * Fix dictionary iteration methods (s/iteritems/items/). * Make use of sorted() in appropriate places * Use iterators directly in the loop. * Don't use .keys() wherever it isn't needed. * Use sys.maxsize instead of sys.maxint TODO: * Make repo work fully with python3. :) Some of this was done by the '2to3' tool [1], by applying the needed fixes in a way that doesn't break compatibility with python2. Links: [1]: http://docs.python.org/2/library/2to3.html Change-Id: Ibdf3bf9a530d716db905733cb9bfef83a48820f7 Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
* | Allow clone depth to be specified per projectDavid Pursehouse2013-04-101-2/+7
| | | | | | | | | | | | | | | | | | | | | | If the clone-depth attribute is set on a project, its value will be used to set the depth when fetching the git. The value, if given, must be a positive integer. The value in the clone-depth attribute overrides any value given to repo init via the --depth command line option. Change-Id: I273015b3724213600b63e40cca4cafaa9f782ddf
* | Special handling for manifest group "default"David Holmer2013-04-031-1/+6
|/ | | | | | | | | | | | | | | | | | | | | 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
* upload: support --re and --cc options over HTTPv1.12.2Shawn Pearce2013-02-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | HTTP can't use the older style of passing options as part of the git receive-pack command line. Use the new style as defined by https://gerrit-review.googlesource.com/42652 when connecting over HTTP. If the Gerrit server is too old to understand the % option syntax used here one of two outcomes is possible: - If no topic name was sent the server will fail with an error message. This happens because the user tried to do an upload to "refs/for/master%r=alice", and the branch does not exist. The user can delete the options and retry the upload. - If a topic was set the options will be read as part of the topic string and shown on the change page in the topic field. Either outcome is slightly better than the current behavior of just dropping the data on the floor and forgetting whatever the user tried to supply. Change-Id: Ib2df62679e5bf3ee93d6b18c12ab6474f96d9106
* Add --no-tags option to prevent fetching of tagsMitchel Humpherys2013-02-271-4/+10
| | | | | | | Add an option to pass `--no-tags' to `git fetch'. Change-Id: I4158cc369773e08e55a167091c38ca304a197587 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* Check for a cookie file when fetching clone.bundle.Torne (Richard Coles)2013-01-111-0/+3
| | | | | | | | If the user's git config specifies a cookie file for HTTP, use it when fetching clone.bundle, as it may contain the required login credentials to get access (e.g. when used with Compute Engine service accounts). Change-Id: I12ee9e38694822ef1de4ed62138c3876c43f431b
* Represent git-submodule as nested projects, take 2Che-Liang Chiou2012-11-191-1/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Previous submission of this change broke Android buildbot due to incorrect regular expression for parsing git-config output. During investigation, we also found that Android, which pulls Chromium, has a workaround for Chromium's submodules; its manifest includes Chromium's submodules. This new change, in addition to fixing the regex, also take this type of workarounds into consideration; it adds a new attribute that makes repo not fetch submodules unless submodules have a project element defined in the manifest, or this attribute is overridden by a parent project element or by the default element.) We need a representation of git-submodule in repo; otherwise repo will not sync submodules, and leave workspace in a broken state. Of course this will not be a problem if all projects are owned by the owner of the manifest file, who may simply choose not to use git-submodule in all projects. However, this is not possible in practice because manifest file owner is unlikely to own all upstream projects. As git submodules are simply git repositories, it is natural to treat them as plain repo projects that live inside a repo project. That is, we could use recursively declared projects to denote the is-submodule relation of git repositories. The behavior of repo remains the same to projects that do not have a sub-project within. As for parent projects, repo fetches them and their sub-projects as normal projects, and then checks out subprojects at the commit specified in parent's commit object. The sub-project is fetched at a path relative to parent project's working directory; so the path specified in manifest file should match that of .gitmodules file. If a submodule is not registered in repo manifest, repo will derive its properties from itself and its parent project, which might not always be correct. In such cases, the subproject is called a derived subproject. To a user, a sub-project is merely a git-submodule; so all tips of working with a git-submodule apply here, too. For example, you should not run `repo sync` in a parent repository if its submodule is dirty. Change-Id: I4b8344c1b9ccad2f58ad304573133e5d52e1faef
* Raise a NoManifestException when the manifest DNEConley Owens2012-11-151-1/+5
| | | | | | | | | 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
* 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
* Fix inconsistent indentationDavid Pursehouse2012-11-141-16/+16
| | | | | | | | | | The repo coding style is to indent at 2 characters, but there are many places where this is not followed. Enable pylint warning "W0311: Bad indentation" and make sure all indentation is at multiples of 2 characters. Change-Id: I68f0f64470789ce2429ab11104d15d380a63e6a8
* Fix: "Statement seems to have no effect"David Pursehouse2012-11-141-1/+1
| | | | | | | | | | | | Pylint raises an error on the call: print Change it to: print() Change-Id: I507e1b3dd928fa6c32ea7e86260fb3d7b1428e6f
* Change print statements to work in python3Sarah Owens2012-11-131-6/+8
| | | | | | This is part of a series of changes to introduce Python3 support. Change-Id: I373be5de7141aa127d7debdbce1df39148dbec32
* Fix pylint warning W0108: Lambda may not be necessaryDavid Pursehouse2012-11-071-1/+1
| | | | | | Remove unnecessary usage of lambda. Change-Id: I06d41933057d60d15d307ee800cca052a44754c6
* project: Require git >= 1.7.2 for setting config on command lineDave Borowitz2012-10-311-1/+4
| | | | | | | | | | | | | | This option causes the git call to fail, which probably indicates a programming error; callers should check the git version and change the call appropriately if -c is not available. Failing loudly is preferable to failing silently in the general case. For an example of correctly checking at the call site, see I8fd313dd. If callers prefer to fail silently, they may set GIT_CONFIG_PARAMETERS in the environment rather than using the config kwarg to pass configuration. Change-Id: I0de18153d44d3225cd3031e6ead54461430ed334
* Even more coding style cleanupDavid Pursehouse2012-10-301-8/+7
| | | | | | | | | | | 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
* Revert "Represent git-submodule as nested projects"v1.11.1Shawn O. Pearce2012-10-261-178/+1
| | | | | | | | | | | This reverts commit 69998b0c6ff724bf620480140ccce648fec7d6a9. Broke Android's non-gitmodule use case. Conflicts: project.py subcmds/sync.py Change-Id: I68ceeb63d8ee3b939f85a64736bdc81dfa352aed
* Merge "project: Support config args in git command callables"Shawn Pearce2012-10-251-3/+14
|\
| * project: Support config args in git command callablesDave Borowitz2012-10-241-3/+14
| | | | | | | | Change-Id: I9d4d0d2b1aeebe41a6b24a339a154d258af665eb
* | Fix pylint warnings introduced by the submodule patchChe-Liang Chiou2012-10-251-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | "69998b0 Represent git-submodule as nested projects" has introduced a few pylint warnings. W0612:1439,8:Project._GetSubmodules.get_submodules: Unused variable 'sub_gitdir' W0613:1424,36:Project._GetSubmodules.get_submodules: Unused argument 'path' W0612:1450,25:Project._GetSubmodules.parse_gitmodules: Unused variable 'e' W0622:516,8:Sync.Execute: Redefining built-in 'all' Change-Id: I84378e2832ed1b5ab023e394d53b22dcea799ba4
* | Merge "Use modern Python exception syntax"Conley Owens2012-10-251-5/+5
|\ \
| * | 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
* / Represent git-submodule as nested projectsChe-Liang Chiou2012-10-231-1/+179
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a representation of git-submodule in repo; otherwise repo will not sync submodules, and leave workspace in a broken state. Of course this will not be a problem if all projects are owned by the owner of the manifest file, who may simply choose not to use git-submodule in all projects. However, this is not possible in practice because manifest file owner is unlikely to own all upstream projects. As git submodules are simply git repositories, it is natural to treat them as plain repo projects that live inside a repo project. That is, we could use recursively declared projects to denote the is-submodule relation of git repositories. The behavior of repo remains the same to projects that do not have a sub-project within. As for parent projects, repo fetches them and their sub-projects as normal projects, and then checks out subprojects at the commit specified in parent's commit object. The sub-project is fetched at a path relative to parent project's working directory; so the path specified in manifest file should match that of .gitmodules file. If a submodule is not registered in repo manifest, repo will derive its properties from itself and its parent project, which might not always be correct. In such cases, the subproject is called a derived subproject. To a user, a sub-project is merely a git-submodule; so all tips of working with a git-submodule apply here, too. For example, you should not run `repo sync` in a parent repository if its submodule is dirty. Change-Id: I541e9e2ac1a70304272dbe09724572aa1004eb5c
* More coding style cleanupDavid Pursehouse2012-10-221-8/+16
| | | | | | | | | | | | | | | | 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
* Rename "dir" variablesMickaël Salaün2012-10-101-3/+3
| | | | | | | 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-61/+58
| | | | | | | | | | | | | | | 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
* manifest: record the original revision when in -r mode.Brian Harring2012-09-281-10/+35
| | | | | | | | | | | | | | | | | Currently when doing a sync against a revision locked manifest, sync has no option but to fall back to sync'ing the entire refs space; it doesn't know which ref to ask for that contains the sha1 it wants. This sucks if we're in -c mode; thus when we generate a revision locked manifest, record the originating branch- and try syncing that branch first. If the sha1 is found within that branch, this saves us having to pull down the rest of the repo- a potentially heavy saving. If that branch doesn't have the desired sha1, we fallback to sync'ing everything. Change-Id: I99a5e44fa1d792dfcada76956a2363187df94cf1
* Fix errors when clone.bundle missing on serverMatt Gumbel2012-09-061-3/+13
| | | | | | | | | | | | | Catch curl failures to download clone.bundle; don't let git try to parse the 404 page as a bundle file (was causing much user confusion). This should eliminate false error messages from init and sync such as: error: '.repo/manifests.git/clone.bundle' does not look like a v2 bundle file fatal: Could not read bundle '.repo/manifests.git/clone.bundle'. error: RPC failed; result=22, HTTP code = 400 Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com> Change-Id: I7994f7c0baecfb45bb5a5850c48bd2a0ffabe773
* Allow projects to be specified as notdefaultConley Owens2012-09-051-7/+8
| | | | | | | | | | | | 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
* Remove unused importsDavid Pursehouse2012-08-231-3/+1
| | | | | | There are several imports that are not used. Remove them. Change-Id: I2ac3be66827bd68d3faedcef7d6bbf30ea01d3f2