summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* main: drop Python 2 checkMike Frysinger2023-10-131-16/+8
| | | | | | | | | | | | Python 2 can't even parse this code anymore due to syntax changes, so there's no point in checking for it explicitly. Bug: 302871152 Change-Id: I9852ace5f5079d037c60fd3ac490d77e074e6875 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389434 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* Update logger.warn to logger.warningAravind Vasudevan2023-10-137-18/+20
| | | | | | | | | Bug: 305035810 Change-Id: Ic2b35d5c3cbe92480c24da612f29382f5d26d4aa Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/389414 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
* git_command: read1 needs a size in py3.6Daniel Kutik2023-10-091-2/+3
| | | | | | | | | | | | | | | | | Not setting size causes "TypeError: read1() takes exactly one argument (0 given)" in Python 3.6. In Python 3.7 onwards size defaults to -1, which means an arbitrary number of bytes will be returned. Compare https://docs.python.org/3.6/library/io.html#io.BufferedReader.read1 and https://docs.python.org/3.7/library/io.html#io.BufferedIOBase.read1 for more details. Change-Id: Ia4aaf8140ead9493ec650fac167c641569e6a9d8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/388718 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com>
* git_command: lru_cache needs maxsize for py36 & 37Daniel Kutik2023-10-091-1/+1
| | | | | | | | | | | | Python 3.6 and 3.7 do not have a default value for lru_cache maxsize. Not setting it would cause: TypeError: Expected maxsize to be an integer or None Change-Id: I32d4fb6a0040a0c24da0b2f29f22f85a36c96531 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/388737 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com>
* sync: Fix print statement in _PostRepoFetchAravind Vasudevan2023-10-061-1/+1
| | | | | | | | | | | R=jasonnc@google.com Bug: b/303806829 Change-Id: I49075bfb55b842610786e61a0dedfe008cd1296a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/388614 Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Jason Chang <jasonnc@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
* git_command: Augment underlying git errors with suggestionsAravind Vasudevan2023-10-063-31/+270
| | | | | | | | | | | | | | | This change appends suggestions to the underlying git error to make the error slightly more actionable. DD: go/improve-repo-error-reporting & go/tee-repo-stderr Bug: b/292704435 Change-Id: I2bf8bea5fca42c6a9acd2fadc70f58f22456e027 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/387774 Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Jason Chang <jasonnc@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
* project: Invoke realpath on dotgit for symmetry with gitdir to ensure a ↵Jason R. Coombs2023-10-051-1/+2
| | | | | | | | | | | | short relpath. Bug: 302680231 Change-Id: Icd01dd2ce62d737a4acb114e729189cd31f6bde9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/388234 Tested-by: Jason R. Coombs <jaraco@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jason R. Coombs <jaraco@google.com>
* Reset info logs back to print in syncv2.37Aravind Vasudevan2023-09-282-14/+11
| | | | | | | | | Bug: b/292704435 Change-Id: Ib4b4873de726888fc68e476167ff2dcd74ec9045 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/387974 Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Jason Chang <jasonnc@google.com>
* Track expected git errors in logsJason Chang2023-09-272-7/+26
| | | | | | | | | | | | Sometimes it is expected that a GitCommand executed in repo fails. In such cases indicate in trace logs that the error was expected. Bug: b/293344017 Change-Id: If137fae9ef9769258246f5b4494e070345db4a71 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/387714 Commit-Queue: Jason Chang <jasonnc@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Jason Chang <jasonnc@google.com>
* tests: Fix tox error in py36 use virtualenv<20.22.0Daniel Kutik2023-09-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | tox uses virtualenv under its hood for managing virtual environments. Virtualenv 20.22.0 dropped support for Python <= 3.6. Since we want to test against Python 3.6 we need to make sure we use a version of virtualenv earlier than 20.22.0. This error was not stopping any tests from passing but was printed multiple times to stderr when executing the py36 target: Error processing line 1 of [...]/.tox/py36/[...]/_virtualenv.pth: Traceback (most recent call last): File "/usr/lib/python3.6/site.py", line 168, in addpackage exec(line) File "<string>", line 1, in <module> File "[...]/.tox/py36/[...]/_virtualenv.py", line 3 from __future__ import annotations ^ SyntaxError: future feature annotations is not defined Source: https://tox.wiki/en/latest/faq.html#testing-end-of-life-python-versions Change-Id: I27bd8200987ecf745108ee8c7561a365f542102a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/387694 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Use non-deprecated API for obtaining UTC timeLuK13372023-09-185-9/+13
| | | | | | | | | | | | | DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). Change-Id: Ia2c46fb87c544d98cc2dd68a829f67d4770b479c Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386615 Tested-by: Łukasz Patron <priv.luk@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Łukasz Patron <priv.luk@gmail.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* main: Use repo loggerAravind Vasudevan2023-09-183-107/+104
| | | | | | | | | Bug: b/292704435 Change-Id: Ica02e4c00994a2f64083bb36e8f4ee8aa45d76bd Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386454 Reviewed-by: Jason Chang <jasonnc@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
* project: Use repo loggerAravind Vasudevan2023-09-141-103/+69
| | | | | | | | | Bug: b/292704435 Change-Id: I510fc911530db2c84a7ee099fa2905ceac35d0b7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386295 Reviewed-by: Jason Chang <jasonnc@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
* subcmds: Use repo loggerAravind Vasudevan2023-09-1412-115/+121
| | | | | | | | | Bug: b/292704435 Change-Id: Ia3a45d87fc0bf0d4a1ba53050d9c3cd2dba20e55 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386236 Reviewed-by: Jason Chang <jasonnc@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com>
* github: add PR closerMike Frysinger2023-09-131-0/+22
| | | | | | | | | | | We don't accept PRs via GH, so add a job to automatically close them with an explanation for how to submit. Change-Id: I5cc3176549a04ff23b04dae1110cd27a58ba1fd3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/386134 Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* tests: test_subcmds_sync.py: fix for py3.6 & 3.7Daniel Kutik2023-09-131-2/+6
| | | | | | | | | | | | | | | | tests/test_subcmds_sync.py::LocalSyncState::test_prune_removed_projects was failing in Python 3.6 and 3.7 due to topdir not being set with the following error message: TypeError: expected str, bytes or os.PathLike object, not MagicMock topdir is accessed from within PruneRemovedProjects(). Test: tox with Python 3.6 to 3.11 Change-Id: I7ba5144df0a0126c01776384e2178136c3510091 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382816 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com>
* tests: test_git_superproject.py: fix py3.6 & 3.7Daniel Kutik2023-09-131-2/+6
| | | | | | | | | | | | | | tests/test_git_superproject.py::SuperprojectTestCase::test_Fetch was failing in Python 3.6 and 3.7 due to attribute args only being introduced in Python 3.8. Falling back on old way of accessing the arguments. Test: tox with Python 3.6 to 3.11 Change-Id: Iae1934a7bce8cbd6b4519e4dbc92d94e21b43435 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382818 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com>
* start: Use repo loggerAravind Vasudevan2023-09-111-9/+9
| | | | | | | | | Bug: b/292704435 Change-Id: I7b8988207dfdcf0ffc283a48499611892ef5187d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385534 Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Jason Chang <jasonnc@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
* project: Use IsId instead of ID_RE.matchSylvain2023-09-111-14/+7
| | | | | | | | Change-Id: I8ca83a034400da0cb97cba41415bfc50858a898b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385857 Tested-by: Sylvain Desodt <sylvain.desodt@gmail.com> Commit-Queue: Sylvain Desodt <sylvain.desodt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* project: Optimise GetCommitRevisionId when revisionId is setSylvain2023-09-111-0/+2
| | | | | | | | | | | | | | | | | | | When comparing 2 manifests, most of the time is spent getting the relevant commit id as it relies on _allrefs which ends up loading all git references. However, the value from `revisionIs` (when it is valid) could be used directly leading to a huge performance improvement (from 180+ seconds to less than 0.01 sec which is more than 25000 times faster for manifests with 700+ projects). Bug: 295282548 Change-Id: I5881aa4b2326cc17bbb4ee91d23293111f76ad7e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385834 Tested-by: Sylvain Desodt <sylvain.desodt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Sylvain Desodt <sylvain.desodt@gmail.com>
* manifest_xml: use a set instead of (sorted) list in projectsDiffSylvain2023-09-101-6/+5
| | | | | | | | | | | | | | | | | | | | | | | The logic in projectsDiff performs various operations which suggest that a set is more appropriate than a list: - membership lookup ("in") - removal Also, sorting can be performed on the the remaining elements at the end (which will usually involve a much smaller number of elements). (The performance gain is invisible in comparison to the time being spent performing git operations). Cosmetic chance: - the definition of 'fromProj' is moved to be used in more places - the values in diff["added"] are added with a single call to extend Change-Id: I5ed22ba73b50650ca2d3a49a1ae81f02be3b3055 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383434 Tested-by: Sylvain Desodt <sylvain.desodt@gmail.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Sylvain Desodt <sylvain.desodt@gmail.com>
* Log ErrorEvent for failing GitCommandsJason Chang2023-09-063-363/+470
| | | | | | | | Change-Id: I270af7401cff310349e736bef87e9b381cc4d016 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385054 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Jason Chang <jasonnc@google.com> Tested-by: Jason Chang <jasonnc@google.com>
* logging: Use log.formatter for coloring logsAravind Vasudevan2023-09-062-61/+33
| | | | | | | | | Bug: b/292704435 Change-Id: Iebdf8fb7666592dc5df2b36aae3185d1fc71bd66 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385514 Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* sync: Preserve errors on KeyboardInterruptJason Chang2023-09-061-41/+78
| | | | | | | | | | | | | If a KeyboardInterrupt is encountered before an error is aggregated then the context surrounding the interrupt is lost. This change aggregates errors as soon as possible for the sync command Bug: b/293344017 Change-Id: Iac14f9d59723cc9dedbb960f14fdc1fa5b348ea3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/384974 Tested-by: Jason Chang <jasonnc@google.com> Commit-Queue: Jason Chang <jasonnc@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
* fix black formatting of standalone programsMike Frysinger2023-09-012-992/+1220
| | | | | | | | | | | | | Black will only check .py files when given a dir and --check, so list our few standalone programs explicitly. This causes the repo launcher to be reformatted since it was missed in the previous mass reformat. Bug: b/267675342 Change-Id: Ic90a7f5d84fc02e9fccb05945310fd067e2ed764 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/385034 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* sync: Use repo logger within syncAravind Vasudevan2023-08-313-142/+102
| | | | | | | | | Bug: b/292704435 Change-Id: Iceb3ad5111e656a1ff9730ae5deb032a9b43b4a5 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383454 Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* project: Preserve stderr on uploadv2.36.1Jason Chang2023-08-281-3/+1
| | | | | | | | | | | | | A previous change captured stderr when uploading git projects. This change ensures stderr is sent to stderr. Bug: b/297097597 Change-Id: I8314e1017d2a42b7b655fe43ce3c312d397894ca Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/384134 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jason Chang <jasonnc@google.com> Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Sam Saccone <samccone@google.com>
* tox.ini: add isort as dependencyDaniel Kutik2023-08-281-0/+1
| | | | | | | | | | | | a previous introduced isort, which causes tox runs to fail for all python versions. adding isort as dependency resolve these issues. Change-Id: If3faf78e6928e6e5111b2ef2359351459832431f Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/384175 Tested-by: Mike Frysinger <vapier@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* isort: format codebasev2.36Mike Frysinger2023-08-2252-143/+280
| | | | | | | | Change-Id: I6f11d123b68fd077f558d3c21349c55c5f251019 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383715 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
* tweak stdlib imports to follow Google style guideMike Frysinger2023-08-228-20/+24
| | | | | | | | | | | | Google Python style guide says to import modules. Clean up all our stdlib imports. Leave the repo ones alone for now as that's a much bigger shave. Change-Id: Ida42fc2ae78b86e6b7a6cbc98f94ca04b295f8cc Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383714 Reviewed-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Mike Frysinger <vapier@google.com> Tested-by: Mike Frysinger <vapier@google.com>
* upload: Suggest full sync if hooks fail with partially synced treeGavin Mak2023-08-223-4/+11
| | | | | | | | | | | Pre-upload hooks may fail because of partial syncs. Bug: b/271507654 Change-Id: I124cd386c5af2c34e1dcaa3e86916624e235b1e3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383474 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* sync: Ignore repo project when checking partial syncsGavin Mak2023-08-222-3/+25
| | | | | | | | | | | | The repo project is fetched at most once a day and should be ignored when checking if the tree is partially synced. Bug: b/286126621, b/271507654 Change-Id: I684ed1669c3b3b9605162f8cc9d57185bb3dfe8e Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383494 Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
* upload: fix error handlingJason Chang2023-08-213-129/+200
| | | | | | | | | | | | There was a bug in error handeling code that caused an uncaught exception to be raised. Bug: b/296316540 Change-Id: I49c72f29c00f26ba60de552f958bc6eddf841162 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383254 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Jason Chang <jasonnc@google.com> Tested-by: Jason Chang <jasonnc@google.com>
* docs: Document .repo_localsyncstate.jsonGavin Mak2023-08-181-2/+6
| | | | | | | | | | | Update docs to reflect the new internal filesystem layout. Bug: b/286126621, b/271507654 Change-Id: I8a2f8f36dff75544f32356ac5e31668f32ddffb3 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/383074 Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* gitc: drop supportJason Chang2023-08-1513-523/+23
| | | | | | | | | 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>
* tox: enable python 3.11 testingDaniel Kutik2023-08-152-2/+3
| | | | | | | | | | | Python 3.11 was released almost a year ago. Test: tox -epy311 Change-Id: I447637a1e97038a596373d7612c9000c0c738ec9 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382838 Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com>
* flake8: exclude venv and .tox folderDaniel Kutik2023-08-151-0/+3
| | | | | | | | | | | Excluding these two folders to avoid countless lint warnings caused by dependencies in these two folders. Change-Id: I2403b23f88cebb5941a4f9b5ac6cc34d107fd2f1 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382837 Commit-Queue: Daniel Kutik <daniel.kutik@lavawerk.com> Tested-by: Daniel Kutik <daniel.kutik@lavawerk.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* Raise RepoExitError in place of sys.exitJason Chang2023-08-1010-122/+251
| | | | | | | | | | Bug: b/293344017 Change-Id: Icae4932b00e4068cba502a5ab4a0274fd7854d9d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382214 Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* sync: Warn if partial sync state is detectedGavin Mak2023-08-102-1/+101
| | | | | | | | | | | | | | | Partial syncs are not supported and can lead to strange behavior like deleting files. Explicitly warn users on partial sync. Bug: b/286126621, b/271507654 Change-Id: I471f78ac5942eb855bc34c80af47aa561dfa61e8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/382154 Reviewed-by: Jason Chang <jasonnc@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
* main: Pass path to python binary as arg0 when restarting repoGavin Mak2023-08-081-2/+1
| | | | | | | | | | | | | | Not including it causes flaky behavior in some Chromium builders because Chromium's custom Python build used by vpython relies on argv[0] to find its own internal files. Bug: https://crbug.com/1468522 Change-Id: I5c32ebe71c9b684d6ee50dbd8c3d6fcd51ca309b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381974 Reviewed-by: Chenlin Fan <fancl@google.com> Reviewed-by: Mike Frysinger <vapier@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* Raise repo exit errors in place of sys.exitJason Chang2023-08-079-34/+80
| | | | | | | | | Bug: b/293344017 Change-Id: I92d81c78eba8ff31b5252415f4c9a515a6c76411 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381774 Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* Prefix error events with RepoErrorEvent:Jason Chang2023-08-072-4/+4
| | | | | | | | | | | | Prior to this change there is no way to distinguish between git sessions logs generated from repo source v.s. from git. Bug: b/294446468 Change-Id: I309f59e146c30cb08a0637e8d0b9c5d9efd5cada Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/381794 Commit-Queue: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com> Tested-by: Jason Chang <jasonnc@google.com>
* Refactor errors for sync commandJason Chang2023-08-025-142/+441
| | | | | | | | | | | | | | | | | | Per discussion in go/repo-error-update updated aggregated and exit errors for sync command. Aggregated errors are errors that result in eventual command failure. Exit errors are errors that result in immediate command failure. Also updated main.py to log aggregated and exit errors to git sessions log Bug: b/293344017 Change-Id: I77a21f14da32fe2e68c16841feb22de72e86a251 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/379614 Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Jason Chang <jasonnc@google.com> Commit-Queue: Jason Chang <jasonnc@google.com>
* Update errors to extend BaseRepoErrorJason Chang2023-07-315-33/+218
| | | | | | | | | | | | | | | | | | | In order to better analyze and track repo errors, repo command failures need to be tied to specific errors in repo source code. Additionally a new GitCommandError was added to differentiate between general git related errors to failed git commands. Git commands that opt into verification will raise a GitCommandError if the command failed. The first step in this process is a general error refactoring Bug: b/293344017 Change-Id: I46944b1825ce892757c8dd3f7e2fab7e460760c0 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/380994 Commit-Queue: Jason Chang <jasonnc@google.com> Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com> Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com>
* [repo logging] Add logging moduleAravind Vasudevan2023-07-312-0/+189
| | | | | | | | | Bug: b/292704435 Change-Id: I8834591f661c75449f8be5de1c61ecd43669026d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/380714 Tested-by: Aravind Vasudevan <aravindvasudev@google.com> Reviewed-by: Joanna Wang <jojwang@google.com> Commit-Queue: Aravind Vasudevan <aravindvasudev@google.com>
* sync: Track last completed fetch/checkoutGavin Mak2023-07-283-17/+148
| | | | | | | | | | | | Save the latest time any project is fetched and checked out. This will be used to detect partial checkouts. Bug: b/286126621 Change-Id: I53b264dc70ba168d506076dbd693ef79a696b61d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/380514 Commit-Queue: Gavin Mak <gavinmak@google.com> Reviewed-by: Joanna Wang <jojwang@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
* main: Fix exitcode loggingv2.35Jason Chang2023-06-261-2/+31
| | | | | | | | | | | | | | | | Fixed a couple of bugs in ExitEvent logging: - log exitcode 130 on KeyboardInterrupt - log exitcode 1 on unhandled Exception - log errorevent with specific reason for exit Before this CL an exitcode of 0 would be logged, and it would be difficult to determine the cause of non-zero exit codes Bug: b/287105597 Change-Id: I2d34f180581f9fbd77a1c78c966ebed065223af6 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/377834 Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Josip Sokcevic <sokcevic@google.com>
* sync: Track new/existing project countJason Chang2023-06-231-0/+7
| | | | | | | | | | | New vs existing project may be a useful measure for analyzing sync performance. Bug: b/287105597 Change-Id: Ibea3e90c9fe3d16fd8b863bcae22b21963a6771a Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/377574 Tested-by: Jason Chang <jasonnc@google.com> Reviewed-by: Joanna Wang <jojwang@google.com>
* manifest: enable remove-project using pathFredrik de Groot2023-06-213-16/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | A something.xml that gets included by two different files, that both remove and add same shared project to two different locations, would not work prior to this change. Reason is that remove killed all name keys, even though reuse of same repo in different locations is allowed. Solve by adding optional attrib path to <remove-project name="foo" path="only_this_path" /> and tweak remove-project. Behaves as before without path, and deletes more selectively when remove path is supplied. As secondary feature, a project can now also be removed by only using path, assuming a matching project name can be found. Change-Id: I502d9f949f5d858ddc1503846b170473f76dc8e2 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/375694 Tested-by: Fredrik de Groot <fredrik.de.groot@aptiv.com> Reviewed-by: Mike Frysinger <vapier@google.com>
* update links from monorail to issuetrackerMike Frysinger2023-06-144-8/+8
| | | | | | | | Change-Id: Ie05373aa4becc0e4d0cab74e7ea0a61eb2cc2746 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/377014 Commit-Queue: Mike Frysinger <vapier@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com> Tested-by: Mike Frysinger <vapier@google.com>