Return stdout from git_repository functions

This commit is contained in:
bom 2023-02-23 16:30:43 +01:00
parent 4a23b0b800
commit a109759c68

View file

@ -42,21 +42,28 @@ class GitRepository():
def tag_annotated(self, annotation: str, message: str): def tag_annotated(self, annotation: str, message: str):
self.system_repository.run_checked('git', 'tag', '-a', annotation, '-m', message) self.system_repository.run_checked('git', 'tag', '-a', annotation, '-m', message)
return self.system_repository.stdout
def tag_annotated(self, annotation: str, message: str, count: int): def tag_annotated(self, annotation: str, message: str, count: int):
self.system_repository.run_checked('git', 'tag', '-a', annotation, '-m', message, f'HEAD~{count}') self.system_repository.run_checked('git', 'tag', '-a', annotation, '-m', message, f'HEAD~{count}')
return self.system_repository.stdout
def get_current_branch(self): def get_current_branch(self):
self.system_repository.run_checked('git', 'branch', '--show-current') self.system_repository.run_checked('git', 'branch', '--show-current')
return ''.join(self.system_repository.stdout).rstrip()
def add_file(self, file_path: Path): def add_file(self, file_path: Path):
self.system_repository.run_checked('git', 'add', file_path) self.system_repository.run_checked('git', 'add', file_path)
return self.system_repository.stdout
def commit(self, commit_message: str): def commit(self, commit_message: str):
self.system_repository.run_checked('git', 'commit', '-m', commit_message) self.system_repository.run_checked('git', 'commit', '-m', commit_message)
return self.system_repository.stdout
def push(self): def push(self):
self.system_repository.run_checked('git', 'push') self.system_repository.run_checked('git', 'push')
return self.system_repository.stdout
def checkout(self, branch: str): def checkout(self, branch: str):
self.system_repository.run_checked('git', 'checkout', branch) self.system_repository.run_checked('git', 'checkout', branch)
return self.system_repository.stdout