@@ -72,27 +72,25 @@ 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 )
83- repo = []
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 )
91-
92- repo .sort ()
93- showDebug ('Done' )
94- return repo
75+ dirs = argopts .get ('searchDir' , [os .path .abspath (os .getcwd ())])
76+ repo = set ()
77+ for curdir in dirs :
78+ if curdir [- 1 :] == '/' :
79+ curdir = curdir [:- 1 ]
80+ showDebug (" Scan git repositories from %s" % curdir )
81+
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 .add (directory )
9591
92+ showDebug ('Done' )
93+ return sorted (repo )
9694
9795# Check state of a git repository
9896def checkRepository (rep , branch ):
@@ -457,7 +455,7 @@ def usage():
457455 print (" -b, --bell bell on action needed" )
458456 print (" -w <sec>, --watch=<sec> after displaying, wait <sec> and run again" )
459457 print (" -i <re>, --ignore-branch=<re> ignore branches matching the regex <re>" )
460- print (" -d <dir>, --dir=<dir> Search <dir> for repositories" )
458+ print (" -d <dir>, --dir=<dir> Search <dir> for repositories (can be used multiple times) " )
461459 print (" -m <maxdepth>, --maxdepth=<maxdepth> Limit the depth of repositories search" )
462460 print (" -q, --quiet Display info only when repository needs action" )
463461 print (" -e, --email Send an email with result as html, using mail.properties parameters" )
@@ -506,7 +504,10 @@ def main():
506504 elif opt in ["-l" , "--localignore" ]:
507505 argopts ['ignoreLocal' ] = arg
508506 elif opt in ["-d" , "--dir" ]:
509- argopts ['searchDir' ] = arg
507+ dirs = argopts .get ('searchDir' , [])
508+ if (dirs == []):
509+ argopts ['searchDir' ] = dirs
510+ dirs .append (arg )
510511 elif opt in ["-m" , '--maxdepth' ]:
511512 try :
512513 argopts ['depth' ] = int (arg )
0 commit comments