@@ -281,7 +281,7 @@ def cleanup():
281
281
else :
282
282
shutil .rmtree (fl )
283
283
284
- def clone (url , path = None , rev = None , depth = None , protocol = None ):
284
+ def clone (url , path = None , depth = None , protocol = None ):
285
285
m = Bld .isurl (url )
286
286
if not m :
287
287
raise ProcessException (1 , "Not a library build URL" )
@@ -395,7 +395,7 @@ def init(path=None):
395
395
def cleanup ():
396
396
return True
397
397
398
- def clone (url , name = None , rev = None , depth = None , protocol = None ):
398
+ def clone (url , name = None , depth = None , protocol = None ):
399
399
popen ([hg_cmd , 'clone' , formaturl (url , protocol ), name ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
400
400
401
401
def add (dest ):
@@ -607,24 +607,8 @@ def cleanup():
607
607
for branch in branches : # delete all local branches so the new repo clone is not poluted
608
608
pquery ([git_cmd , 'branch' , '-D' , branch ])
609
609
610
- def clone (url , path , rev = None , depth = None , protocol = None , name = None ):
611
- result = pquery ([git_cmd , "ls-remote" , url , (rev if rev else "HEAD" )])
612
-
613
- if result and rev :
614
- repo_name = url .split ('/' )[- 1 ]
615
- if '.git' in repo_name :
616
- repo_name = repo_name [:- 4 ]
617
-
618
- os .mkdir (repo_name )
619
-
620
- with cd (repo_name ):
621
- Git .init ()
622
- Git .fetch (url = url , rev = rev , depth = depth )
623
- Git .checkout ('FETCH_HEAD' )
624
- popen ([git_cmd , 'remote' , 'add' , 'origin' , url ])
625
-
626
- else :
627
- popen ([git_cmd , 'clone' , formaturl (url , protocol ), path ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
610
+ def clone (url , name = None , depth = None , protocol = None ):
611
+ popen ([git_cmd , 'clone' , formaturl (url , protocol ), name ] + (['--depth' , depth ] if depth else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
628
612
629
613
def add (dest ):
630
614
info ("Adding reference " + dest )
@@ -658,12 +642,9 @@ def publish(all_refs=None):
658
642
if not branch :
659
643
error (err + "Working set is not on a branch." , 1 )
660
644
661
- def fetch (url = None , rev = None , depth = None ):
645
+ def fetch ():
662
646
info ("Fetching revisions from remote repository to \" %s\" " % os .path .basename (os .getcwd ()))
663
- if url :
664
- popen ([git_cmd , 'fetch' , '--tags' ] + ([url ] if url else []) + ([rev ] if rev else []) + (["--depth" , depth ] if depth else []) + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
665
- else :
666
- popen ([git_cmd , 'fetch' , '--tags' , '--all' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
647
+ popen ([git_cmd , 'fetch' , '--all' , '--tags' ] + (['-v' ] if very_verbose else ([] if verbose else ['-q' ])))
667
648
668
649
def discard (clean_files = False ):
669
650
info ("Discarding local changes in \" %s\" " % os .path .basename (os .getcwd ()))
@@ -1117,7 +1098,7 @@ def clone(self, url, path, rev=None, depth=None, protocol=None, **kwargs):
1117
1098
# Main clone routine if the clone with cache ref failed (might occur if cache ref is dirty)
1118
1099
if main :
1119
1100
try :
1120
- scm .clone (url , path , rev = rev , depth = depth , protocol = protocol , ** kwargs )
1101
+ scm .clone (url , path , depth = depth , protocol = protocol , ** kwargs )
1121
1102
except ProcessException :
1122
1103
if os .path .isdir (path ):
1123
1104
rmtree_readonly (path )
@@ -1805,7 +1786,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, top=True):
1805
1786
with cd (repo .path ):
1806
1787
Program (repo .path ).set_root ()
1807
1788
try :
1808
- if repo .rev and repo .getrev () != repo .rev and not depth :
1789
+ if repo .rev and repo .getrev () != repo .rev :
1809
1790
repo .checkout (repo .rev , True )
1810
1791
except ProcessException as e :
1811
1792
err = "Unable to update \" %s\" to %s" % (repo .name , repo .revtype (repo .rev , True ))
0 commit comments