pmb.helpers.git.get_branches_official(): new func (!1882)

Add dummy function that only returns ["master"] for now, so we can use it
in the upcoming git checks for "pmbootstrap status". More sophisticated
logic to figure out the branches will be added soon, see project
direction 2020 issue.

Related: #1829
This commit is contained in:
Oliver Smith 2020-02-12 19:36:52 +01:00 committed by Alexey Min
parent 1358424703
commit 5ae6f86a1f
No known key found for this signature in database
GPG Key ID: 0B19D2A65870B448
1 changed files with 9 additions and 1 deletions

View File

@ -96,6 +96,14 @@ def get_upstream_remote(args, name_repo):
" repository: {}".format(name_repo, url, path))
def get_branches_official(args, name_repo):
""" Get all branches that point to official release channels.
:returns: list of supported branches, e.g. ["master", "3.11"] """
# More sophisticated logic to figure out the branches will be added soon:
# https://gitlab.com/postmarketOS/postmarketos/issues/11
return ["master"]
def pull(args, name_repo):
""" Check if on official branch and essentially try 'git pull --ff-only'.
Instead of really doing 'git pull --ff-only', do it in multiple steps
@ -103,7 +111,7 @@ def pull(args, name_repo):
on which part fails.
:returns: integer, >= 0 on success, < 0 on error """
branches_official = ["master"]
branches_official = get_branches_official(args, name_repo)
# Skip if repo wasn't cloned
path = get_path(args, name_repo)