You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.3 KiB

10 years ago
from sh import git, ErrorReturnCode
import os
10 years ago
class EEGit:
"""Intialization of core variables"""
def ___init__():
# TODO method for core variables
pass
10 years ago
10 years ago
def add(self, paths, msg="Intializating"):
10 years ago
for path in paths:
10 years ago
global git
git = git.bake("--git-dir={0}/.git".format(path),
"--work-tree={0}".format(path))
10 years ago
if os.path.isdir(path):
if not os.path.isdir(path+"/.git"):
try:
10 years ago
self.app.log.debug("EEGit: git init at {0}"
.format(path))
10 years ago
git.init(path)
except ErrorReturnCode as e:
10 years ago
self.app.log.error(e)
10 years ago
sys.exit(1)
status = git.status("-s")
if len(status.splitlines()) > 0:
try:
10 years ago
self.app.log.debug("EEGit: git commit at {0}"
.format(path))
10 years ago
git.add("--all")
git.commit("-am {0}".format(msg))
except ErrorReturnCode as e:
10 years ago
self.app.log.error(e)
10 years ago
sys.exit(1)
10 years ago
else:
self.app.log.debug("EEGit: Path {0} not present".format(path))