Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[V3 Downloader] Revision tracking #2571
Description of the changes
This PR implements features proposed in #2527. (closes #2527)
Internal info: All function parameters are explicitly called
Downloader cog - changed/added commands:
Here's somewhat big change, I added git integration tests that will make sure that all the git commands we use give expected output. Most git commands require a repo to operate on so along with this I added a test repo and a new (cool) script at
Aaaaand, here you have changes that are rather boring for average reader:
Unfortunately, few public methods had to have their behaviour changed and therefore this PR is breaking change for devs using Downloader framework. To make it a little easier, I added [BREAKING] at the end of each change, which can be considered breaking (hopefully I haven't missed anything).
Downloader cog - internal changes:
Okay, I think, this is ready for review now, I added all things from my TODO list (which you can find in previous revision of issue description) and I changed whole issue description and updated it with all changes this PR does.
At the end, I have one question, should I make any new unit tests? I don't have a lot of experience with those, so I didn't add any, but if I should, I'll look into it.
After config format update, commit string is empty until update and when such cog was checked and it wasn't available in repo anymore, it was ignored
- changes to `Repo.checkout()`: - `exit_to_rev` is now keyword only argument - added `force_checkout` to force checkout even if `Repo.commit` value is the same as target hash
- added two keyword arguments: - `valid_exit_codes` which specifies valid exit codes, used to determine if stderr should be sent as debug or error level in logging - `debug_only` which specifies if stderr can be sent only as debug level in logging
- fix wrong type annotations and add a lot of new ones - add checks for `Installable.repo` being `None` - fix wrong return type in `Downloader._install_requirements` - show repo names correctly when updating all repos - fix error when some requirement fails to install BREAKING CHANGE: - type of `Repo.available_modules` is now consistent (always `tuple`)
This script aims to help update the human-readable version of repo used for git integration tests in ``redbot/tests/downloader_testrepo.export`` by exporting/importing it in/from provided directory. Note ---- Editing `downloader_git_test_repo.export` file manually is strongly discouraged, especially editing any part of commit directives as that causes a change in the commit's hash. Another problem devs could encounter when trying to manually edit that file are editors that will use CRLF instead of LF for new line character(s) and therefore break it. I also used `.gitattributes` to prevent autocrlf from breaking testrepo. Also, if Git ever changes currently used SHA-1 to SHA-256 we will have to update old hashes with new ones. But it's a small drawback, when we can have human-readable version of repo. Known limitations ----------------- ``git fast-export`` exports commits without GPG signs so this script disables it in repo's config. This also means devs shouldn't use ``--gpg-sign`` flag in ``git commit`` within the test repo.
Also added Markdown file that is even more clear than export file on what the test repo contains. This is manually created but can be automated on later date.
I know this doesn't actually give any benefit to people that don't have write permission to the repo but I saw other big fella devs doing this, so I think this might be advisable.
…om `IntEnum` There's desync of `InstallableType` class types due to hot-reload and `IntEnum` allows for equality check between different types