summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2011-01-31 12:59:36 -0700
committerJesse Keating <jkeating@redhat.com>2011-01-31 12:59:36 -0700
commit6c9206d6e9f64b2626b3d7f81780a7cf7879b37c (patch)
treed332b4ae3f5c4e4f326fe965777354ed8f1c795e
parentba25162c249a065b901ef35172984648270ee2da (diff)
downloadfedora-packager-6c9206d6e9f64b2626b3d7f81780a7cf7879b37c.zip
fedora-packager-6c9206d6e9f64b2626b3d7f81780a7cf7879b37c.tar.gz
fedora-packager-6c9206d6e9f64b2626b3d7f81780a7cf7879b37c.tar.xz
Catch a traceback when trying to build from local branch
When the local branch doesn't have a merge point, catch people trying to build from a remote url.
-rw-r--r--src/pyfedpkg/__init__.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 9c1adf3..76b4e5d 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1182,13 +1182,16 @@ class PackageModule:
# Need to check here to see if the local commit you want to build is
# pushed or not
branch = self.repo.active_branch
- remote = self.repo.git.config('--get',
- 'branch.%s.remote' % branch)
-
- merge = self.repo.git.config('--get',
- 'branch.%s.merge' % branch).replace('refs/heads', remote)
- if self.repo.git.rev_list('%s...%s' % (branch, merge)):
- raise FedpkgError('There are unpushed changes in your repo')
+ try:
+ remote = self.repo.git.config('--get',
+ 'branch.%s.remote' % branch)
+
+ merge = self.repo.git.config('--get',
+ 'branch.%s.merge' % branch).replace('refs/heads', remote)
+ 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.')
# Get the commit hash to build
commit = self.repo.iter_commits().next().sha
url = ANONGITURL % {'module': self.module} + '?#%s' % commit