mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-07 03:38:53 -05:00
[Downloader] Allow branches to be specified on repo add
Example URL: `https://github.com/Author/Repo@branch`
This commit is contained in:
parent
2a8818393e
commit
102977664e
@ -548,7 +548,13 @@ class Downloader:
|
|||||||
url = self.repos[name].get('url')
|
url = self.repos[name].get('url')
|
||||||
if not url:
|
if not url:
|
||||||
raise UpdateError("Need to clone but no URL set")
|
raise UpdateError("Need to clone but no URL set")
|
||||||
p = run(["git", "clone", url, dd + name])
|
branch = None
|
||||||
|
if "@" in url: # Specific branch
|
||||||
|
url, branch = url.rsplit("@", maxsplit=1)
|
||||||
|
if branch is None:
|
||||||
|
p = run(["git", "clone", url, dd + name])
|
||||||
|
else:
|
||||||
|
p = run(["git", "clone", "-b", branch, url, dd + name])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise CloningError()
|
raise CloningError()
|
||||||
self.populate_list(name)
|
self.populate_list(name)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user