@@ -72,22 +72,22 @@ def showDebug(mess, level='info'):
7272# Search all local repositories from current directory
7373def searchRepositories ():
7474 showDebug ('Beginning scan... building list of git folders' )
75- dir = argopts .get ('searchDir' , None )
76- if dir is not None and dir [- 1 :] == '/' :
77- dir = dir [:- 1 ]
78- curdir = os .path .abspath (os .getcwd ()) if dir is None else dir
79- showDebug (" Scan git repositories from %s" % curdir )
80-
81- html .path = curdir
82- startinglevel = curdir .count (os .sep )
75+ dirs = argopts .get ('searchDir' , [os .path .abspath (os .getcwd ())])
8376 repo = []
77+ for curdir in dirs :
78+ if curdir [- 1 :] == '/' :
79+ curdir = curdir [:- 1 ]
80+ showDebug (" Scan git repositories from %s" % curdir )
8481
85- for directory , dirnames , filenames in os .walk (curdir ):
86- level = directory .count (os .sep ) - startinglevel
87- if argopts .get ('depth' , None ) is None or level <= argopts .get ('depth' , None ):
88- if '.git' in dirnames :
89- showDebug (" Add %s repository" % directory )
90- repo .append (directory )
82+ html .path = curdir
83+ startinglevel = curdir .count (os .sep )
84+
85+ for directory , dirnames , filenames in os .walk (curdir ):
86+ level = directory .count (os .sep ) - startinglevel
87+ if argopts .get ('depth' , None ) is None or level <= argopts .get ('depth' , None ):
88+ if '.git' in dirnames :
89+ showDebug (" Add %s repository" % directory )
90+ repo .append (directory )
9191
9292 repo .sort ()
9393 showDebug ('Done' )
@@ -457,7 +457,7 @@ def usage():
457457 print (" -b, --bell bell on action needed" )
458458 print (" -w <sec>, --watch=<sec> after displaying, wait <sec> and run again" )
459459 print (" -i <re>, --ignore-branch=<re> ignore branches matching the regex <re>" )
460- print (" -d <dir>, --dir=<dir> Search <dir> for repositories" )
460+ print (" -d <dir>, --dir=<dir> Search <dir> for repositories (can be used multiple times) " )
461461 print (" -m <maxdepth>, --maxdepth=<maxdepth> Limit the depth of repositories search" )
462462 print (" -q, --quiet Display info only when repository needs action" )
463463 print (" -e, --email Send an email with result as html, using mail.properties parameters" )
@@ -506,7 +506,10 @@ def main():
506506 elif opt in ["-l" , "--localignore" ]:
507507 argopts ['ignoreLocal' ] = arg
508508 elif opt in ["-d" , "--dir" ]:
509- argopts ['searchDir' ] = arg
509+ dirs = argopts .get ('searchDir' , [])
510+ if (dirs == []):
511+ argopts ['searchDir' ] = dirs
512+ dirs .append (arg )
510513 elif opt in ["-m" , '--maxdepth' ]:
511514 try :
512515 argopts ['depth' ] = int (arg )
0 commit comments