chiark
/
gitweb
/
~mdw
/
stgit
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'kha/safe'
[stgit]
/
stgit
/
config.py
diff --git
a/stgit/config.py
b/stgit/config.py
index dc9c9eba47ec7272186e2629203d31d99bcfef7d..bfb117df044d291984ddee2e1ab867d27eea5fe0 100644
(file)
--- a/
stgit/config.py
+++ b/
stgit/config.py
@@
-28,7
+28,6
@@
class GitConfigException(StgException):
class GitConfig:
__defaults={
class GitConfig:
__defaults={
- 'stgit.autoresolved': 'no',
'stgit.smtpserver': 'localhost:25',
'stgit.smtpdelay': '5',
'stgit.pullcmd': 'git pull',
'stgit.smtpserver': 'localhost:25',
'stgit.smtpdelay': '5',
'stgit.pullcmd': 'git pull',
@@
-37,7
+36,8
@@
class GitConfig:
'stgit.autoimerge': 'no',
'stgit.keepoptimized': 'no',
'stgit.extensions': '.ancestor .current .patched',
'stgit.autoimerge': 'no',
'stgit.keepoptimized': 'no',
'stgit.extensions': '.ancestor .current .patched',
- 'stgit.shortnr': '5'
+ 'stgit.shortnr': '5',
+ 'stgit.pager': 'less'
}
__cache = None
}
__cache = None
@@
-57,7
+57,7
@@
class GitConfig:
self.load()
if name not in self.__cache:
self.__cache[name] = [self.__defaults.get(name, None)]
self.load()
if name not in self.__cache:
self.__cache[name] = [self.__defaults.get(name, None)]
- return self.__cache[name][
0
]
+ return self.__cache[name][
-1
]
def getall(self, name):
self.load()
def getall(self, name):
self.load()
@@
-94,8
+94,8
@@
class GitConfig:
self.__cache[name] = value
def unset(self, name):
self.__cache[name] = value
def unset(self, name):
- Run('git', 'config', '--unset', name)
- self.__cache[name] =
None
+ Run('git', 'config', '--unset', name)
.run()
+ self.__cache[name] =
[None]
def sections_matching(self, regexp):
"""Takes a regexp with a single group, matches it against all
def sections_matching(self, regexp):
"""Takes a regexp with a single group, matches it against all
@@
-109,16
+109,19
@@
class GitConfig:
if m:
result.append(m.group(1))
return result
if m:
result.append(m.group(1))
return result
+
+ def get_colorbool(self, name, stdout_is_tty):
+ """Invoke 'git config --get-colorbool' and return the result."""
+ return Run('git', 'config', '--get-colorbool', name,
+ stdout_is_tty).output_one_line()
config=GitConfig()
def config_setup():
global config
config=GitConfig()
def config_setup():
global config
- # Set the PAGER environment to the config value (if any)
- pager = config.get('stgit.pager')
- if pager:
- os.environ['PAGER'] = pager
+ os.environ.setdefault('PAGER', config.get('stgit.pager'))
+ os.environ.setdefault('LESS', '-FRSX')
# FIXME: handle EDITOR the same way ?
class ConfigOption:
# FIXME: handle EDITOR the same way ?
class ConfigOption: