summaryrefslogtreecommitdiff
path: root/gbp/scripts
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-28 18:28:51 +0200
committerGuido Günther <agx@sigxcpu.org>2014-12-05 15:33:55 +0100
commit7a503e926669041847f568d1ee26ff948e261ffd (patch)
treef7910357d4f32214eae86b0ab9c720c92e005686 /gbp/scripts
parent4c9d692d52fd3fdf72733b07a5c4d5da3a128ca8 (diff)
pq: move switch_pq() to common
So that it can be re-used by the upcoming pq-rpm tool. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/scripts')
-rw-r--r--gbp/scripts/common/pq.py10
-rwxr-xr-xgbp/scripts/pq.py12
2 files changed, 11 insertions, 11 deletions
diff --git a/gbp/scripts/common/pq.py b/gbp/scripts/common/pq.py
index d3c07d1..f7bae23 100644
--- a/gbp/scripts/common/pq.py
+++ b/gbp/scripts/common/pq.py
@@ -304,3 +304,13 @@ def drop_pq(repo, branch):
gbp.log.info("Dropped branch '%s'." % pq_branch)
else:
gbp.log.info("No patch queue branch found - doing nothing.")
+
+
+def switch_pq(repo, current):
+ """Switch to patch-queue branch if on base branch and vice versa"""
+ if is_pq_branch(current):
+ base = pq_branch_base(current)
+ gbp.log.info("Switching to %s" % base)
+ repo.checkout(base)
+ else:
+ switch_to_pq_branch(repo, current)
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index 194145e..c32a36f 100755
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -33,7 +33,7 @@ from gbp.patch_series import (PatchSeries, Patch)
from gbp.scripts.common.pq import (is_pq_branch, pq_branch_name, pq_branch_base,
parse_gbp_commands, format_patch,
switch_to_pq_branch, apply_single_patch,
- apply_and_commit_patch,
+ apply_and_commit_patch, switch_pq,
drop_pq, get_maintainer_from_control)
from gbp.dch import extract_bts_cmds
@@ -279,16 +279,6 @@ def rebase_pq(repo, branch):
GitCommand("rebase")([base])
-def switch_pq(repo, current):
- """Switch to patch-queue branch if on base branch and vice versa"""
- if is_pq_branch(current):
- base = pq_branch_base(current)
- gbp.log.info("Switching to %s" % base)
- repo.checkout(base)
- else:
- switch_to_pq_branch(repo, current)
-
-
def build_parser(name):
try:
parser = GbpOptionParserDebian(command=os.path.basename(name),