mercurial: fix new 4.4.X code change that does strict requirement checks.

in few cases we init bare repos for checking, and we should use defauls that
always work.

- fixes #5433
This commit is contained in:
Marcin Kuzminski 2018-02-01 18:25:24 +01:00
parent 8e1c8a63ca
commit fe5628ee44
4 changed files with 17 additions and 3 deletions

View file

@ -203,6 +203,14 @@ class BaseRepository(object):
def __ne__(self, other):
return not self.__eq__(other)
@classmethod
def get_default_config(cls, default=None):
config = Config()
if default and isinstance(default, list):
for section, key, val in default:
config.set(section, key, val)
return config
@LazyProperty
def EMPTY_COMMIT(self):
return EmptyCommit(self.EMPTY_COMMIT_ID)

View file

@ -62,7 +62,7 @@ class GitRepository(BaseRepository):
update_after_clone=False, with_wire=None, bare=False):
self.path = safe_str(os.path.abspath(repo_path))
self.config = config if config else Config()
self.config = config if config else self.get_default_config()
self._remote = connection.Git(
self.path, self.config, with_wire=with_wire)

View file

@ -72,8 +72,14 @@ class MercurialRepository(BaseRepository):
:param update_after_clone=False: sets update of working copy after
making a clone
"""
self.path = safe_str(os.path.abspath(repo_path))
self.config = config if config else Config()
# mercurial since 4.4.X requires certain configuration to be present
# because sometimes we init the repos with config we need to meet
# special requirements
self.config = config if config else self.get_default_config(
default=[('extensions', 'largefiles', '1')])
self._remote = connection.Hg(
self.path, self.config, with_wire=with_wire)

View file

@ -71,7 +71,7 @@ class SubversionRepository(base.BaseRepository):
def __init__(self, repo_path, config=None, create=False, src_url=None,
**kwargs):
self.path = safe_str(os.path.abspath(repo_path))
self.config = config if config else base.Config()
self.config = config if config else self.get_default_config()
self._remote = connection.Svn(
self.path, self.config)