@@ -45,6 +45,7 @@ def __init__(self):
4545 self .done = {}
4646 self .options = {}
4747 self .options ['url' ] = (None , "URL to access the repository" )
48+ self .options ['recursive' ] = (False , "Recursively clone repository" )
4849 self .options ['username' ] = (None , "Username required for accessing the repository" )
4950 self .options ['password' ] = (None , "Password required for that user to access the repository" )
5051 self .options ['pwfile' ] = (None , "File where password can be found" )
@@ -91,6 +92,15 @@ def execute(self, log, keyvals, testDef):
9192 log ['stderr' ] = "No repository URL was provided"
9293 return
9394 testDef .logger .verbose_print ("Working repo " + url )
95+ recursive = ""
96+ if cmds ['recursive' ]:
97+ recursive = "--recurse-submodules"
98+ testDef .logger .verbose_print ("Will attempt to recursively cloning repository" )
99+ else :
100+ recursive = ""
101+ testDef .logger .verbose_print ("Will not attempt to recursively cloning repository" )
102+ testDef .logger .verbose_print ("recurisve log: " + recursive )
103+
94104 username = cmds ['username' ]
95105 password = None
96106 # see if they gave us a password
@@ -290,7 +300,11 @@ def execute(self, log, keyvals, testDef):
290300 # and reinstall
291301 if pr is not None :
292302 shutil .rmtree (repo )
293- results = testDef .execmd .execute (cmds , ["git" , "clone" , url ], testDef )
303+ cmd_args = ["git" , "clone" ]
304+ if recursive != "" :
305+ cmd_args .append (recursive )
306+ cmd_args .append (url )
307+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
294308 if 0 != results ['status' ]:
295309 log ['status' ] = results ['status' ]
296310 log ['stderr' ] = "Cannot clone repository {0}" .format (repo )
@@ -366,7 +380,11 @@ def execute(self, log, keyvals, testDef):
366380 # we need to whack the current installation and reinstall it
367381 os .chdir (dst )
368382 shutil .rmtree (repo )
369- results = testDef .execmd .execute (cmds , ["git" , "clone" , "-b" , branch , "--single-branch" , url ], testDef )
383+ cmd_args = ["git" , "clone" , "-b" , branch , "--single-branch" ]
384+ if recursive != "" :
385+ cmd_args .append (recursive )
386+ cmd_args .append (url )
387+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
370388 if 0 != results ['status' ]:
371389 log ['status' ] = results ['status' ]
372390 log ['stderr' ] = "Cannot clone repository branch {0}" .format (repo )
@@ -435,7 +453,11 @@ def execute(self, log, keyvals, testDef):
435453 # we need to whack the current installation and reinstall it
436454 os .chdir (dst )
437455 shutil .rmtree (repo )
438- results = testDef .execmd .execute (cmds , ["git" , "clone" , "--no-checkout" , url ], testDef )
456+ cmd_args = ["git" , "clone" , "--no-checkout" ]
457+ if recursive != "" :
458+ cmd_args .append (recursive )
459+ cmd_args .append (url )
460+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
439461 if 0 != results ['status' ]:
440462 log ['status' ] = results ['status' ]
441463 log ['stderr' ] = "Cannot clone repository {0}" .format (repo )
@@ -503,15 +525,23 @@ def execute(self, log, keyvals, testDef):
503525 else :
504526 # clone it
505527 if branch is not None :
506- results = testDef .execmd .execute (cmds , ["git" , "clone" , "-b" , branch , "--single-branch" , url ], testDef )
528+ cmd_args = ["git" , "clone" , "-b" , branch , "--single-branch" ]
529+ if recursive != "" :
530+ cmd_args .append (recursive )
531+ cmd_args .append (url )
532+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
507533 if 0 != results ['status' ]:
508534 log ['status' ] = results ['status' ]
509535 log ['stderr' ] = results ['stderr' ]
510536 log ['stdout' ] = results ['stdout' ]
511537 os .chdir (cwd )
512538 continue
513539 elif commit is not None :
514- results = testDef .execmd .execute (cmds , ["git" , "clone" , "--no-checkout" , url ], testDef )
540+ cmd_args = ["git" , "clone" , "--no-checkout" ]
541+ if recursive != "" :
542+ cmd_args .append (recursive )
543+ cmd_args .append (url )
544+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
515545 if 0 != results ['status' ]:
516546 log ['status' ] = results ['status' ]
517547 log ['stderr' ] = "Cannot clone repository {0}" .format (repo )
@@ -536,7 +566,11 @@ def execute(self, log, keyvals, testDef):
536566 os .chdir (cwd )
537567 continue
538568 elif pr is not None :
539- results = testDef .execmd .execute (cmds , ["git" , "clone" , url ], testDef )
569+ cmd_args = ["git" , "clone" ]
570+ if recursive != "" :
571+ cmd_args .append (recursive )
572+ cmd_args .append (url )
573+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
540574 if 0 != results ['status' ]:
541575 log ['status' ] = results ['status' ]
542576 log ['stderr' ] = "Cannot clone repository {0}" .format (repo )
@@ -578,7 +612,11 @@ def execute(self, log, keyvals, testDef):
578612 os .chdir (cwd )
579613 continue
580614 else :
581- results = testDef .execmd .execute (cmds , ["git" , "clone" , url ], testDef )
615+ cmd_args = ["git" , "clone" ]
616+ if recursive != "" :
617+ cmd_args .append (recursive )
618+ cmd_args .append (url )
619+ results = testDef .execmd .execute (cmds , cmd_args , testDef )
582620 if 0 != results ['status' ]:
583621 log ['status' ] = results ['status' ]
584622 log ['stderr' ] = results ['stderr' ]
0 commit comments