convert: move svn config initializer out of the module level
The svn_config_get_config config call was being called at the module level, but
had the potential to throw permission denied errors if ~/.subversion/servers was
not readable. This could happen in certain test environments where the user
permissions were very particular.
This prevented the remotenames extension from loading, since it imports
convert's hg module, which imports convert's subversion module, which calls
this. The config is only ever used from this one constructor, so let's just move
it in to there.
# Dummy extension that adds a delay after acquiring a lock.
#
# This extension can be used to test race conditions between lock acquisition.
from __future__ import absolute_import
import os
import time
from mercurial import (
lock as lockmod,
)
class delaylock(lockmod.lock):
def lock(self):
delay = float(os.environ.get('HGPRELOCKDELAY', '0.0'))
if delay:
time.sleep(delay)
res = super(delaylock, self).lock()
delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0'))
if delay:
time.sleep(delay)
return res
def extsetup(ui):
lockmod.lock = delaylock