Commit 799b3bdf authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Project: helper function to extract a branch title

Will be useful in conjunction with `wait_assert_api_branches()`
parent eea5b675cb12
......@@ -41,6 +41,19 @@ def extract_gitlab_branch_titles(branches):
for name, info in branches.items()}
def branch_title(all_branches, branch_name):
"""Return the title of head commit for the branch with given name.
If no branch has the given name, ``None`` is returned.
This is useful for one-liners (lambda) in ``wait_assert`` methods.
branch = all_branches.get(branch_name)
if branch is None:
return None
return branch['commit']['title']
class Project(object):
heptapod = attr.ib()
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