def push(self, remote='origin', branch='master'): cmd = "%s push --porcelain %s %s" % (GIT, remote, branch) stdout,stderr = exec_cmd(cmd, self.repo_directory) if ('[rejected]' in stdout or 'fatal' in stderr): return NOT_OK,stderr return OK,stdout
def pull(self, remote='origin', branch='master'): cmd = "%s pull %s %s" % (GIT, remote, branch) stdout,stderr = exec_cmd(cmd, self.repo_directory) if ('conflict' in stdout): return NOT_OK,stdout return OK,stdout
def commit_all(self, message): cmd = "%s commit --all -m \"%s\"" % (GIT, message) stdout,stderr = exec_cmd(cmd, self.repo_directory) if (stderr != ''): return NOT_OK,stderr return OK,stdout
def add(self, filename='.'): cmd = "%s add %s" % (GIT, filename) stdout,stderr = exec_cmd(cmd, self.repo_directory) if (stderr != ''): return NOT_OK,stderr return OK,stdout
def diff(self): cmd = "%s diff --porcelain" % GIT stdout,stderr = exec_cmd(cmd, self.repo_directory) return self._parse_diff(stdout, stderr)
def status(self): cmd = "%s status --porcelain -uall" % GIT stdout,stderr = exec_cmd(cmd, self.repo_directory) return self._parse_status(stdout, stderr)