pushgits 699 B

123456789101112131415161718192021222324
  1. #!/usr/bin/python
  2. import sys, os
  3. import ConfigParser, re
  4. from git import *
  5. config = ConfigParser.ConfigParser()
  6. config.read(os.path.expanduser(os.path.join('~', '.gitrepolist')))
  7. repos = re.split(',', config.get('repos', 'list'))
  8. if len(sys.argv) > 1:
  9. repodir = config.get(sys.argv[1], 'directory')
  10. print("Pushing Repository " + sys.argv[1] + " Location: " + repodir)
  11. repo = Repo(repodir)
  12. repo.remotes.origin.push()
  13. else:
  14. for reponame in repos:
  15. repodir = config.get(reponame, 'directory')
  16. # branch = config.get(reponame, 'branch')
  17. print("Pushing repository: " + reponame + ", Location: " + repodir)
  18. repo = Repo(repodir)
  19. repo.remotes.origin.push()