[kteam-tools][PATCH] ktl: Git.config() allows 'git config' queries
Kamal Mostafa
kamal at canonical.com
Fri May 24 22:06:03 UTC 2013
API interface to 'git config'.
Examples:
print Git.config("user.email")
kamal at canonical.com
print Git.config("remote.origin.url")
git://kernel.ubuntu.com/ubuntu/kteam-tools.git
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
ktl/git.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/ktl/git.py b/ktl/git.py
index 48abc99..9483ad4 100644
--- a/ktl/git.py
+++ b/ktl/git.py
@@ -39,6 +39,17 @@ class Git:
return retval
+ # config
+ #
+ # Return the requested git config value. E.g. config("user.email")
+ #
+ @classmethod
+ def config(cls, key):
+ status, result = run_command("git config %s" % key, cls.debug)
+ if status != 0:
+ raise GitError(result)
+ return result[0]
+
# branches
#
# Return a list of all the git branches known to this git repository.
--
1.8.1.2
More information about the kernel-team
mailing list