Skip to content

Commit

Permalink
Added CreateBranch method (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
kiddinn authored and Onager committed Nov 21, 2018
1 parent 5a6e7dd commit d84e758
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion l2tscaffolder/helpers/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def HasBranch(self, branch_name: str) -> bool:
"""
command = 'git show-ref --verify --quiet refs/heads/"{0:s}"'.format(
branch_name)
exit_code, output, error = self.RunCommand(command)
exit_code, _, _ = self.RunCommand(command)
if exit_code == 0:
return True

Expand Down Expand Up @@ -128,3 +128,17 @@ def SwitchToBranch(self, branch: str) -> int:
exit_code, _, _ = self.RunCommand(command)

return exit_code

def CreateBranch(self, branch: str) -> int:
"""Creates a git branch and returns the exit code of the command.
Arguments:
branch (str): the name of the git branch.
Returns:
int: the exit code from the git command.
"""
command = 'git branch {0:s}'.format(branch)
exit_code, _, _ = self.RunCommand(command)

return exit_code

0 comments on commit d84e758

Please sign in to comment.