summaryrefslogtreecommitdiffstats
path: root/project.py
Commit message (Collapse)AuthorAgeFilesLines
...
* Use fetch --unshallow when appropriate.Conley Owens2014-05-091-4/+24
| | | | | | | | If a user reinits to a different manifest or the manifest updates so that a project no longer has a fixed depth, we need to use --unshallow when we fetch. Change-Id: I6d3f15e5464b5eaad9205654bc24354947a78aea
* Merge "Enable remotes to define their own revision"Conley Owens2014-05-081-2/+5
|\
| * Enable remotes to define their own revisionAnthony King2014-05-071-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | Some projects use multiple remotes. In some cases these remotes have different naming conventions. Add an option to define a revision in the remote configuration. The `project` revision takes precedence over `remote` and `default`. The `remote` revision takes precedence over `default`. The `default` revision acts as a fall back as it originally did. Change-Id: I2b376160d45d48b0bab840c02a3eef1a1e32cf6d
* | Merge "Use exec() rather than execfile()"Conley Owens2014-05-071-1/+2
|\ \
| * | Use exec() rather than execfile()Anthony King2014-05-051-1/+2
| |/ | | | | | | | | | | execfile() is not in Python 3. Change-Id: I5af222340f13c1e8edaa820e7675d3e4d62a1689
* / Use next(iterator) rather than iterator.next()Anthony King2014-05-071-3/+3
|/ | | | | | | | iterator.next() was replaced with iterator.__next__() in Python 3. Use next(iterator) instead which will select the correct method for returning the next item. Change-Id: I6d0c89c8b32e817e5897fe87332933dacf22027b
* Ensure HEAD is correct when skipping remote fetchv1.12.16Conley Owens2014-05-011-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent optimization (2fb6466f795eb30c1dfa598501f5b5d2981e6a5f) skips performing a remote fetch if we already know we have the sha1 we want. However, that optimization skipped initialization steps that ensure HEAD points to the correct sha1. This change makes sure not to skip those steps. Here is an example of how to test this change: """"""""" url=<manifest url> branch1=<branch name> branch2=<branch name> project=<project with revision set to different sha1 in each branch> repo init -u $url -b $branch1 --mirror repo sync $project first=$(cd $project.git; git rev-parse HEAD) repo init -b $branch2 repo sync $project second=$(cd platform/build.git; git rev-parse HEAD) if [[ $first == $second ]] then echo 'problem!' else echo 'no problem!' fi """""""""
* Add 'shallow' gitfile to symlinksv1.12.15Conley Owens2014-04-301-1/+1
| | | | | | | This fixes the bug that kept clients from doing things like `git log` in projects using the clone-depth feature. Change-Id: Ib4024a7b82ceaa7eb7b8935b007b3e8225e0aea8
* Merge "Ignore clone-depth attribute when fetching to a mirror"v1.12.14Conley Owens2014-04-241-4/+10
|\
| * Ignore clone-depth attribute when fetching to a mirrorDavid Pursehouse2014-04-161-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a manifest includes projects with a clone-depth=1 attribute, and a workspace is initialised from that manifest using the --mirror option, any workspaces initialised and synced from the mirror will fail with: fatal: attempt to fetch/clone from a shallow repository on the projects that had the clone-depth. Ignore the clone-depth attribute when fetching from the remote to a mirror workspace. Thus the mirror will be synched with a complete clone of all the repositories. Change-Id: I638b77e4894f5eda137d31fa6358eec53cf4654a
* | Add linkfile support.Jeff Hamilton2014-04-221-8/+41
|/ | | | | | | | | It's just like copyfile and runs at the same time as copyfile but instead of copying it creates a symlink instead. This is needed because copyfile copies the target of the link as opposed to the symlink itself. Change-Id: I7bff2aa23f0d80d9d51061045bd9c86a9b741ac5
* Make --no-tags work with -cMitchel Humpherys2014-03-121-7/+7
| | | | | | | | | Currently, the --no-tags option is ignored if the user asks to only fetch the current branch. There is no reason for this restriction. Fix it. Change-Id: Ibaaeae85ebe9955ed49325940461d630d794b990 Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
* Fix indentation in project.pyDavid Pursehouse2014-03-111-1/+1
| | | | Change-Id: I81c630536eaa54d5a25b9cb339a96c28619815ea
* More verbose errors for NoManifestExceptions.Dan Sandler2014-03-111-2/+2
| | | | | | | | | | | | | | | | 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
* Don't fetch from remotes if commit id exists locallyChris AtLee2014-03-031-12/+18
| | | | | | | | | In existing workspaces where the manifest specifies a commit id in the manifest, we can avoid doing a fetch from the remote if we have the commit locally. This substantially improves sync times for fully specified manifests. Change-Id: Ide216f28a545e00e0b493ce90ed0019513c61613
* Add the "diffmanifests" commandJulien Campergue2014-02-171-0/+54
| | | | | | | | | This command allows a deeper diff between two manifest projects. In addition to changed projects, it displays the logs of the commits between both revisions for each project. Change-Id: I86d30602cfbc654f8c84db2be5d8a30cb90f1398 Signed-off-by: Julien Campergue <julien.campergue@parrot.com>
* 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