Commit 9e81abfe authored by Elouan Martinet's avatar Elouan Martinet
Browse files

Add cmd_lines function which runs a command and returns output lines

parent 5eb388b58e67
...@@ -29,6 +29,11 @@ def cmd(description, *args, **kwargs): ...@@ -29,6 +29,11 @@ def cmd(description, *args, **kwargs):
raise raise
def cmd_lines(*args, **kwargs):
output = check_output(*args, **kwargs)
return output.decode("utf-8").splitlines()
def git_clone(path_url, destination): def git_clone(path_url, destination):
cmd( cmd(
"Cloning Git fork repository", ["git", "clone", path_url, destination, "--bare"] "Cloning Git fork repository", ["git", "clone", path_url, destination, "--bare"]
...@@ -105,11 +110,11 @@ def _gfclone(git_fork_url, git_upstream_url, destination): ...@@ -105,11 +110,11 @@ def _gfclone(git_fork_url, git_upstream_url, destination):
def _gfpull(git_repo): def _gfpull(git_repo):
branches = check_output( branches = cmd_lines(
["git", "branch", "--format=%(refname:lstrip=2)"], cwd=git_repo ["git", "branch", "--format=%(refname:lstrip=2)"], cwd=git_repo
) )
git_pull_master(git_repo) git_pull_master(git_repo)
for branch in branches.decode("utf-8").splitlines(): for branch in branches:
if branch != "master": if branch != "master":
try: try:
cmd( cmd(
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment