summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2011-02-17 18:23:21 -0700
committerJesse Keating <jkeating@redhat.com>2011-02-18 12:04:26 -0700
commit2748ee33fcd130c67c51d2fe06c05c35186c6e30 (patch)
tree2ddf6a444a3daa085b7ab25c2029d909eb933fbc
parentebbfd382e5163b06ec6897cd6c750ff0ff15de4f (diff)
downloadfedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.zip
fedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.tar.gz
fedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.tar.xz
Add new and old support to switch_branches
This also removes a hardcoded reference to "origin", as this can be named differently.
-rw-r--r--src/pyfedpkg/__init__.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index f3f3fc8..4816e6e 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -874,11 +874,15 @@ def switch_branch(branch, path=None):
if not branch in locals:
# We need to create a branch
log.debug('No local branch found, creating a new one')
- if not 'origin/%s/master' % branch in remotes:
+ totrack = None
+ for remote in remotes:
+ if remote.endswith(branch) or remote.endswith(branch + '/master'):
+ totrack = remote
+ break
+ else:
raise FedpkgError('Unknown remote branch %s' % branch)
try:
- log.info(repo.git.checkout('-b', branch, '--track',
- 'origin/%s/master' % branch))
+ log.info(repo.git.checkout('-b', branch, '--track', remote))
except: # this needs to be finer grained I think...
raise FedpkgError('Could not create branch %s' % branch)
else: