diff options
author | Jesse Keating <jkeating@redhat.com> | 2011-02-17 18:23:21 -0700 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2011-02-18 12:04:26 -0700 |
commit | 2748ee33fcd130c67c51d2fe06c05c35186c6e30 (patch) | |
tree | 2ddf6a444a3daa085b7ab25c2029d909eb933fbc /src/pyfedpkg/__init__.py | |
parent | ebbfd382e5163b06ec6897cd6c750ff0ff15de4f (diff) | |
download | fedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.tar.gz fedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.tar.xz fedora-packager-2748ee33fcd130c67c51d2fe06c05c35186c6e30.zip |
Add new and old support to switch_branches
This also removes a hardcoded reference to "origin", as this can be
named differently.
Diffstat (limited to 'src/pyfedpkg/__init__.py')
-rw-r--r-- | src/pyfedpkg/__init__.py | 10 |
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: |