changeset 7391:c363f492c117

hg: refactor compat wrapping of repository
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 29 Oct 2018 01:07:18 +0100
parents 451b3f9d814e
children b2c15f308ad2
files kallithea/lib/vcs/backends/hg/repository.py kallithea/lib/vcs/utils/hgcompat.py
diffstat 2 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/vcs/backends/hg/repository.py	Mon Oct 29 01:07:15 2018 +0100
+++ b/kallithea/lib/vcs/backends/hg/repository.py	Mon Oct 29 01:07:18 2018 +0100
@@ -30,7 +30,7 @@
 from kallithea.lib.vcs.utils.paths import abspath
 from kallithea.lib.vcs.utils.hgcompat import (
     ui, nullid, match, patch, diffopts, clone, get_contact,
-    localrepository, RepoLookupError, Abort, RepoError, hex, scmutil, hg_url,
+    localrepo, RepoLookupError, Abort, RepoError, hex, scmutil, hg_url,
     httpbasicauthhandler, httpdigestauthhandler, peer, httppeer, sshpeer, tag
 )
 
@@ -364,7 +364,7 @@
 
                 # Don't try to create if we've already cloned repo
                 create = False
-            return localrepository(self.baseui, self.path, create=create)
+            return localrepo.localrepository(self.baseui, self.path, create=create)
         except (Abort, RepoError) as err:
             if create:
                 msg = "Cannot create repository at %s. Original error was %s" \
--- a/kallithea/lib/vcs/utils/hgcompat.py	Mon Oct 29 01:07:15 2018 +0100
+++ b/kallithea/lib/vcs/utils/hgcompat.py	Mon Oct 29 01:07:18 2018 +0100
@@ -18,7 +18,6 @@
 from mercurial.error import RepoError, RepoLookupError, Abort
 from mercurial.hgweb import hgweb_mod
 from mercurial.hgweb.common import get_contact
-from mercurial.localrepo import localrepository
 from mercurial.match import match
 from mercurial.mdiff import diffopts
 from mercurial.node import hex
@@ -45,9 +44,9 @@
 
 
 # workaround for 3.3 94ac64bcf6fe and not calling largefiles reposetup correctly
-localrepository._lfstatuswriters = [lambda *msg, **opts: None]
+localrepo.localrepository._lfstatuswriters = [lambda *msg, **opts: None]
 # 3.5 7699d3212994 added the invariant that repo.lfstatus must exist before hitting overridearchive
-localrepository.lfstatus = False
+localrepo.localrepository.lfstatus = False
 
 # Mercurial 4.2 moved tag from localrepo to the tags module
 def tag(repo, *args):