diff options
author | Jochen Schmitt <Jochen@herr-schmitt.de> | 2010-09-16 20:05:53 +0200 |
---|---|---|
committer | Jesse Keating <jkeating@redhat.com> | 2010-09-20 13:20:54 -0700 |
commit | dd57b28231771b06b91af41a4cadfd0d133861ca (patch) | |
tree | 24755066df46a088b08ef43c1faac2f3d7f3c6b3 /src/pyfedpkg | |
parent | a86aa28ef548579a3d7e2f25df752cba65a1544e (diff) | |
download | fedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.tar.gz fedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.tar.xz fedora-packager-dd57b28231771b06b91af41a4cadfd0d133861ca.zip |
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/pyfedpkg')
-rw-r--r-- | src/pyfedpkg/__init__.py | 57 |
1 files changed, 28 insertions, 29 deletions
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.""" |