From bca95d4d190c264ad81348c92962221002862749 Mon Sep 17 00:00:00 2001 From: Rasmus Boll Greve Date: Mon, 22 Jan 2018 13:55:13 +0100 Subject: [PATCH 1/5] Added support for extra git worktrees --- gitall | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitall b/gitall index fa2f6ff..c9217fa 100755 --- a/gitall +++ b/gitall @@ -131,7 +131,7 @@ def get_subdirectories(directory, filter = None): return [i for i in subdirectories if filter(directory + '/' + i)] def isGitDirectory(directory): - return os.path.isdir(directory + '/.git/') + return os.path.isdir(directory + '/.git/') or os.path.isfile(directory + '/.git') def printDelimiter(show): dash = '-' From f1cbcbde8a536505dbf7a8808c2c1ff57d2cecff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kj=C3=A6r=20Hornbjerg?= Date: Tue, 27 Nov 2018 13:25:50 +0100 Subject: [PATCH 2/5] Colors for Windows OS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deleted if statements which only shows colors on non-NT OS. Also, added parentheses to print statements Review: Rasmus B. Greve Signed-off-by: René Kjær Hornbjerg --- gitall | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/gitall b/gitall index c9217fa..96c7a86 100755 --- a/gitall +++ b/gitall @@ -42,7 +42,7 @@ def main(): global verbosity verbosity = 0 - args.quiet + args.verbose if verbosity<-4: - print "If you want it THAT quiet, just pipe everything to /dev/null and be done with it!" + print ("If you want it THAT quiet, just pipe everything to /dev/null and be done with it!") #header printing commandstring = ' '.join(args.operation) @@ -73,10 +73,7 @@ def main(): for gitDirectory in gitDirectories: fullDir = localDir + "/" + gitDirectory os.chdir(fullDir) - if os.name == 'nt': - pinkrepo = os.path.relpath(fullDir, localDir) - else: - pinkrepo = REPO_COLOR + os.path.relpath(fullDir, localDir) + COLOR_STOP + pinkrepo = REPO_COLOR + os.path.relpath(fullDir, localDir) + COLOR_STOP repooutput = v(1, 'Current repo:') + (pinkrepo,) + v(2," in ( "+os.path.abspath('.')+" )") verboseprint(-1, *repooutput) #if date is specified, then use git rev-list to get the sha from the date @@ -110,7 +107,7 @@ def convert_commasep_to_list(include): def verboseprint(fromlevel, *args): if verbosity >= fromlevel: for arg in args: - print arg, + print (arg) print def v(fromlevel, *args): @@ -139,10 +136,7 @@ def printDelimiter(show): dash = "#" if show: dashes = dash * 80 - if os.name == 'nt': - print dashes - else: - print DASH_COLOR + dashes + COLOR_STOP + print DASH_COLOR + dashes + COLOR_STOP if __name__ == '__main__': main() From 99246df1cb0839060a696b49e737f72ed4095e8d Mon Sep 17 00:00:00 2001 From: Rasmus Boll Greve Date: Wed, 29 May 2019 09:52:18 +0200 Subject: [PATCH 3/5] Fix color displaying problems Fix color displaying problems for some combinations of OS version / bash version --- gitall | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gitall b/gitall index 96c7a86..69906bf 100755 --- a/gitall +++ b/gitall @@ -12,6 +12,8 @@ DASH_COLOR = '\033[91m' COLOR_STOP = '\033[0m' def main(): + os.system('') #For some reason this fixes a rarely occuring problem with displaying colors + # Command argument parsing parser = argparse.ArgumentParser( description="Perform a git operation on multiple git repositories in subfolders", From 0b7cea041ad9a682b44e5f15e537a56618269617 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kj=C3=A6r=20Hornbjerg?= Date: Thu, 5 Mar 2020 18:51:11 +0100 Subject: [PATCH 4/5] Added handling for git arguments containing spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: René Kjær Hornbjerg --- gitall | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gitall b/gitall index 69906bf..6ee7599 100755 --- a/gitall +++ b/gitall @@ -47,12 +47,14 @@ def main(): print ("If you want it THAT quiet, just pipe everything to /dev/null and be done with it!") #header printing - commandstring = ' '.join(args.operation) + operation = handleOperationsWithSpaces(args.operation) + commandstring = ' '.join(operation) if not args.raw: commandstring = 'git ' + commandstring localDir = os.path.abspath('.') verboseprint(1, 'Running command:', commandstring) verboseprint(1, 'gitall started in: ',localDir) + verboseprint(1, 'unjoined operation', args.operation) printDelimiter(args.quiet==0 and args.sep) gitDirectories = set() @@ -140,5 +142,14 @@ def printDelimiter(show): dashes = dash * 80 print DASH_COLOR + dashes + COLOR_STOP +def handleOperationsWithSpaces(operations): + result = [] + for op in operations: + if (' ' in op): + result.append("'" + op + "'") + else: + result.append(op) + return result + if __name__ == '__main__': main() From 1b48c24201db72767d929de4ffd0c689ed9853b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kj=C3=A6r=20Hornbjerg?= Date: Thu, 5 Mar 2020 19:11:30 +0100 Subject: [PATCH 5/5] Added handling for git arguments containing spaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: René Kjær Hornbjerg --- gitall | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitall b/gitall index 6ee7599..308feb7 100755 --- a/gitall +++ b/gitall @@ -13,7 +13,7 @@ COLOR_STOP = '\033[0m' def main(): os.system('') #For some reason this fixes a rarely occuring problem with displaying colors - + # Command argument parsing parser = argparse.ArgumentParser( description="Perform a git operation on multiple git repositories in subfolders", @@ -146,7 +146,7 @@ def handleOperationsWithSpaces(operations): result = [] for op in operations: if (' ' in op): - result.append("'" + op + "'") + result.append("\"" + op + "\"") else: result.append(op) return result