diff options
author | Jesse Keating <jkeating@redhat.com> | 2011-02-23 15:17:05 -0700 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2011-02-24 08:46:42 -0700 |
commit | 0831adc3c5867bead44a064eed002280153ccb2b (patch) | |
tree | 47c0f8549ef8e8bc06c820bebfc7786ce5e18bda | |
parent | a3e2ad34bcb5dd2487da35d6249235cf9b285f4b (diff) | |
download | fedora-packager-0831adc3c5867bead44a064eed002280153ccb2b.tar.gz fedora-packager-0831adc3c5867bead44a064eed002280153ccb2b.tar.xz fedora-packager-0831adc3c5867bead44a064eed002280153ccb2b.zip |
Clean up hardcoded "origin" (ticket #95)
This will be handy when we start dealing with multiple remotes. Not
perfect but a good start.
-rw-r--r-- | src/pyfedpkg/__init__.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index 36b0268..a6a2c2a 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -305,8 +305,8 @@ def _list_branches(path=None, repo=None): log.debug('Found local branch %s' % ref.name) locals.append(ref.name) elif type(ref) == git.RemoteReference: - if ref.name == 'origin/HEAD': - log.debug('Skipping remote branch alias origin/HEAD') + if ref.remote_head == 'HEAD': + log.debug('Skipping remote branch alias HEAD') continue # Not useful in this context log.debug('Found remote branch %s' % ref.name) remotes.append(ref.name) @@ -408,7 +408,7 @@ def clone(module, user, path=None, branch=None, bare_dir=None): path is the basedir to perform the clone in - branch is the name of a branch to checkout instead of origin/master + branch is the name of a branch to checkout instead of <remote>/master bare_dir is the name of a directory to make a bare clone too if this is a bare clone. None otherwise. @@ -502,6 +502,8 @@ def clone_with_dirs(module, user, path=None): branch_path = os.path.join(top_path, branch.split('/master')[0]) branch_git = git.Git(branch_path) branch_git.config("--replace-all", "remote.origin.url", giturl) + # Bad use of "origin" here, need to fix this when more than one + # remote is used. # Remove the push.default setting when new branches are # active upstream branch_git.config('--add', 'push.default', 'tracking') @@ -850,11 +852,14 @@ def switch_branch(branch, path=None): """Switch the working branch Will create a local branch if one doesn't already exist, - based on origin/<branch>/master + based on <remote>/<branch>/master Logs output and returns nothing. """ + # Currently this just grabs the first matching branch name from the first + # remote it finds. When multiple remotes are in play this needs to get + # smarter if not path: path = os.getcwd() @@ -1250,7 +1255,8 @@ class PackageModule: if self.repo.git.rev_list('%s...%s' % (branch, merge)): raise FedpkgError('There are unpushed changes in your repo') except git.errors.GitCommandError: - raise FedpkgError('You must provide a srpm or push your changes to origin.') + raise FedpkgError('You must provide a srpm or push your \ + changes to the remote repo.') # Get the commit hash to build commit = self.repo.iter_commits().next().sha url = ANONGITURL % {'module': self.module} + '?#%s' % commit |