@@ -265,6 +265,15 @@ def init(path):
265
265
if not os .path .exists (path ):
266
266
os .mkdir (path )
267
267
268
+ def cleanup ():
269
+ info ("Cleaning up library build folder" )
270
+ for fl in os .listdir ('.' ):
271
+ if not fl .startswith ('.' ):
272
+ if os .path .isfile (fl ):
273
+ os .remove (fl )
274
+ else :
275
+ shutil .rmtree (fl )
276
+
268
277
def clone (url , path = None , depth = None , protocol = None ):
269
278
m = Bld .isurl (url )
270
279
if not m :
@@ -277,15 +286,6 @@ def clone(url, path=None, depth=None, protocol=None):
277
286
except Exception as e :
278
287
error (e [1 ], e [0 ])
279
288
280
- def cleanup ():
281
- info ("Cleaning up library build folder" )
282
- for fl in os .listdir ('.' ):
283
- if not fl .startswith ('.' ):
284
- if os .path .isfile (fl ):
285
- os .remove (fl )
286
- else :
287
- shutil .rmtree (fl )
288
-
289
289
def fetch_rev (url , rev ):
290
290
rev_file = os .path .join ('.' + Bld .name , '.rev-' + rev + '.zip' )
291
291
try :
@@ -384,6 +384,9 @@ def isurl(url):
384
384
def init (path = None ):
385
385
popen ([hg_cmd , 'init' ] + ([path ] if path else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
386
386
387
+ def cleanup ():
388
+ return True
389
+
387
390
def clone (url , name = None , depth = None , protocol = None ):
388
391
popen ([hg_cmd , 'clone' , formaturl (url , protocol ), name ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
389
392
@@ -581,6 +584,11 @@ def isurl(url):
581
584
def init (path = None ):
582
585
popen ([git_cmd , 'init' ] + ([path ] if path else []) + ([] if very_verbose else ['-q' ]))
583
586
587
+ def cleanup ():
588
+ info ("Cleaning up Git index" )
589
+ if os .path .exists (os .path .join ('.git' , 'logs' )):
590
+ rmtree_readonly (os .path .join ('.git' , 'logs' ))
591
+
584
592
def clone (url , name = None , depth = None , protocol = None ):
585
593
popen ([git_cmd , 'clone' , formaturl (url , protocol ), name ] + (['--depth' , depth ] if depth else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
586
594
@@ -1046,6 +1054,7 @@ def clone(self, url, path, rev=None, depth=None, protocol=None, **kwargs):
1046
1054
1047
1055
with cd (path ):
1048
1056
scm .seturl (formaturl (url , protocol ))
1057
+ scm .cleanup ()
1049
1058
info ("Update cached copy from remote repository" )
1050
1059
scm .update (rev , True )
1051
1060
main = False
0 commit comments