summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-01-06 14:02:50 -0800
committerJesse Keating <jkeating@redhat.com>2010-01-06 16:56:27 -0800
commit7b0b6b75ae2e863de485ec2f5163db50b03bfb34 (patch)
treebe1edd0bb23647371b6b5248a4de548f2702882f /src
parentafed51cfe5261558b023fb5e83310754ef07b16a (diff)
downloadfedora-packager-7b0b6b75ae2e863de485ec2f5163db50b03bfb34.tar.gz
fedora-packager-7b0b6b75ae2e863de485ec2f5163db50b03bfb34.tar.xz
fedora-packager-7b0b6b75ae2e863de485ec2f5163db50b03bfb34.zip
Fill in the 'new' target
This is the first use of the 'git' library, and I'm not sure if I like it or not, but it does provide a wrapper to running various git tasks in something like a pythonic way. If nothing else it saves me from having to wrap everything myself.
Diffstat (limited to 'src')
-rw-r--r--src/fedpkg/__init__.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/fedpkg/__init__.py b/src/fedpkg/__init__.py
index 295d0a4..7d0d8f4 100644
--- a/src/fedpkg/__init__.py
+++ b/src/fedpkg/__init__.py
@@ -16,6 +16,7 @@ import hashlib
import koji
import rpm
import logging
+import git
# Define some global variables, put them here to make it easy to change
LOOKASIDE = 'http://cvs.fedoraproject.org/repo/pkgs'
@@ -170,6 +171,20 @@ def clone_with_dirs(module, user):
(module, user))
return
+def new(path=os.getcwd()):
+ """Return changes in a repo since the last tag"""
+
+ # setup the repo object based on our path
+ try:
+ repo = git.Repo(path)
+ except git.errors.InvalidGitRepositoryError:
+ raise FedpkgError('%s is not a valid repo' % path)
+ # Find the latest tag
+ tag = repo.git.describe('--tags', '--abbrev=0')
+ # Now get the diff
+ log.debug('Diffing from tag %s' % tag)
+ return repo.git.diff('-M', tag)
+
# Create a class for package module
class PackageModule:
def _findbranch(self):