summaryrefslogtreecommitdiffstats
path: root/src/fedpkg.py
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-07-23 18:07:28 -0700
committerJesse Keating <jkeating@redhat.com>2010-07-23 18:07:28 -0700
commit26b2ed80839c521a6b79fafda008220918ac05b5 (patch)
tree7e35084d5d26b4141454643787b3ea84e407fa76 /src/fedpkg.py
parent35eb92bea31c3cd8ce26d3e94b6d784ae5faa53f (diff)
downloadfedora-packager-26b2ed80839c521a6b79fafda008220918ac05b5.tar.gz
fedora-packager-26b2ed80839c521a6b79fafda008220918ac05b5.tar.xz
fedora-packager-26b2ed80839c521a6b79fafda008220918ac05b5.zip
Rework how we deal with branches
Create a new list_branches function to discover the local and remote branches. Allow creating a new branch if the requested local branch doesn't already exist.
Diffstat (limited to 'src/fedpkg.py')
-rwxr-xr-xsrc/fedpkg.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index bf3c517..f9db3c1 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -586,16 +586,25 @@ def srpm(args):
sys.exit(1)
def switch_branch(args):
+ try:
+ mymodule = pyfedpkg.PackageModule(args.path)
+ except pyfedpkg.FedpkgError, e:
+ log.error('Could not init the module')
+ sys.exit(1)
if args.branch:
try:
- pyfedpkg.switch_branch(args.branch)
+ mymodule.switch_branch(args.branch)
except pyfedpkg.FedpkgError, e:
- log.debug('Unable to switch to another branch: %s' % e)
+ log.error('Unable to switch to another branch: %s' % e)
+ sys.exit(1)
else:
try:
- pyfedpkg.switch_branch(list=1)
+ (locals, remotes) = mymodule.list_branches()
except pyfedpkg.FedpkgError, e:
- log.debug('Unable to list branches: %s' % e)
+ log.error('Unable to list branches: %s' % e)
+ sys.exit(1)
+ print('Locals:\n %s\nRemotes:\n %s' %
+ ('\n '.join(locals), '\n '.join(remotes)))
def tagrequest(args):
# not implimented
@@ -874,7 +883,8 @@ packages will be built sequentially.
# switch branches
parser_switchbranch = subparsers.add_parser('switch-branch',
help = 'Work with branches')
- parser_switchbranch.add_argument('branch', nargs = '?')
+ parser_switchbranch.add_argument('branch', nargs = '?',
+ help = 'Switch to or create branch')
parser_switchbranch.add_argument('-l', '--list',
help = 'List both remote-tracking branches and local branches',
action = 'store_true')