From 102977664efe75d1b7f35e20caf82bb1fad5033f Mon Sep 17 00:00:00 2001 From: Twentysix Date: Sat, 7 Jan 2017 17:15:56 +0100 Subject: [PATCH] [Downloader] Allow branches to be specified on repo add Example URL: `https://github.com/Author/Repo@branch` --- cogs/downloader.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cogs/downloader.py b/cogs/downloader.py index b86724584..cdf01ea40 100644 --- a/cogs/downloader.py +++ b/cogs/downloader.py @@ -548,7 +548,13 @@ class Downloader: url = self.repos[name].get('url') if not url: 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: raise CloningError() self.populate_list(name)