Created
August 15, 2014 21:31
-
-
Save jflefebvre/a3299e0468e3a0f68495 to your computer and use it in GitHub Desktop.
Scan all folders and extract git log if folder contains a git project and save the log file in gitlogs (put the scripts in your www containing all your projects folders)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import fnmatch | |
import string | |
import os, sys, time | |
import subprocess | |
def isUnderGit(): | |
curPath = os.getcwd() | |
if os.path.exists(curPath+'/.git'): | |
return True | |
else: | |
return False | |
base_path = os.getcwd() | |
os.chdir(base_path) | |
for f in os.listdir(base_path): | |
if os.path.isdir(os.path.join(base_path, f)): | |
curDir = os.path.join(base_path, f) | |
os.chdir(curDir) | |
#print curDir | |
isGitFound = isUnderGit() | |
if (isGitFound): | |
# print curDir | |
command = 'git --git-dir '+curDir+'/.git log > '+base_path+'/gitlogs/'+f+'.log' | |
print command | |
subprocess.Popen(command, stdout=subprocess.PIPE, shell = True) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment