summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJochen Schmitt <Jochen@herr-schmitt.de>2010-09-16 20:05:53 +0200
committerJesse Keating <jkeating@redhat.com>2010-09-20 13:20:54 -0700
commitdd57b28231771b06b91af41a4cadfd0d133861ca (patch)
tree24755066df46a088b08ef43c1faac2f3d7f3c6b3 /src
parenta86aa28ef548579a3d7e2f25df752cba65a1544e (diff)
downloadfedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.zip
fedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.tar.gz
fedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.tar.xz
Move diff function out of the PackageModule class
hello Jesse, because you have wrote, that you want a minimum set of functions in the PackageModule clase, I have move the diff function out of their. Best Regards: Jochen Schmitt
Diffstat (limited to 'src')
-rwxr-xr-xsrc/fedpkg.py3
-rw-r--r--src/pyfedpkg/__init__.py57
2 files changed, 29 insertions, 31 deletions
diff --git a/src/fedpkg.py b/src/fedpkg.py
index 8f90364..70ce711 100755
--- a/src/fedpkg.py
+++ b/src/fedpkg.py
@@ -485,8 +485,7 @@ def compile(args):
def diff(args):
try:
- mymodule = pyfedpkg.PackageModule(args.path)
- return mymodule.diff(args.cached, args.files)
+ return mymodule.diff(args.path, args.cached, args.files)
except pyfedpkg.FedpkgError, e:
log.error('Could not diff: %s' % e)
sys.exit(1)
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index 9d0865b..cdcde24 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -508,6 +508,34 @@ def delete_tag(tagname=None):
_run_command(cmd)
log.info ('Tag %s was deleted' % ', '.join(delete))
+def diff(path, cached=False, files=[]):
+ """Excute a git diff
+
+ optionally diff the cached or staged changes
+
+ Takes an optional list of files to diff reletive to the module base
+ directory
+
+ Logs the output and returns nothing
+
+ """
+
+ # Things work better if we're in our module directory
+ oldpath = os.getcwd()
+ os.chdir(path)
+ # build up the command
+ cmd = ['git', 'diff']
+ if cached:
+ cmd.append('--cached')
+ if files:
+ cmd.extend(files)
+
+ # Run it!
+ _run_command(cmd)
+ # popd
+ os.chdir(oldpath)
+ return
+
def get_latest_commit(module):
"""Discover the latest commit has for a given module and return it"""
@@ -1192,35 +1220,6 @@ class PackageModule:
_run_command(cmd, shell=True)
return
- def diff(self, cached=False, files=[]):
- """Excute a git diff
-
- optionally diff the cached or staged changes
-
- Takes an optional list of files to diff reletive to the module base
- directory
-
- Logs the output and returns nothing
-
- """
-
- # Things work better if we're in our module directory
- oldpath = os.getcwd()
- os.chdir(self.path)
-
- # build up the command
- cmd = ['git', 'diff']
- if cached:
- cmd.append('--cached')
- if files:
- cmd.extend(files)
-
- # Run it!
- _run_command(cmd)
- # popd
- os.chdir(oldpath)
- return
-
def getver(self):
"""Return the version-release of a package module."""