diff options
-rwxr-xr-x | gbp-pq | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -36,16 +36,35 @@ PATCH_DIR = "debian/patches/" SERIES_FILE = os.path.join(PATCH_DIR,"series") def is_pq_branch(branch): + """ + is branch a patch-queue branch? + >>> is_pq_branch("foo") + False + >>> is_pq_branch("patch-queue/foo") + True + """ return [False, True][branch.startswith(PQ_BRANCH_PREFIX)] + def pq_branch_name(branch): - """get the patch queue branch corresponding to branch""" + """ + get the patch queue branch corresponding to branch + + >>> pq_branch_name("patch-queue/master") + >>> pq_branch_name("foo") + 'patch-queue/foo' + """ if not is_pq_branch(branch): return PQ_BRANCH_PREFIX + branch def pq_branch_base(pq_branch): - """get the branch corresponding to the given patch queue branch""" + """ + get the branch corresponding to the given patch queue branch + >>> pq_branch_base("patch-queue/master") + 'master' + >>> pq_branch_base("foo") + """ if is_pq_branch(pq_branch): return pq_branch[len(PQ_BRANCH_PREFIX):] |