Minor improvement in the git function
This commit is contained in:
parent
1b6d719d54
commit
6a1d489cc5
@ -34,11 +34,6 @@ class Colors:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def git(args, repository_path):
|
def git(*args, repository_path='.'):
|
||||||
if not isinstance(args, list):
|
return subprocess.check_output(["git"] + list(args), cwd=repository_path,
|
||||||
args = [args]
|
|
||||||
|
|
||||||
return subprocess.check_output(["git"] + args, cwd=repository_path,
|
|
||||||
stderr=subprocess.STDOUT).decode()
|
stderr=subprocess.STDOUT).decode()
|
||||||
|
|
||||||
|
|
||||||
|
4
configure
vendored
4
configure
vendored
@ -17,9 +17,9 @@ ROOTDIR = os.path.abspath(os.path.dirname(__file__))
|
|||||||
|
|
||||||
|
|
||||||
def get_meson():
|
def get_meson():
|
||||||
print("Updating meson submodule...", end='')
|
print("Updating meson submodule... ", end='')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
git(['submodule', 'update', '--init'], ROOTDIR)
|
git('submodule', 'update', '--init', repository_path=ROOTDIR)
|
||||||
print("DONE")
|
print("DONE")
|
||||||
|
|
||||||
return os.path.join(ROOTDIR, 'meson', 'meson.py')
|
return os.path.join(ROOTDIR, 'meson', 'meson.py')
|
||||||
|
@ -43,10 +43,10 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, recurse_i=0):
|
|||||||
print("Updating %s..." % repo_name)
|
print("Updating %s..." % repo_name)
|
||||||
try:
|
try:
|
||||||
if revision:
|
if revision:
|
||||||
git(["fetch"], repo_dir)
|
git("fetch", repository_path=repo_dir)
|
||||||
git(["checkout", revision], repo_dir)
|
git("checkout", revision, repository_path=repo_dir)
|
||||||
else:
|
else:
|
||||||
git(["pull", "--rebase"], repo_dir)
|
git("pull", "--rebase", repository_path=repo_dir)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
out = getattr(e, "output", b"").decode()
|
out = getattr(e, "output", b"").decode()
|
||||||
if not no_interaction:
|
if not no_interaction:
|
||||||
@ -73,7 +73,7 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, recurse_i=0):
|
|||||||
return False
|
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,
|
print(u" -> %s%s%s — %s" % (Colors.HEADER, commit_message[0][7:14], Colors.ENDC,
|
||||||
commit_message[4].strip()))
|
commit_message[4].strip()))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user