Skip to content

Commit e6e1996

Browse files
committed
The import_() routine now takes into account the default protocol option (set via mbed default protocol ssh for example). This applies for 'new', 'deploy', 'import' and 'update' (#142)
1 parent cdcf2a6 commit e6e1996

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

mbed/mbed.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,9 +1312,13 @@ def import_(url, path=None, depth=None, protocol=None, top=True):
13121312
global cwd_root
13131313

13141314
repo = Repo.fromurl(url, path)
1315-
if top and cwd_type != "directory":
1316-
error("Cannot import program in the specified location \"%s\" because it's already part of a program.\n"
1317-
"Please change your working directory to a different location or use \"mbed add\" to import the URL as a library." % os.path.abspath(repo.path), 1)
1315+
if top:
1316+
if cwd_type != "directory":
1317+
error("Cannot import program in the specified location \"%s\" because it's already part of a program.\n"
1318+
"Please change your working directory to a different location or use \"mbed add\" to import the URL as a library." % os.path.abspath(repo.path), 1)
1319+
else:
1320+
program = Program()
1321+
protocol = program.get_cfg('PROTOCOL', protocol)
13181322

13191323
if os.path.isdir(repo.path) and len(os.listdir(repo.path)) > 1:
13201324
error("Directory \"%s\" is not empty. Please ensure that the destination folder is empty." % repo.path, 1)

0 commit comments

Comments
 (0)