Skip to content

Commit 7684ea1

Browse files
committed
Replace the git --reference <path> --dissociate with carbon copy due to incompatibility with Git < 2.3
1 parent e980e68 commit 7684ea1

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

mbed/mbed.py

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def init(path, url):
251251
with cd(path):
252252
Bld.seturl(url)
253253

254-
def clone(url, path=None, depth=None, protocol=None, cache=None):
254+
def clone(url, path=None, depth=None, protocol=None):
255255
m = Bld.isurl(url)
256256
if not m:
257257
raise ProcessException(1, "Not an mbed library build URL")
@@ -364,24 +364,8 @@ def isurl(url):
364364
def init(path=None):
365365
popen([hg_cmd, 'init'] + ([path] if path else []) + (['-v'] if verbose else ['-q']))
366366

367-
def clone(url, name=None, depth=None, protocol=None, cache=None):
368-
main = True
369-
370-
if cache and not os.path.isdir(name):
371-
if not os.path.isdir(os.path.split(name)[0]):
372-
os.makedirs(os.path.split(name)[0])
373-
shutil.copytree(cache, name)
374-
375-
try:
376-
with cd(name):
377-
Hg.update(None, True)
378-
main = False
379-
except ProcessException:
380-
if os.path.exists(name):
381-
rmtree_readonly(name)
382-
383-
if main:
384-
popen([hg_cmd, 'clone', formaturl(url, protocol), name] + (['-v'] if verbose else ['-q']))
367+
def clone(url, name=None, depth=None, protocol=None):
368+
popen([hg_cmd, 'clone', formaturl(url, protocol), name] + (['-v'] if verbose else ['-q']))
385369

386370
def add(dest):
387371
log("Adding reference \"%s\"" % dest)
@@ -547,9 +531,8 @@ def isurl(url):
547531
def init(path=None):
548532
popen([git_cmd, 'init'] + ([path] if path else []) + ([] if verbose else ['-q']))
549533

550-
def clone(url, name=None, depth=None, protocol=None, cache=None):
551-
popen([git_cmd, 'clone', formaturl(url, protocol), name] + (['--depth', depth] if depth else []) +
552-
(['--reference', cache, '--dissociate'] if cache else []) + (['-v'] if verbose else ['-q']))
534+
def clone(url, name=None, depth=None, protocol=None):
535+
popen([git_cmd, 'clone', formaturl(url, protocol), name] + (['--depth', depth] if depth else []) + (['-v'] if verbose else ['-q']))
553536

554537
def add(dest):
555538
log("Adding reference "+dest)
@@ -971,8 +954,18 @@ def clone(self, url, path, depth=None, protocol=None, **kwargs):
971954
# Try to clone with cache ref first
972955
if cache:
973956
try:
974-
scm.clone(url, path, depth=depth, protocol=protocol, cache=cache, **kwargs)
975-
main = False
957+
if not os.path.isdir(path):
958+
if not os.path.isdir(os.path.split(path)[0]):
959+
os.makedirs(os.path.split(path)[0])
960+
shutil.copytree(cache, path)
961+
962+
try:
963+
with cd(path):
964+
scm.update(None, True)
965+
main = False
966+
except ProcessException:
967+
if os.path.exists(path):
968+
rmtree_readonly(path)
976969
except ProcessException, e:
977970
if os.path.isdir(path):
978971
rmtree_readonly(path)

0 commit comments

Comments
 (0)