def init(self): """ Creates a new git repository. """ self._chdir() utils.silence( subprocess.call, ('E:/Program Files/Git/bin/git.exe', 'init') )
def clone_from(self, source_path): """ Clone the repository to the destination path """ # Will raise an exception if unsuccessful utils.silence( subprocess.check_call, ('E:/Program Files/Git/bin/git.exe', 'clone', source_path, self.repo_path) ) return True
def push(self): utils.silence( subprocess.call, ( 'E:/Program Files/Git/bin/git.exe', 'push' ), )
def checkout(self,branch): utils.silence( subprocess.call, ( 'E:/Program Files/Git/bin/git.exe', 'checkout', branch, ) )
def commit(self, author, message): """ Perform the commit """ # NOTE: user format: 'Lyndsy Simon <*****@*****.**' utils.silence( subprocess.call, ( 'E:/Program Files/Git/bin/git.exe', 'commit', '--author="{}"'.format(author), '-m "{}"'.format(message) ), )
def _rm_file(self, file_path): utils.silence(subprocess.call, ('git', 'rm', file_path))
def _stage_file(self, file_path): utils.silence(subprocess.call, ('E:/Program Files/Git/bin/git.exe', 'add', file_path))
def _unstage_file(self, file_path): """ Removes a file from the pending commit """ utils.silence(subprocess.call, ('git', 'rm', '--cached', file_path))