Skip to content

Commit 6c7084f

Browse files
committed
Fixed for protocol not being inferred from the import/add URL #240, #242
1 parent 8a7b71f commit 6c7084f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

mbed/mbed.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,10 +1023,12 @@ def write(self):
10231023
#print self.name, 'unmodified'
10241024
return
10251025

1026-
action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, self.fullurl))
1027-
1026+
ref = (formaturl(self.url, 'https').rstrip('/') + '/' +
1027+
(('' if self.is_build else '#') +
1028+
self.rev if self.rev else ''))
1029+
action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, ref))
10281030
with open(self.lib, 'wb') as f:
1029-
f.write(self.fullurl + '\n')
1031+
f.write(ref + '\n')
10301032

10311033
def rm_untracked(self):
10321034
untracked = self.scm.untracked()
@@ -1365,17 +1367,17 @@ def formaturl(url, format="default"):
13651367
url = 'ssh://%s/%s.git' % (m.group(2), m.group(3))
13661368
elif format == "http":
13671369
url = 'http://%s/%s' % (m.group(2), m.group(3))
1368-
else:
1369-
url = 'https://%s/%s' % (m.group(2), m.group(3)) # https is default
1370+
elif format == "https":
1371+
url = 'https://%s/%s' % (m.group(2), m.group(3))
13701372
else:
13711373
m = re.match(regex_hg_url, url)
13721374
if m:
13731375
if format == "ssh":
13741376
url = 'ssh://%s/%s' % (m.group(2), m.group(3))
13751377
elif format == "http":
13761378
url = 'http://%s/%s' % (m.group(2), m.group(3))
1377-
else:
1378-
url = 'https://%s/%s' % (m.group(2), m.group(3)) # https is default
1379+
elif format == "https":
1380+
url = 'https://%s/%s' % (m.group(2), m.group(3))
13791381
return url
13801382

13811383

0 commit comments

Comments
 (0)