summaryrefslogtreecommitdiffstats
path: root/src/fedpkg.py
diff options
context:
space:
mode:
authorLéon Keijser <keijser@stone-it.com>2010-07-15 09:39:47 +0200
committerJesse Keating <jkeating@redhat.com>2010-07-15 15:25:33 -0700
commite11fb1cca1de4f09f30ed142fea06427f2293661 (patch)
treeb84deeca797f4fff3fffd19aebfac5fbcd43ff40 /src/fedpkg.py
parentf58e03c4d3afded99fbc27a0c6d5350049515dd3 (diff)
downloadfedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.tar.gz
fedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.tar.xz
fedora-packager-e11fb1cca1de4f09f30ed142fea06427f2293661.zip
Added new command 'switch-branch' for working with branches.
Diffstat (limited to 'src/fedpkg.py')
-rwxr-xr-xsrc/fedpkg.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index c93edb7..0e77d72 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -266,6 +266,18 @@ def _progress_callback(uploaded, total, piece, time, total_time):
sys.stdout.write("[% -36s] % 4s % 8s % 10s % 14s\r" % ('='*(int(percent_done*36)), percent_done_str, elapsed, data_done, speed))
sys.stdout.flush()
+def switch_branch(args):
+ if args.branch:
+ try:
+ pyfedpkg.switch_branch(args.branch)
+ except pyfedpkg.FedpkgError, e:
+ log.debug('Unable to switch to another branch: %s' % e)
+ else:
+ try:
+ pyfedpkg.switch_branch(list=1)
+ except pyfedpkg.FedpkgError, e:
+ log.debug('Unable to list branches: %s' % e)
+
def build(args):
# We may not actually nave an srpm arg if we come directly from the build task
if hasattr(args, 'srpm') and args.srpm and not args.scratch:
@@ -638,7 +650,16 @@ if __name__ == '__main__':
# Add help to -h and --help
parser_help = subparsers.add_parser('help', help = 'Show usage')
parser_help.set_defaults(command = usage)
-
+
+ # switch branches
+ parser_switchbranch = subparsers.add_parser('switch-branch',
+ help = 'Work with branches')
+ parser_switchbranch.add_argument('branch', nargs = '?')
+ parser_switchbranch.add_argument('-l', '--list',
+ help = 'List both remote-tracking branches and local branches',
+ action = 'store_true')
+ parser_switchbranch.set_defaults(command = switch_branch, replace = True)
+
# Add a common build parser to be used as a parent
parser_build_common = subparsers.add_parser('build_common',
add_help = False)
@@ -910,4 +931,4 @@ packages will be built sequentially.
log.addHandler(streamhandler)
# Run the necessary command
- args.command(args) \ No newline at end of file
+ args.command(args)