summaryrefslogtreecommitdiffstats
path: root/gitc_utils.py
Commit message (Collapse)AuthorAgeFilesLines
* gitc: drop supportJason Chang2023-08-151-166/+0
| | | | | | | | | Bug: b/282775958 Change-Id: Ib6383d6fd82a017d0a6670d6558a905d41be321f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/375314 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Jason Chang <jasonnc@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* Format codebase with black and check formatting in CQGavin Mak2023-03-221-110/+121
| | | | | | | | | | | | Apply rules set by https://gerrit-review.googlesource.com/c/git-repo/+/362954/ across the codebase and fix any lingering errors caught by flake8. Also check black formatting in run_tests (and CQ). Bug: b/267675342 Change-Id: I972d77649dac351150dcfeb1cd1ad0ea2efc1956 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/363474 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
* pylint: remove unused importsDaniel Kutik2022-12-131-1/+0
| | | | | | | | | Removed unused imports accross multiple files. Change-Id: Ib5ae4cebf9660e7339b11e3fa592d99f8d51e8d8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/354700 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* superproject: pass groups to ToXml method.Raman Tenneti2021-03-111-18/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added the following methods to XmlManifest class. + GetDefaultGroupsStr() - return 'default,platform-' + platform.system().lower() + GetGroupsStr() - Same as gitc_utils.py's _manifest_groups func. + Replaced gitc_utils.py's_manifest_groups calls with GetGroupsStr. + Used the above methods to get groups in command.py::GetProjects and part of init.py. TODO: clean up these funcs to take structured group data more instead of passing strings around everywhere that need parsing. Tested the code with the following commands. $ ./run_tests -v Tested the sync code by using repo_dev alias and pointing to this CL and verified prebuilts/fullsdk-linux directory has all the folders. Tested repo init and repo sync with --use-superproject and without --use-superproject argument. $ repo_dev init -u sso://android.git.corp.google.com/platform/manifest -b androidx-main --partial-clone --clone-filter=blob:limit=10M --repo-rev=main --use-superproject $ repo_dev sync -c -j32 Bug: [google internal] b/181804931 Bug: https://crbug.com/gerrit/13707 Change-Id: Ia98585cbfa3a1449710655af55d56241794242b6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/299422 Reviewed-by: Jonathan Nieder <jrn@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Raman Tenneti <rtenneti@google.com>
* gitc_utils: rewrite to use multiprocessingMike Frysinger2021-02-181-21/+29
| | | | | | | | | | | This is the only code in the tree that uses GitCommand asynchronously. Rewrite it to use multiprocessing.Pool as it makes the code a little bit easier to understand and simpler. Change-Id: I3ed3b037f24aa1e9dfe8eec9ec21815cdda7678a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/297143 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Michael Mortensen <mmortensen@google.com>
* strip python2-only coding:utf-8 & print_function settingsMike Frysinger2021-01-061-3/+0
| | | | | | | | | | We're committed to Python 3 at this point, so clean up boilerplate. Bug: https://crbug.com/gerrit/10418 Change-Id: Ib1719ba2eb65c53b94881a1a1bf203ddfcaaafed Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/292382 Reviewed-by: Chris Mcdonald <cjmcdonald@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* gitc: write the manifest directlyMike Frysinger2020-12-111-2/+4
| | | | | | | | | | | Rather than pull the client dir out to construct the manifest filename which the manifest itself already has, pull the filename out and use that. Change-Id: I33991084dcb3205f819bb841084e3c48d6ccb284 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/291264 Reviewed-by: Jonathan Nieder <jrn@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* replace javadoc docs with standard python styleMike Frysinger2020-12-111-7/+11
| | | | | | | | | | We don't use javadoc in this project, so clean up the few places that slipped in with the gitc code. Change-Id: Ia365fb2d1e3188ad16b2f65b1a3b7e8466001946 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/291262 Reviewed-by: Michael Mortensen <mmortensen@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Fix blank line issues reported by flake8David Pursehouse2020-02-121-0/+6
| | | | | | | | | | | | | | | | | | | | - E301 expected 1 blank line - E302 expected 2 blank lines - E303 too many blank lines - E305 expected 2 blank lines after class or function definition - E306 expected 1 blank line before a nested definition Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E301,E302,E303,E305,E306 Manually fix issues in project.py caused by misuse of block comments. Change-Id: Iee840fcaff48aae504ddac9c3e76d2acd484f6a9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254599 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix indentation issues reported by flake8David Pursehouse2020-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | - E121 continuation line under-indented for hanging indent - E122 continuation line missing indentation or outdented - E125 continuation line with same indent as next logical line - E126 continuation line over-indented for hanging indent - E127 continuation line over-indented for visual indent - E128 continuation line under-indented for visual indent - E129 visually indented line with same indent as next logical line - E131 continuation line unaligned for hanging indent Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E121,E122,E125,E126,E127,E128,E129,E131 Change-Id: Ifd95fb8e6a1a4d6e9de187b5787d64a6326dd249 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254605 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix various whitespace issues reported by pyflakesDavid Pursehouse2020-02-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | - E201 whitespace after '[' - E202 whitespace before '}' - E221 multiple spaces before operator - E222 multiple spaces after operator - E225 missing whitespace around operator - E226 missing whitespace around arithmetic operator - E231 missing whitespace after ',' - E261 at least two spaces before inline comment - E271 multiple spaces after keyword Fixed automatically with autopep8: git ls-files | grep py$ | xargs autopep8 --in-place \ --select E201,E202,E221,E222,E225,E226,E231,E261,E271 Change-Id: I367113eb8c847eb460532c7c2f8643f33040308c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254601 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: David Pursehouse <dpursehouse@collab.net>
* Fix tests for membership to use 'not in'David Pursehouse2020-02-121-2/+2
| | | | | | | | | | | flake8 reports: E713 test for membership should be 'not in' Change-Id: I4446be67c431b7267105b53478d2ceba2af758d7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/254451 Tested-by: David Pursehouse <dpursehouse@collab.net> Reviewed-by: Mike Frysinger <vapier@google.com>
* 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
* tweak raise/dict syntax for Python 3 compatMike Frysinger2019-06-131-6/+6
| | | | | | | | | | | | | | | | Use the `raise` statement directly. Switch to using .items() instead of .iteritems(). Python 3 doesn't have .iteritems() as .items() is a generator, and these are small enough that the Python 2 overhead should be negligible. We have to run .keys() through list() in a few places as Python 3 uses a generator and we sometimes want to iterate more than once. That's why we don't change all .keys() or .items() calls -- most are in places where generators are fine. Bug: https://crbug.com/gerrit/10418 Change-Id: I469899d9b77ffd77ccabb831bc4b217407fefe6f
* gitc: Lower concurrent ls-projects requestsv1.12.34Dan Willemsen2016-08-231-1/+1
| | | | | | Too many requests at the same time is causing 502 errors. Change-Id: Ic8fbb2fbb7fb6014733fa5be018d2dc02472f704
* Bail out when manifest is referencing a bad SHA-1 revision.Xin Li2016-06-291-1/+7
| | | | | BUG: Issue 222 Change-Id: Ie0a64b39922d6fdf1be2989eb514985be8490278
* pylint: Fix unused-{argument,variable} warningStefan Beller2016-06-211-1/+1
| | | | | | | | | | | | | | | | This commit fixes 4 out of the remaining 5 pylint warnings: $ pylint --rcfile=.pylintrc *.py ************* Module gitc_utils W:146, 0: TODO(sbasi/jorg): Come up with a solution to remove the sleep below. (fixme) W:130, 6: Unused variable 'name' (unused-variable) ************* Module main W:382,32: Unused argument 'fp' (unused-argument) W:382,36: Unused argument 'code' (unused-argument) W:382,42: Unused argument 'msg' (unused-argument) Change-Id: Ie3d77b9a65b7daefaa9aa4b80f4b682c1678fd58 Signed-off-by: Stefan Beller <sbeller@google.com>
* Fix gitc-init behaviorv1.12.32Dan Willemsen2015-10-071-11/+1
| | | | | | | | | | | | 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
* GITC: Always update the gitc manifest from the repo manifestv1.12.31Dan Willemsen2015-09-091-12/+69
| | | | | | | | | | | | | | This way any changes made to the main manifest are reflected in the gitc manifest. It's also necessary to use both manifests to sync since the information required to update the gitc manifest is actually in the repo manifest. This also fixes a few issues that came up when testing. notdefault groups weren't being saved to the gitc manifest in a method that matched 'sync'. The merge branch wasn't always being set to the correct value either. Change-Id: I435235cb5622a048ffad0059affd32ecf71f1f5b
* Revert "GITC: Always update the gitc manifest from the repo manifest"Dan Willemsen2015-09-091-74/+11
| | | | | | This reverts commit 250303b437855c2b50d052a05a08ed517423af8b. Change-Id: I1fd8af20f802553151aacb953c913f3305ca6057
* GITC: Always update the gitc manifest from the repo manifestDan Willemsen2015-09-091-11/+74
| | | | | | | | | | | | | | This way any changes made to the main manifest are reflected in the gitc manifest. It's also necessary to use both manifests to sync since the information required to update the gitc manifest is actually in the repo manifest. This also fixes a few issues that came up when testing. notdefault groups weren't being saved to the gitc manifest in a method that matched 'sync'. The merge branch wasn't always being set to the correct value either. Change-Id: I5dbc850dd73a9fbd10ab2470ae4c40e46ff894de
* GITC: Pull GITC Manifest Dir from the config.Simran Basi2015-08-311-2/+4
| | | | | | | Updates the repo launcher and gitc_utils to pull the manifest directory location out of the gitc config file. Change-Id: Id08381b8a7d61962093d5cddcb3ff6afbb13004b
* GITC: Add repo start support.Simran Basi2015-08-281-3/+34
| | | | | | | | | | | | | | | | | | | | | Add repo start support for GITC checkouts. If the user is in the GITC FS view, they can now run repo start to check out the sources and create a new working branch. When "repo start" is called on a GITC project, the revision tag is set to an empty string and saved in a new tag: old-revision. This tells the GITC filesystem to display the local copy of the sources when being viewed. The local copy is created by pulling the project sources and the new branch is created based off the original project revision. Updated main.py to setup each command's gitc_manifest when appropriate. Updated repo sync's logic to sync opened projects and updating the GITC manifest file for the rest. Change-Id: I7e4809d1c4fc43c69b26f2f1bebe45aab0cae628
* gitc_utils: Fix incorrect string format argumentDavid Pursehouse2015-08-201-1/+1
| | | | Change-Id: Ibbac6e111833c8f5d93cb6cb4a10f8f2c4fd8e11
* gitc_utils: Remove unused variableDavid Pursehouse2015-08-201-1/+0
| | | | Change-Id: I569819675a99ff6c01fb57b23fed033c39d14d1f
* gitc_utils: Remove unused import; add missing importDavid Pursehouse2015-08-201-1/+1
| | | | | | | | shutils is not used. Remove it. sys is used, but not imported. Import it. Change-Id: I4ee582f33bbd451601097ef2f20bee23b54764cd
* GITC: Add repo sync support.Simran Basi2015-08-181-0/+69
Add repo sync support for GITC checkouts. If the user is in the GITC client directory they can still pull the sources as normal if they pass in the --force-gitc argument. Otherwise the user should call repo sync in the GITC view to update the user's remote view. (This works because .repo in the GITC view will link to .repo in the client config directory.) Part of the support for this change is the refactoring of GITC related code into gitc_utils.py. Change-Id: I2636aaa50b450b6f091309db8dd0e8f4dbdad579