forked from Cog-Creators/Red-DiscordBot
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[downloader] repo and downloader improvements
- Repo and Installable - converted to abstract classes - standard interface lays groundwork for supporting more types - tests are more in-depth - Repo and subclasses - moved to new files - postpone reading folder contents until populate() called - seperated folder and git repo subtypes (folder and git) - no more MISSING_REPO folder, missing is an error now - move executor and subprocesses to RepoManager - UpdateResult: new object type describing generalized repo updates - git and pip commands moved to new file and namespace - only uses -t {target} if NOT in a venv or virtualenv - Downloader UI - error on invalid repo names - cog update command only updates requested cogs if given - also shows what cogs were updated, if any - better display for list commands TODO: - Selective updating (req. by @mikeshardmind) - Storage of installed cog version - Use bot_version key in info.json (Cog-Creators#1866) - Changelogs (epic @ Cog-Creators#1683)
- Loading branch information
Showing
23 changed files
with
2,015 additions
and
937 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from types import SimpleNamespace | ||
|
||
from .utils import CommandTemplate | ||
|
||
COMMANDS = SimpleNamespace( | ||
GIT_CHECKOUT_LOCAL=CommandTemplate("git -C {path} checkout {branch} --", extras_kw="paths"), | ||
GIT_CHECKOUT_REMOTE=CommandTemplate( | ||
"git -C {path} checkout {remote}/{branch} --", | ||
extras_kw="paths", | ||
defaults={"remote": "origin"}, | ||
), | ||
GIT_CLONE=CommandTemplate("git clone -b {branch} {url} {folder}"), | ||
GIT_CLONE_NO_BRANCH=CommandTemplate("git clone {url} {folder}"), | ||
GIT_CURRENT_BRANCH=CommandTemplate("git -C {path} rev-parse --abbrev-ref HEAD"), | ||
# GIT_LATEST_COMMIT=CommandTemplate("git -C {path} rev-parse {branch}"), | ||
GIT_LATEST_COMMIT=CommandTemplate( | ||
"git -C {path} rev-list -1 {branch} --", extras_kw="relative_file_path" | ||
), | ||
GIT_HARD_RESET=CommandTemplate( | ||
"git -C {path} reset --hard {remote}/{branch} -q", defaults={"remote": "origin"} | ||
), | ||
GIT_PULL=CommandTemplate("git -C {path} pull -q --ff-only"), | ||
GIT_DIFF_FILE_STATUS=CommandTemplate( | ||
"git -C {path} diff --no-commit-id --name-status {old_ref}..{new_ref}" | ||
), | ||
GIT_LOG=CommandTemplate( | ||
"git -C {path} log --relative-date --reverse {old_ref}.. {relative_file_path}" | ||
), | ||
GIT_DISCOVER_REMOTE_URL=CommandTemplate( | ||
"git -C {path} config --get remote.{remote}.url", defaults={"remote": "origin"} | ||
), | ||
PIP_INSTALL=CommandTemplate("{python} -m pip install -U -t {target_dir}", extras_kw="reqs"), | ||
PIP_INSTALL_NO_TARGET=CommandTemplate( | ||
"{python} -m pip --disable-pip-version-check install -U", extras_kw="reqs" | ||
), | ||
PIP_SHOW=CommandTemplate( | ||
"{python} -m pip --disable-pip-version-check show", extras_kw="packages" | ||
), | ||
) |
Oops, something went wrong.