Skip to content

Commit b82671f

Browse files
committed
Use the default branch for each SCM if no commit or branch is specified
1 parent 18325e8 commit b82671f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mbed/mbed.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def _scm(cls):
254254
@staticclass
255255
class Bld(object):
256256
name = 'bld'
257+
def_branch = 'default'
257258

258259
def isurl(url):
259260
m_url = re.match(regex_url_ref, url.strip().replace('\\', '/'))
@@ -373,6 +374,7 @@ def getbranch():
373374
@staticclass
374375
class Hg(object):
375376
name = 'hg'
377+
def_branch = 'default'
376378
ignore_file = os.path.join('.hg', 'hgignore')
377379

378380
def isurl(url):
@@ -573,6 +575,7 @@ def unignore(dest):
573575
@staticclass
574576
class Git(object):
575577
name = 'git'
578+
def_branch = 'master'
576579
ignore_file = os.path.join('.git', 'info', 'exclude')
577580

578581
def isurl(url):
@@ -1078,6 +1081,8 @@ def clone(self, url, path, rev=None, depth=None, protocol=None, **kwargs):
10781081
scm.seturl(formaturl(url, protocol))
10791082
scm.cleanup()
10801083
info("Update cached copy from remote repository")
1084+
if not rev:
1085+
rev = scm.def_branch
10811086
scm.update(rev, True)
10821087
main = False
10831088
except (ProcessException, IOError):

0 commit comments

Comments
 (0)