Skip to content

Instantly share code, notes, and snippets.

@kogakure
Created December 9, 2008 17:19
Show Gist options
  • Save kogakure/33977 to your computer and use it in GitHub Desktop.
Save kogakure/33977 to your computer and use it in GitHub Desktop.
Python: Commits all Git and Git-SVN repositories
#!/usr/env/python
import os
import os.path
from subprocess import call
if __name__ == "__main__":
apps_dir = os.path.abspath('.')
for app_name in os.listdir(apps_dir):
app_dir = os.path.abspath(os.path.join(apps_dir, app_name))
git_path = os.path.join(app_dir, '.git')
svn_path = os.path.join(app_dir, '.svn')
if os.path.lexists(svn_path):
print ""
print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
print ""
print "Updating svn %s" % app_dir
os.chdir(app_dir)
call(['svn', 'update'])
elif os.path.lexists(git_path):
print ""
print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
print ""
print "Updating git %s" % app_dir
os.chdir(app_dir)
call(['git', 'svn', 'dcommit'])
else:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment