Skip to content
This repository was archived by the owner on Sep 26, 2019. It is now read-only.

Commit b9217f3

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add refspec tag for origin checkout"
2 parents d639c5b + 2605f2d commit b9217f3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

anvil/downloader.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def __init__(self, uri, dst, **kwargs):
4949
self._branch = self._get_string_from_dict(kwargs, 'branch')
5050
self._tag = self._get_string_from_dict(kwargs, 'tag')
5151
self._sha1 = self._get_string_from_dict(kwargs, 'sha1')
52+
self._refspec = self._get_string_from_dict(kwargs, 'refspec')
5253
git_sources = len([a for a in (self._tag, self._sha1, self._branch) if a])
5354
if git_sources > 1:
5455
raise exceptions.ConfigException('Too many sources. Please, '
@@ -90,6 +91,10 @@ def download(self):
9091
colorizer.quote(self._dst))
9192
cmd = ["git", "clone", self._uri, self._dst]
9293
sh.execute(cmd)
94+
if self._refspec:
95+
LOG.info("Fetching ref %s.", self._refspec)
96+
cmd = ["git", "fetch", self._uri, self._refspec]
97+
sh.execute(cmd, cwd=self._dst)
9398
if self._sha1:
9499
LOG.info("Adjusting to SHA1 %s.", colorizer.quote(self._sha1))
95100
elif tag:

0 commit comments

Comments
 (0)