summaryrefslogtreecommitdiffstats
path: root/repo
Commit message (Collapse)AuthorAgeFilesLines
* repo: bump launcher versionMike Frysinger2020-02-121-1/+1
| | | | | | | | | This way we can push out the updated stable branch change. Change-Id: I72d5dab4523a10dfeb6529796892096aa80eba3c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254492 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: allow REPO_REV to be an env varMike Frysinger2020-02-111-3/+5
| | | | | | | | | | | We do this for REPO_URL already. Bug: https://crbug.com/gerrit/10233 Change-Id: I53410645474b00d900467c96fa5d8446f3a607d3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253552 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com> (cherry picked from commit 563f1a651298eaa3616f92c3cd7b264fe5442379)
* repo: point default branch to repo-1Mike Frysinger2020-02-051-1/+1
| | | | | | | | | | | | Since this will be feature-frozen for Python 2 users, lets point the default update branch to "repo-1" rather than "stable" as the latter will follow the master development (and Python 3-only). Bug: https://crbug.com/gerrit/10418 Change-Id: Iceff0983684a580dc5c9ec1c60acfb5eda5ce2c4 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/253172 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: Do not even try to set up GPG with opt.no_repo_verifySebastian Schuberth2020-01-241-4/+7
| | | | | | | | | | | | | | In order to be able to use "--no-repo-verify" to work around an issue with gpg-agent and long socket paths (see e.g. [1]), this change avoids GPG being set up at all if that option is passed. [1] https://github.com/elastic/elasticsearch/issues/17053 Change-Id: I1e5cbd8be2dc0084f12afe0ca33c789fdbc6fef9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/251108 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* use open context managers in more placesMike Frysinger2019-11-121-3/+2
| | | | | | | | | | Use open() as a context manager to simplify the close logic and make the code easier to read & understand. This is also more Pythonic. Change-Id: I579d03cca86f99b2c6c6a1f557f6e5704e2515a7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244734 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: bump wrapper versionMike Frysinger2019-09-181-1/+1
| | | | | | | | | | We've rolled quite a number of fixes since the last update, including a lot of Python 3 improvements. Lets bump the wrapper version for it. Change-Id: I6c6c04c3c8241bf8e8bcf26603549ae4595fede8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/237812 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: decode/encode all the subprocess streamsMike Frysinger2019-09-121-5/+6
| | | | | | | | | | | | | We use subprocess a lot in the wrapper, but we don't always read or write the streams directly. When we do, make sure we convert to/from bytes before trying to use the content. Change-Id: I318bcc8e7427998348e359f60c3b49e151ffbdae Reported-by: Michael Scott <mike@foundries.io> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236612 Reviewed-by: Michael Scott <mike@foundries.io> Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Michael Scott <mike@foundries.io>
* repo: fix unused variable usageMike Frysinger2019-09-111-1/+1
| | | | | | | | | | | The refactoring here left behind a variable reference that no longer exists. Clean it up. Bug: https://crbug.com/gerrit/11144 Change-Id: Ifdb7918b37864c48f3deef27c8bae3f793275d35 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/236613 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* Add support for partial clone.v1.13.4Xin Li2019-07-161-0/+7
| | | | | | | | | | | | | A new option, --partial-clone is added to 'repo init' which tells repo to utilize git's partial clone functionality, which reduces disk and bandwidth usage when downloading by omitting blob downloads initially. Different from restricting clone-depth, the user will have full access to change history, etc., as the objects are downloaded on demand. Change-Id: I60326744875eac16521a007bd7d5481112a98749 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/229532 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Xin Li <delphij@google.com>
* repo/main: add module docstringsMike Frysinger2019-07-121-0/+7
| | | | | | | | | This should help people get some bearings in the codebase. Change-Id: I951238fe617a3ecb04a47ead3809ec72c8fbf5a1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231232 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* repo: all ParseGitVersion to load git version info itselfMike Frysinger2019-07-111-4/+15
| | | | | | | | | | | | | All code that calls ParseGitVersion needs to run `git --version` itself and parse the output before passing it in. To avoid that duplication, allow ParseGitVersion to run `git --version` itself if ver_str=None. Bug: https://crbug.com/gerrit/11144 Change-Id: Ie07793ca57a40c0231af808df04a576118d5eea3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231054 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: David Pursehouse <dpursehouse@collab.net>
* repo: return a namedtuple with full version infoMike Frysinger2019-07-111-2/+10
| | | | | | | | | | | | | | | We were returning an e.g. tuple(1,2,3), but that strips off the full version string which we might want in some places e.g. '1.2.3-rc3'. Change the return value to a namedtuple so we can pass back up the full version string. For code doing a compare with three elements (all code today), things still work fine as the namedtuple will DTRT in this scenario. Bug: https://crbug.com/gerrit/11144 Change-Id: Ib897b5df308116ad1550b0cf18f49afeb662423e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/231053 Reviewed-by: David Pursehouse <dpursehouse@collab.net> Tested-by: Mike Frysinger <vapier@google.com>
* handle binary stream from urllib.request.urlopenMike Frysinger2019-07-041-1/+1
| | | | | | | | Python 3 returns bytes by default with urlopen. Adjust our code to handle that scenario and decode as necessary. Bug: https://crbug.com/gerrit/10418 Change-Id: Icf4cd80e7ef92d71a3eefbc6113f1ba11c32eebc
* repo: drop Python 3 warningMike Frysinger2019-06-131-4/+0
| | | | | | | Lets get people to start filing bugs :). Bug: https://crbug.com/gerrit/10418 Change-Id: I1d55bf0c60dbdbd6537d30b2cf9ea91d2928e387
* repo: restore use of print_functionMike Frysinger2019-06-131-89/+80
| | | | | | | | | | | We avoided this future import because Python 2.4 & 2.5 did not support it. We've dropped support for Python 2.6 at this point, and those versions are long dead. Since this workaround adds a bit of complexity to the codebase, drop it. Considering we are not running any actual tests against older versions, there's no sense in trying to support them anymore. Change-Id: Icda874861e8a8eb4fa07c624a9e7c5ee2a0da401
* set default file encoding to utf-8Mike Frysinger2019-06-131-0/+1
| | | | | | | | There's no reason to support any other encoding in these files. This only affects the files themselves and not streams they open. Bug: https://crbug.com/gerrit/10418 Change-Id: I053cb40cd3666ce5c8a0689b9dd938f24ca765bf
* repo: standardize help behaviorMike Frysinger2019-06-131-2/+2
| | | | | | | | | | Standard utilities exit normally/zero when users explicitly request --help, and they write to stdout. Exiting non-zero & using stderr is meant for incorrect tool usage instead. We're already doing this for `repo help <init|gitc-init>` calls, so lets fix `repo help` and `repo --help|-h` to match. Change-Id: Ia4f352b431c91eefef70dcafc11f00209ee69809
* init: Remove -c short option for --current-branchv1.13.1Ereth McKnight-MacNeil2018-12-201-2/+2
| | | | | | | This option conflicts with the gitc-init -c short option. Bug: https://crbug.com/gerrit/10200 Change-Id: I06f37564429ca0bd4c0bbea6066daae4f663c838
* Leverage the next keyword from python 2.7Eli Ribble2018-12-191-5/+8
| | | | | | | This is literally what the next keyword is for. https://www.python.org/dev/peps/pep-3114/ Change-Id: I843755910b847737b077ff2361ba3e04409db0f0
* Allow clobbering of existing tags from remote.v1.13.0Xin Li2018-12-101-1/+1
| | | | | Bug: 120778183 Change-Id: Id44e2b68abc410a3afd4e07a3c943b0936347e38
* init: --dissociate option to copy objects borrowed with --referenceNikolai Merinov2018-10-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | "repo init --reference" has two purposes: to decrease bandwidth used at clone time, and to decrease disk usage afterward, by using the reference repositories as an alternate store of objects even after the clone. The downside is that it makes the borrowing repositories dependent on the reference repositories, so it is easy to end up with missing objects by mistake after a cleanup operation like "git gc". To prevent that, v2.3.0-rc0~30^2 (clone: --dissociate option to mark that reference is only temporary, 2014-10-14), "git clone" gained a --dissociate option that makes --reference reuse objects from the reference repository at clone time but copy them over instead of using the reference as an alternate. This is more straightforward to use than plain --reference, at the cost of higher disk usage. Introduce a --dissociate to "repo init" that brings the same benefits to repo. The option is simply passed on to "git clone". Change-Id: Ib50a549eb71e0a2b3e234aea57537923962a80d4
* Remove unused pylint suppressionsDavid Pursehouse2018-07-241-1/+1
| | | | | | | | | | | pylint is not used since bb5b1a0. The pyflakes cleanup mentioned in that commit has not been done, but given that this project is no longer being actively developed I don't think it's worth spending time doing it. Leaving the pylint suppressions causes confusion because it leads people to think that we are still using pylint. Change-Id: If7d9f280a0f408c780f15915ffdb80579ae21f69
* Merge "Flush stderr on Windows"Sebastian Schuberth2018-07-131-0/+4
|\
| * Flush stderr on WindowsSebastian Schuberth2018-07-131-0/+4
| | | | | | | | | | | | | | | | While on Linux stderr is unbuffered, it is buffered on Windows. Always flush stderr on Windows to ensure any error messages appear in the right order to ease diagnosing. Change-Id: I37300e384ecd3a51a321a48818f0114d6f3357a0
* | Fix the initial existence check for "repo"Sebastian Schuberth2018-07-131-4/+5
|/ | | | | | | | | | | | | | | | | | | Commit 27226e742d7e1a3d371531c19a3fdd91a4f9ab4a introduced a warning if "repo" is not part of the bootstrapped REPO_URL. However, that check was done too early, directly after the call to _Clone. As the _Clone function does not actually clone but it only initializes and fetches, the check needs to be moved to after the call to _Checkout. To reproduce, call repo init --no-clone-bundle --repo-branch=master -u https://android.googlesource.com/platform/manifest which will currently always show the (bogus) warning message. With this fix, the warning will only be shown if "repo" indeed does not exist. While at it, also slightly improve the code by using os.path.join(). Change-Id: Ied89e24231addabab6075005065748df1ffa74c4
* Ensure repo waits for child process to terminateRenaud Paquay2017-05-291-1/+5
| | | | | | | | | | See http://stackoverflow.com/questions/7004687/os-exec-on-windows: execv on Windows does not behave as on Linux, i.e. a new process is spawned and the parent process terminates right away, which makes the shell prompt come back too soon. Change-Id: I1f8d23208765988629f081e9b949c67cf71c08ae
* init: add --submodules to sync manifest submodulesMartin Kelly2017-05-231-0/+3
| | | | | | | | | | | | | | | | repo sync can sync submodules via the --fetch-submodules option. However, if the manifest repo has submodules, those will not be synced. Having submodules in the manifest repo -- while not commonly done -- can be useful for inheriting a manifest from another project using <include> and layering changes on top of it. In this way, you can avoid having to deal with merge conflicts between your own manifests and the other project's manifests (for example, if you're managing an Android fork). Add a --submodule option to init that automatically syncs the submodules in the manifest repo whenever the manifest repo changes. Change-Id: I45d34f04517774c1462d7f233f482d1d81a332a8 Signed-off-by: Martin Kelly <mkelly@xevo.com>
* init: Add no-tags and current branch optionsNaseer Ahmed2016-12-011-1/+7
| | | | | | This avoids fetching tags and branches for huge manifests Change-Id: I19c9724d75364440b881b297d42b906f541f73ff
* Merge "Add a check and more output to protect against invalid REPO_URLs"David Pursehouse2016-10-291-1/+8
|\
| * Add a check and more output to protect against invalid REPO_URLsSebastian Schuberth2016-10-281-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you don't know that the url to git-repo itself can be overridden via REPO_URL, it's hard to debug cases where REPO_URL is accidentally set to another repository, e.g. inside a Jenkins CI job. What makes is even harder is that the ".repo/repo" directory gets silently removed in such cases as verifications fails, which makes it impossible to look at the cloned files to understand the problem. To better protect against such an issue, warn if the cloned git-repo repository does not contain a top-level "repo" file, and state that the ".repo/repo" directory will be removed in case of a clone failure. Change-Id: I697b4999205a5967910c0237772ccaada01e74d4
* | repo: add comment for updating maintainer keysMike Frysinger2016-09-141-0/+3
|/ | | | Change-Id: Ic1e7557f9597234033561ab9fb3104b87e30015e
* Increment the wrapper versionDavid Pursehouse2016-08-171-1/+1
| | | | | | | | | | | | | | There have been a number of changes in the repo wrapper since the last increment that was done in fee390ee: - 9711a98 init: Add --no-clone-bundle option - 631d0ec Support non-ASCII GNUPGHOME environment variable - 4088eb4 repo: Cleaned up pylint/pep8 violations - 5553628 repo: Add check of REPO_URL env variable - 745b4ad Fix gitc-init behavior - d3ddcdb Ignore clone.bundle on HTTP 501, i.e. Not Implemented Change-Id: I3f763ef0ec2df2d726dff429021b48ad474148f1
* init: Add --no-clone-bundle optionHu xiuyun2016-08-151-3/+6
| | | | | Bug: Issue 218 Change-Id: I42ba1f5fb9168875da0df6bdf4fe44c8d6498d54
* Support non-ASCII GNUPGHOME environment variableDāvis Mosāns2016-07-161-2/+8
| | | | | | | Here we don't need to encode this gpg_dir string when using Python 2.7 on Linux. Change-Id: I56724e9511d3b1aea61535e654a45c212130630d
* Merge "Ignore clone.bundle on HTTP 501, i.e. Not Implemented"David Pursehouse2016-04-051-1/+1
|\
| * Ignore clone.bundle on HTTP 501, i.e. Not ImplementedJohn Törnblom2015-08-121-1/+1
| | | | | | | | Change-Id: I03ee003d3bd5d0684a31bdf7961a55a511dfa0e2
* | repo: Cleaned up pylint/pep8 violationsMark E. Hamilton2016-02-151-42/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed when running pylint (as the SUBMITTING_PATCHES file directs) that there were a number of violations reported. This makes it difficult to see violations I might have introduced. This commit corrects all pylint violations in the repo script. First I ran this to clean up the formatting: autopep8 --max-line-length=80 --indent-size 2 repo Following that the following violations remained: % pylint --rcfile=.pylintrc repo ************* Module repo W:220,21: Redefining name 'init_optparse' from outer scope (line 156) (redefined-outer-name) W:482, 2: No exception type(s) specified (bare-except) C:704, 0: Old-style class defined. (old-style-class) For line 220, the parameter to _GitcInitOptions was renamed so as not to mask the init_optparse global. For line 482, a pylint directive was added to disable the bare-execpt violation for just that line. For line 704, the _Options class was changed to subclass object. Additionally, the comments at lines 107-113 were spaced out to line up with the comment at line 112 that autopep8 moved. This script now has a pylint score of 10.0 Change-Id: I779b66eb6b061a195d3c4372b99dec1b6d2a214f
* | repo: Add check of REPO_URL env variableMark E. Hamilton2016-02-091-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to be able to run repo on a system that is not connected to the Internet and cannot access https://gerrit.googlesource.com. We can put a clone of that repos there, but would prefer to use the stable version of the repo script instead of a locally modified version. This commit adds a check for the REPO_URL environment variable. If that is set and not empty its value will be set in the REPO_URL global in repo. Otherwise the standard path will be used. Change-Id: I0616f5f81ef75f3463b73623b892cb5eed6bb7ba
* | Fix gitc-init behaviorv1.12.32Dan Willemsen2015-10-071-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | With gitc-init, a gitc client may be specified using '-c'. If we're not currently in that client, we need to change directories so that we don't affect the local checkout, and to ensure that repo is checked out in the new client. This also makes '-c' optional if already in a gitc client, to match the rest of the init options. Change-Id: Ib514ad9fd101698060ae89bb035499800897e9bd
* | launcher: Update repo after applying clone.bundleDan Willemsen2015-09-021-3/+2
| | | | | | | | | | | | | | | | | | | | | | If the clone.bundle is out of date, repo may be installed with an old version. It will upgrade with the next sync a day later, or when "repo selfupdate" is run. This behavior was added to normal project downloads, but was never added to the repo launcher. Change-Id: Ib04bef3a658c98fe1b6c53b3e8d0067165a5e3f7
* | gitc: Improve help visibilityv1.12.28Dan Willemsen2015-09-011-2/+15
| | | | | | | | | | | | | | This improves the visiblity of gitc-init if we can get the gitc config, and hides it otherwise. Change-Id: I82830b0b07c311e8c74397ba79eb4c361f8b6fb5
* | Fix gitc check if gitc isn't installedDan Willemsen2015-08-311-2/+3
| | | | | | | | | | | | This was doing cwd.startswith(''), which is always true. Change-Id: Icc059c09492b31e2d7651e4a595bda783c5abc47
* | GITC: Pull GITC Manifest Dir from the config.Simran Basi2015-08-311-2/+27
| | | | | | | | | | | | | | Updates the repo launcher and gitc_utils to pull the manifest directory location out of the gitc config file. Change-Id: Id08381b8a7d61962093d5cddcb3ff6afbb13004b
* | GITC: Add gitc-init subcommand to repo.Simran Basi2015-08-121-3/+24
|/ | | | | | | | | | | | Adds the new gitc-init command to set up a GITC client. Gitc-init sets up the client directory and calls repo init within it. Once the repo is initialized, then generates a GITC manifest file by using git ls-remote on each project and retrieving the HEAD SHA to use as the revision attribute. Gitc-init inherits from and has all the options as repo init. Change-Id: Icd7e47e90eab752a77de7c80ebc98cfe16bf6de3
* Revert "Change the min git version from 1.7.2 to 1.8.2"Anthony King2015-03-301-2/+2
| | | | | | This reverts commit 52b99aa91d0fbb5ea363b5febb367d602dbc56db. Change-Id: I01d93704c92f7af1ca2b36dbc9509ee1290e2d3c
* Change the min git version from 1.7.2 to 1.8.2Conley Owens2015-03-181-2/+2
| | | | | | This is needed for the --unshallow option of git fetch. Change-Id: Ifdc5cec6130315c643924328fea425f1b94cb04a
* Don't exit with error on HTTP 401 when downloading clone bundlePascal Bach2015-03-111-1/+1
| | | | | | | | If the server returns HTTP 401 (unauthorized) when attempting to download clone bundle files, ignore it and continue, rather than exiting with a fatal error. Change-Id: I2c7ee03e149c354c7e4ad6ea1ebf266534778fe1
* Change implementation of cleanup in case of clone failure during "repo init"Mani Chandel2014-09-031-1/+1
| | | | | | | | Fix includes: 1. It deletes only .repo/repo instead of the whole .repo repository. Bug: Issue 161 Change-Id: I1ab8caa7538fec5e6206d1b029f63bd3f60dedcd
* Prevent warning twice about Python 3 usageAnthony King2014-05-061-4/+4
| | | | | | | Only warn about using Python 3 when running the repo script directly. This prevents the user being warned twice. Change-Id: I2ee51ea2fa0127ea310598320e460ec9f38c6488
* Don't try to remove .repo if it doesn't existMitchel Humpherys2014-03-121-6/+2
| | | | | | | | | | | | | | | | | | Part of the cleanup path for _Init is removing the .repo directory. However, _Init can fail before creating the .repo directory, so trying to remove it raises another exception: fatal: invalid branch name 'refs/changes/53/55053/4' Traceback (most recent call last): File "/home/mitchelh/bin/repo", line 775, in <module> main(sys.argv[1:]) File "/home/mitchelh/bin/repo", line 749, in main os.rmdir(repodir) OSError: [Errno 2] No such file or directory: '.repo' Fix this by only removing .repo if it actually exists. Change-Id: Ia251d29e9c73e013eb296501d11c36263457e235