Minor improvement in the git function

This commit is contained in:
Thibault Saunier 2016-10-11 02:05:39 +02:00
parent 1b6d719d54
commit 6a1d489cc5
3 changed files with 8 additions and 13 deletions

View file

@ -34,11 +34,6 @@ class Colors:
def git(args, repository_path):
if not isinstance(args, list):
args = [args]
return subprocess.check_output(["git"] + args, cwd=repository_path,
def git(*args, repository_path='.'):
return subprocess.check_output(["git"] + list(args), cwd=repository_path,
stderr=subprocess.STDOUT).decode()

4
configure vendored
View file

@ -17,9 +17,9 @@ ROOTDIR = os.path.abspath(os.path.dirname(__file__))
def get_meson():
print("Updating meson submodule...", end='')
print("Updating meson submodule... ", end='')
sys.stdout.flush()
git(['submodule', 'update', '--init'], ROOTDIR)
git('submodule', 'update', '--init', repository_path=ROOTDIR)
print("DONE")
return os.path.join(ROOTDIR, 'meson', 'meson.py')

View file

@ -43,10 +43,10 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, recurse_i=0):
print("Updating %s..." % repo_name)
try:
if revision:
git(["fetch"], repo_dir)
git(["checkout", revision], repo_dir)
git("fetch", repository_path=repo_dir)
git("checkout", revision, repository_path=repo_dir)
else:
git(["pull", "--rebase"], repo_dir)
git("pull", "--rebase", repository_path=repo_dir)
except Exception as e:
out = getattr(e, "output", b"").decode()
if not no_interaction:
@ -73,7 +73,7 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, recurse_i=0):
return False
commit_message = git("show", repo_dir).split("\n")
commit_message = git("show", repository_path=repo_dir).split("\n")
print(u" -> %s%s%s — %s" % (Colors.HEADER, commit_message[0][7:14], Colors.ENDC,
commit_message[4].strip()))