comparison tests/test_util.py @ 911:772280aed751

Honor SVN auto-props (solves issue #186) The auto-props are read from the users subversion configuration file (~/.subversion/config on posix). System-wide configuration files are not taken into account. The implementation completely bypasses the subversion bindings, because the current bindings provide little support for this functionality.
author Ronny Voelker <ronny.voelker@googlemail.com>
date Sun, 01 Jan 2012 15:59:15 +0100
parents 312f36a425f0
children 6918f60d0e28
comparison
equal deleted inserted replaced
910:312f36a425f0 911:772280aed751
36 from nose import SkipTest 36 from nose import SkipTest
37 except ImportError: 37 except ImportError:
38 SkipTest = None 38 SkipTest = None
39 39
40 from hgsubversion import util 40 from hgsubversion import util
41 from hgsubversion import svnwrap
41 42
42 # Documentation for Subprocess.Popen() says: 43 # Documentation for Subprocess.Popen() says:
43 # "Note that on Windows, you cannot set close_fds to true and 44 # "Note that on Windows, you cannot set close_fds to true and
44 # also redirect the standard handles by setting stdin, stdout or 45 # also redirect the standard handles by setting stdin, stdout or
45 # stderr." 46 # stderr."
258 259
259 self.repocount = 0 260 self.repocount = 0
260 self.wc_path = '%s/testrepo_wc' % self.tmpdir 261 self.wc_path = '%s/testrepo_wc' % self.tmpdir
261 self.svn_wc = None 262 self.svn_wc = None
262 263
264 self.config_dir = self.tmpdir
265 svnwrap.common._svn_config_dir = self.config_dir
266 self.setup_svn_config('')
267
263 # Previously, we had a MockUI class that wrapped ui, and giving access 268 # Previously, we had a MockUI class that wrapped ui, and giving access
264 # to the stream. The ui.pushbuffer() and ui.popbuffer() can be used 269 # to the stream. The ui.pushbuffer() and ui.popbuffer() can be used
265 # instead. Using the regular UI class, with all stderr redirected to 270 # instead. Using the regular UI class, with all stderr redirected to
266 # stdout ensures that the test setup is much more similar to usage 271 # stdout ensures that the test setup is much more similar to usage
267 # setups. 272 # setups.
268 self.patch = (ui.ui.write_err, ui.ui.write) 273 self.patch = (ui.ui.write_err, ui.ui.write)
269 setattr(ui.ui, self.patch[0].func_name, self.patch[1]) 274 setattr(ui.ui, self.patch[0].func_name, self.patch[1])
275
276 def setup_svn_config(self, config):
277 with open(self.config_dir + '/config', 'w') as c:
278 c.write(config)
270 279
271 def _makerepopath(self): 280 def _makerepopath(self):
272 self.repocount += 1 281 self.repocount += 1
273 return '%s/testrepo-%d' % (self.tmpdir, self.repocount) 282 return '%s/testrepo-%d' % (self.tmpdir, self.repocount)
274 283