Skip to content

Commit dff86c5

Browse files
authored
Merge pull request #873 from studavekar/allow-tag
allow tag to be used in mbed import
2 parents 3fb77db + 1478d5e commit dff86c5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mbed/mbed.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,6 @@ def fromurl(cls, url, path=None):
10381038
repo.path = os.path.abspath(path or os.path.join(getcwd(), repo.name))
10391039
repo.url = formaturl(m_repo_ref.group(1))
10401040
repo.rev = m_repo_ref.group(3)
1041-
if repo.rev and repo.rev != 'latest' and repo.rev != 'tip' and not re.match(r'^([a-fA-F0-9]{6,40})$', repo.rev):
1042-
error('Invalid revision (%s)' % repo.rev, -1)
10431041
else:
10441042
error('Invalid repository (%s)' % url.strip(), -1)
10451043

@@ -1060,6 +1058,12 @@ def fromlib(cls, lib=None):
10601058
m_local = re.match(regex_local_ref, ref.strip().replace('\\', '/'))
10611059
m_repo_ref = re.match(regex_url_ref, ref.strip().replace('\\', '/'))
10621060
m_bld_ref = re.match(regex_build_url, ref.strip().replace('\\', '/'))
1061+
1062+
if m_repo_ref:
1063+
rev = m_repo_ref.group(3)
1064+
if rev and not re.match(r'^([a-fA-F0-9]{6,40})$', rev):
1065+
error('Named branches not allowed in .lib, offending lib is {} '.format(os.path.basename(lib)))
1066+
10631067
if not (m_local or m_bld_ref or m_repo_ref):
10641068
warning(
10651069
"File \"%s\" in \"%s\" uses a non-standard .lib file extension, which is not compatible with the mbed build tools.\n" % (os.path.basename(lib), os.path.split(lib)[0]))

0 commit comments

Comments
 (0)