[Downloader] Allow branches to be specified on repo add

Example URL:
`https://github.com/Author/Repo@branch`
This commit is contained in:
Twentysix 2017-01-07 17:15:56 +01:00
parent 2a8818393e
commit 102977664e

View File

@ -548,7 +548,13 @@ class Downloader:
url = self.repos[name].get('url')
if not url:
raise UpdateError("Need to clone but no URL set")
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:
raise CloningError()
self.populate_list(name)