Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 8181:03d93882fc93
util: kill configparser wrapper
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 26 Apr 2009 16:50:43 -0500 |
parents | 127281884959 |
children | dd8d5be57d65 |
comparison
equal
deleted
inserted
replaced
8180:6fc30fe7f3e7 | 8181:03d93882fc93 |
---|---|
12 platform-specific details from the core. | 12 platform-specific details from the core. |
13 """ | 13 """ |
14 | 14 |
15 from i18n import _ | 15 from i18n import _ |
16 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error | 16 import cStringIO, errno, re, shutil, sys, tempfile, traceback, error |
17 import os, stat, threading, time, calendar, ConfigParser, glob, osutil | 17 import os, stat, threading, time, calendar, glob, osutil |
18 import imp | 18 import imp |
19 | 19 |
20 # Python compatibility | 20 # Python compatibility |
21 | 21 |
22 _md5 = None | 22 _md5 = None |
115 "%Y", | 115 "%Y", |
116 "%Y-%m", | 116 "%Y-%m", |
117 "%b", | 117 "%b", |
118 "%b %Y", | 118 "%b %Y", |
119 ) | 119 ) |
120 | |
121 # differences from SafeConfigParser: | |
122 # - case-sensitive keys | |
123 # - allows values that are not strings (this means that you may not | |
124 # be able to save the configuration to a file) | |
125 class configparser(ConfigParser.SafeConfigParser): | |
126 def optionxform(self, optionstr): | |
127 return optionstr | |
128 | |
129 def set(self, section, option, value): | |
130 return ConfigParser.ConfigParser.set(self, section, option, value) | |
131 | |
132 def _interpolate(self, section, option, rawval, vars): | |
133 if not isinstance(rawval, basestring): | |
134 return rawval | |
135 return ConfigParser.SafeConfigParser._interpolate(self, section, | |
136 option, rawval, vars) | |
137 | 120 |
138 def cachefunc(func): | 121 def cachefunc(func): |
139 '''cache the result of function calls''' | 122 '''cache the result of function calls''' |
140 # XXX doesn't handle keywords args | 123 # XXX doesn't handle keywords args |
141 cache = {} | 124 cache = {} |