|
35 | 35 |
|
36 | 36 |
|
37 | 37 | # Application version
|
38 |
| -ver = '0.8.0' |
| 38 | +ver = '0.8.1' |
39 | 39 |
|
40 | 40 | # Default paths to Mercurial and Git
|
41 | 41 | hg_cmd = 'hg'
|
@@ -688,7 +688,10 @@ def getrev():
|
688 | 688 |
|
689 | 689 | # Gets current branch or returns empty string if detached
|
690 | 690 | def getbranch():
|
691 |
| - branch = pquery([git_cmd, 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD']).strip() |
| 691 | + try: |
| 692 | + branch = pquery([git_cmd, 'rev-parse', '--symbolic-full-name', '--abbrev-ref', 'HEAD']).strip() |
| 693 | + except ProcessException: |
| 694 | + branch = "master" |
692 | 695 | return branch if branch != "HEAD" else ""
|
693 | 696 |
|
694 | 697 | # Finds refs (local or remote branches). Will match rev if specified
|
@@ -1023,10 +1026,12 @@ def write(self):
|
1023 | 1026 | #print self.name, 'unmodified'
|
1024 | 1027 | return
|
1025 | 1028 |
|
1026 |
| - action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, self.fullurl)) |
1027 |
| - |
| 1029 | + ref = (formaturl(self.url, 'https').rstrip('/') + '/' + |
| 1030 | + (('' if self.is_build else '#') + |
| 1031 | + self.rev if self.rev else '')) |
| 1032 | + action("Updating reference \"%s\" -> \"%s\"" % (relpath(cwd_root, self.path) if cwd_root != self.path else self.name, ref)) |
1028 | 1033 | with open(self.lib, 'wb') as f:
|
1029 |
| - f.write(self.fullurl + '\n') |
| 1034 | + f.write(ref + '\n') |
1030 | 1035 |
|
1031 | 1036 | def rm_untracked(self):
|
1032 | 1037 | untracked = self.scm.untracked()
|
@@ -1365,17 +1370,17 @@ def formaturl(url, format="default"):
|
1365 | 1370 | url = 'ssh://%s/%s.git' % (m.group(2), m.group(3))
|
1366 | 1371 | elif format == "http":
|
1367 | 1372 | 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 |
| 1373 | + elif format == "https": |
| 1374 | + url = 'https://%s/%s' % (m.group(2), m.group(3)) |
1370 | 1375 | else:
|
1371 | 1376 | m = re.match(regex_hg_url, url)
|
1372 | 1377 | if m:
|
1373 | 1378 | if format == "ssh":
|
1374 | 1379 | url = 'ssh://%s/%s' % (m.group(2), m.group(3))
|
1375 | 1380 | elif format == "http":
|
1376 | 1381 | 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 |
| 1382 | + elif format == "https": |
| 1383 | + url = 'https://%s/%s' % (m.group(2), m.group(3)) |
1379 | 1384 | return url
|
1380 | 1385 |
|
1381 | 1386 |
|
@@ -2177,18 +2182,27 @@ def config_(var, value=None, global_cfg=False, unset=False):
|
2177 | 2182 | @subcommand('target',
|
2178 | 2183 | dict(name='name', nargs='?', help='Default target name. Example: K64F, NUCLEO_F401RE, NRF51822...'),
|
2179 | 2184 | dict(name=['-G', '--global'], dest='global_cfg', action='store_true', help='Use global settings, not local'),
|
| 2185 | + dict(name=['-S', '--supported'], dest='supported', action='store_true', help='Shows supported matrix of targets and toolchains'), |
2180 | 2186 | help='Set or get default target',
|
2181 | 2187 | description=(
|
2182 |
| - "This is an alias to 'mbed config target [--global] [name]'\n")) |
2183 |
| -def target_(name=None, global_cfg=False): |
| 2188 | + "Set or get default toolchain\n" |
| 2189 | + "This is an alias to 'mbed config [--global] target [name]'\n")) |
| 2190 | +def target_(name=None, global_cfg=False, supported=False): |
| 2191 | + if supported: |
| 2192 | + return compile_(supported=supported) |
2184 | 2193 | return config_('target', name, global_cfg=global_cfg)
|
2185 | 2194 |
|
2186 | 2195 | @subcommand('toolchain',
|
2187 | 2196 | dict(name='name', nargs='?', help='Default toolchain name. Example: ARM, uARM, GCC_ARM, IAR'),
|
| 2197 | + dict(name=['-G', '--global'], dest='global_cfg', action='store_true', help='Use global settings, not local'), |
| 2198 | + dict(name=['-S', '--supported'], dest='supported', action='store_true', help='Shows supported matrix of targets and toolchains'), |
2188 | 2199 | help='Set or get default toolchain\n\n',
|
2189 | 2200 | description=(
|
2190 |
| - "This is an alias to 'mbed config toolchain [--global] [name]'\n")) |
2191 |
| -def toolchain_(name=None, global_cfg=False): |
| 2201 | + "Set or get default toolchain\n" |
| 2202 | + "This is an alias to 'mbed config [--global] toolchain [name]'\n")) |
| 2203 | +def toolchain_(name=None, global_cfg=False, supported=False): |
| 2204 | + if supported: |
| 2205 | + return compile_(supported=supported) |
2192 | 2206 | return config_('toolchain', name, global_cfg=global_cfg)
|
2193 | 2207 |
|
2194 | 2208 | @subcommand('help',
|
|
0 commit comments