mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-26 09:50:39 +00:00
git-update: provides a check status option
Add --check-status to git-update python script to provide the list of subprojects with their git status (branch and state).
This commit is contained in:
parent
631677589c
commit
b9acfcace8
40
git-update
40
git-update
|
@ -50,7 +50,7 @@ def ensure_revision_if_necessary(repo_dir, revision):
|
||||||
return revision
|
return revision
|
||||||
|
|
||||||
|
|
||||||
def update_subprojects(repos_commits, no_interaction=False):
|
def update_subprojects(manifest, no_interaction=False, check_status=False):
|
||||||
subprojects_dir = os.path.join(SCRIPTDIR, "subprojects")
|
subprojects_dir = os.path.join(SCRIPTDIR, "subprojects")
|
||||||
for repo_name in os.listdir(subprojects_dir):
|
for repo_name in os.listdir(subprojects_dir):
|
||||||
repo_dir = os.path.normpath(os.path.join(SCRIPTDIR, subprojects_dir, repo_name))
|
repo_dir = os.path.normpath(os.path.join(SCRIPTDIR, subprojects_dir, repo_name))
|
||||||
|
@ -58,13 +58,32 @@ def update_subprojects(repos_commits, no_interaction=False):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
revision, args = repos_commits.get(repo_name, [None, []])
|
revision, args = repos_commits.get(repo_name, [None, []])
|
||||||
if not update_repo(repo_name, repo_dir, revision, no_interaction, args):
|
if not update_repo(repo_name, repo_dir, revision, no_interaction, args, check_status=check_status):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def repo_status(commit_message):
|
||||||
|
status = "clean"
|
||||||
|
for message in commit_message:
|
||||||
|
if message.startswith('??'):
|
||||||
|
status = "%sclean but untracked files%s" % (Colors.WARNING,Colors.ENDC)
|
||||||
|
elif message.startswith(' M'):
|
||||||
|
status = "%shas local modificationss%s" % (Colors.WARNING,Colors.ENDC)
|
||||||
|
break;
|
||||||
|
return status
|
||||||
|
|
||||||
def update_repo(repo_name, repo_dir, revision, no_interaction, fetch_args=[], recurse_i=0):
|
def check_repo_status(repo_name, worktree_dir):
|
||||||
|
branch_message = git("status", repository_path=worktree_dir).split("\n")
|
||||||
|
commit_message = git("status", "--porcelain", repository_path=worktree_dir).split("\n")
|
||||||
|
|
||||||
|
print(u"%s%s%s - %s - %s" % (Colors.HEADER, repo_name, Colors.ENDC,
|
||||||
|
branch_message[0].strip(), repo_status(commit_message)))
|
||||||
|
return True
|
||||||
|
|
||||||
|
def update_repo(repo_name, repo_dir, revision, no_interaction, fetch_args=[], recurse_i=0, check_status=False):
|
||||||
|
if check_status:
|
||||||
|
return check_repo_status(repo_name, repo_dir)
|
||||||
revision = ensure_revision_if_necessary(repo_dir, revision)
|
revision = ensure_revision_if_necessary(repo_dir, revision)
|
||||||
git("config", "rebase.autoStash", "true", repository_path=repo_dir)
|
git("config", "rebase.autoStash", "true", repository_path=repo_dir)
|
||||||
try:
|
try:
|
||||||
|
@ -149,6 +168,10 @@ if __name__ == "__main__":
|
||||||
default=False,
|
default=False,
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Do not allow interaction with the user.")
|
help="Do not allow interaction with the user.")
|
||||||
|
parser.add_argument("--check-status",
|
||||||
|
default=False,
|
||||||
|
action='store_true',
|
||||||
|
help="Check repositories status only.")
|
||||||
parser.add_argument("--manifest",
|
parser.add_argument("--manifest",
|
||||||
default=None,
|
default=None,
|
||||||
help="Use a android repo manifest to sync repositories"
|
help="Use a android repo manifest to sync repositories"
|
||||||
|
@ -168,13 +191,12 @@ if __name__ == "__main__":
|
||||||
repos_commits = {}
|
repos_commits = {}
|
||||||
|
|
||||||
revision, args = repos_commits.get('gst-build', [None, []])
|
revision, args = repos_commits.get('gst-build', [None, []])
|
||||||
if not update_repo('gst-build', SCRIPTDIR, revision, options.no_interaction, args):
|
if not update_repo('gst-build', SCRIPTDIR, None, options.no_interaction, args, check_status=options.check_status):
|
||||||
exit(1)
|
exit(1)
|
||||||
|
if not update_subprojects(options.manifest, options.no_interaction, check_status=options.check_status):
|
||||||
if not update_subprojects(repos_commits, options.no_interaction):
|
|
||||||
exit(1)
|
exit(1)
|
||||||
|
if not options.check_status:
|
||||||
update_cargo(options.builddir)
|
update_cargo(options.builddir)
|
||||||
|
|
||||||
if options.builddir:
|
if options.builddir:
|
||||||
ninja = accept_command(["ninja", "ninja-build"])
|
ninja = accept_command(["ninja", "ninja-build"])
|
||||||
|
|
Loading…
Reference in a new issue