Skip to content

Commit 502fa9c

Browse files
Merge pull request #680 from screamerbg/f/new-mbed2-programs
Fix mbed2 builds download when creating new mbed2 program
2 parents 4f24ce5 + a7f3fa6 commit 502fa9c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mbed/mbed.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ def clone(url, path=None, depth=None, protocol=None):
353353
try:
354354
Bld.init(path)
355355
with cd(path):
356-
Bld.seturl(url+'/tip')
356+
rev = Hg.remoteid(m.group(1), 'tip')
357+
if not rev:
358+
error("Unable to fetch library build information")
359+
Bld.seturl(url+'/'+rev)
357360
except Exception as e:
358361
if os.path.isdir(path):
359362
rmtree_readonly(path)
@@ -363,7 +366,7 @@ def fetch_rev(url, rev):
363366
rev_file = os.path.join('.'+Bld.name, '.rev-' + rev + '.zip')
364367
try:
365368
if not os.path.exists(rev_file):
366-
action("Downloading library build \"%s\" (might take a minute)" % rev)
369+
action("Downloading library build \"%s\" (might take a while)" % rev)
367370
outfd = open(rev_file, 'wb')
368371
inurl = urlopen(url)
369372
outfd.write(inurl.read())
@@ -1008,7 +1011,7 @@ def fromurl(cls, url, path=None):
10081011
repo.path = os.path.abspath(path or os.path.join(getcwd(), repo.name))
10091012
repo.url = formaturl(m_repo_ref.group(1))
10101013
repo.rev = m_repo_ref.group(3)
1011-
if repo.rev and repo.rev != 'latest' and not re.match(r'^([a-fA-F0-9]{6,40})$', repo.rev):
1014+
if repo.rev and repo.rev != 'latest' and repo.rev != 'tip' and not re.match(r'^([a-fA-F0-9]{6,40})$', repo.rev):
10121015
error('Invalid revision (%s)' % repo.rev, -1)
10131016
else:
10141017
error('Invalid repository (%s)' % url.strip(), -1)
@@ -1927,7 +1930,7 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
19271930
p.path = cwd_root
19281931
p.set_root()
19291932
if not create_only and not p.get_os_dir() and not p.get_mbedlib_dir():
1930-
url = mbed_lib_url if mbedlib else mbed_os_url+'#latest'
1933+
url = mbed_lib_url+'#tip' if mbedlib else mbed_os_url+'#latest'
19311934
d = 'mbed' if mbedlib else 'mbed-os'
19321935
try:
19331936
with cd(d_path):

0 commit comments

Comments
 (0)