D4563: localrepo: create new function for instantiating a local repo object

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Tue Sep 18 17:59:27 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfeab472e3c0: localrepo: create new function for instantiating a local repo object (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4563?vs=11001&id=11161

REVISION DETAIL
  https://phab.mercurial-scm.org/D4563

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-check-interfaces.py

CHANGE DETAILS

diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -144,7 +144,7 @@
 
     ziverify.verifyClass(repository.completelocalrepository,
                          localrepo.localrepository)
-    repo = localrepo.localrepository(ui, rootdir)
+    repo = localrepo.makelocalrepository(ui, rootdir)
     checkzobject(repo)
 
     ziverify.verifyClass(wireprototypes.baseprotocolhandler,
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -376,6 +376,18 @@
 # set to reflect that the extension knows how to handle that requirements.
 featuresetupfuncs = set()
 
+def makelocalrepository(ui, path, intents=None):
+    """Create a local repository object.
+
+    Given arguments needed to construct a local repository, this function
+    derives a type suitable for representing that repository and returns an
+    instance of it.
+
+    The returned object conforms to the ``repository.completelocalrepository``
+    interface.
+    """
+    return localrepository(ui, path, intents=intents)
+
 @interfaceutil.implementer(repository.completelocalrepository)
 class localrepository(object):
 
@@ -2388,7 +2400,7 @@
     if create:
         createrepository(ui, localpath, createopts=createopts)
 
-    return localrepository(ui, localpath, intents=intents)
+    return makelocalrepository(ui, localpath, intents=intents)
 
 def islocal(path):
     return True



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list