summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLars Schneider <larsxschneider@gmail.com>2015-09-26 09:54:59 +0200
committerJunio C Hamano <gitster@pobox.com>2015-10-03 10:21:13 -0700
commitcb1dafdfdadca4d1bbe4147d2f9c72b5ef0f4ab7 (patch)
tree241979080b8e81499438e2bc9b1a80e3e7297d10 /git-p4.py
parent692e17964dd4f8da4b3994c5c7055ec9a8c22a75 (diff)
downloadgit-cb1dafdfdadca4d1bbe4147d2f9c72b5ef0f4ab7.tar.gz
git-p4: add gitConfigInt reader
Add a git config reader for integer variables. Please note that the git config implementation automatically supports k, m, and g suffixes. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/git-p4.py b/git-p4.py
index 206a45f613..c99b077884 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -623,6 +623,17 @@ def gitConfigBool(key):
_gitConfig[key] = gitConfig(key, '--bool') == "true"
return _gitConfig[key]
+def gitConfigInt(key):
+ if not _gitConfig.has_key(key):
+ cmd = [ "git", "config", "--int", key ]
+ s = read_pipe(cmd, ignore_error=True)
+ v = s.strip()
+ try:
+ _gitConfig[key] = int(gitConfig(key, '--int'))
+ except ValueError:
+ _gitConfig[key] = None
+ return _gitConfig[key]
+
def gitConfigList(key):
if not _gitConfig.has_key(key):
s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)