@@ -251,7 +251,7 @@ def init(path, url):
251
251
with cd (path ):
252
252
Bld .seturl (url )
253
253
254
- def clone (url , path = None , depth = None , protocol = None , cache = None ):
254
+ def clone (url , path = None , depth = None , protocol = None ):
255
255
m = Bld .isurl (url )
256
256
if not m :
257
257
raise ProcessException (1 , "Not an mbed library build URL" )
@@ -364,24 +364,8 @@ def isurl(url):
364
364
def init (path = None ):
365
365
popen ([hg_cmd , 'init' ] + ([path ] if path else []) + (['-v' ] if verbose else ['-q' ]))
366
366
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' ]))
385
369
386
370
def add (dest ):
387
371
log ("Adding reference \" %s\" " % dest )
@@ -547,9 +531,8 @@ def isurl(url):
547
531
def init (path = None ):
548
532
popen ([git_cmd , 'init' ] + ([path ] if path else []) + ([] if verbose else ['-q' ]))
549
533
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' ]))
553
536
554
537
def add (dest ):
555
538
log ("Adding reference " + dest )
@@ -971,8 +954,18 @@ def clone(self, url, path, depth=None, protocol=None, **kwargs):
971
954
# Try to clone with cache ref first
972
955
if cache :
973
956
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 )
976
969
except ProcessException , e :
977
970
if os .path .isdir (path ):
978
971
rmtree_readonly (path )
0 commit comments