From fe5628ee444fee309f85a6dcfe6c52cb3631d41d Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Thu, 1 Feb 2018 18:25:24 +0100 Subject: [PATCH] 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 --- rhodecode/lib/vcs/backends/base.py | 8 ++++++++ rhodecode/lib/vcs/backends/git/repository.py | 2 +- rhodecode/lib/vcs/backends/hg/repository.py | 8 +++++++- rhodecode/lib/vcs/backends/svn/repository.py | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/rhodecode/lib/vcs/backends/base.py b/rhodecode/lib/vcs/backends/base.py index af1efee9..47b7a74c 100644 --- a/rhodecode/lib/vcs/backends/base.py +++ b/rhodecode/lib/vcs/backends/base.py @@ -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) diff --git a/rhodecode/lib/vcs/backends/git/repository.py b/rhodecode/lib/vcs/backends/git/repository.py index 402fae87..e3ca9482 100644 --- a/rhodecode/lib/vcs/backends/git/repository.py +++ b/rhodecode/lib/vcs/backends/git/repository.py @@ -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) diff --git a/rhodecode/lib/vcs/backends/hg/repository.py b/rhodecode/lib/vcs/backends/hg/repository.py index bdfd819d..6d856819 100644 --- a/rhodecode/lib/vcs/backends/hg/repository.py +++ b/rhodecode/lib/vcs/backends/hg/repository.py @@ -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) diff --git a/rhodecode/lib/vcs/backends/svn/repository.py b/rhodecode/lib/vcs/backends/svn/repository.py index 7eca7ce4..23acce5e 100644 --- a/rhodecode/lib/vcs/backends/svn/repository.py +++ b/rhodecode/lib/vcs/backends/svn/repository.py @@ -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)