[PATCH] A path is required to create a repository

Andrey Somov py4fun at gmail.com
Tue Nov 8 09:25:39 CST 2011


# HG changeset patch
# User py4fun
# Date 1320614743 -3600
# Node ID 66cfbd0d75f20dab6a0ada8f8baa6d8335c3fcde
# Parent  f3b5ba25d21787a9e4aa5fc243ecbafc9e978e00
A path is required to create a repository.

The API should not give a misleading impression that a repository can be created without specifying the path (via the default argument)

diff -r f3b5ba25d217 -r 66cfbd0d75f2 mercurial/hg.py
--- a/mercurial/hg.py	Sun Nov 06 14:40:31 2011 -0600
+++ b/mercurial/hg.py	Sun Nov 06 22:25:43 2011 +0100
@@ -88,10 +88,10 @@
             return False
     return repo.local()
 
-def repository(ui, path='', create=False):
+def repository(ui, path, create=False):
     """return a repository object for the specified path"""
     repo = _peerlookup(path).instance(ui, path, create)
-    ui = getattr(repo, "ui", ui)
+    ui = getattr(repo, "ui")
     for name, module in extensions.extensions():
         hook = getattr(module, 'reposetup', None)
         if hook:
diff -r f3b5ba25d217 -r 66cfbd0d75f2 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sun Nov 06 14:40:31 2011 -0600
+++ b/mercurial/localrepo.py	Sun Nov 06 22:25:43 2011 +0100
@@ -26,7 +26,7 @@
     supported = supportedformats | set(('store', 'fncache', 'shared',
                                         'dotencode'))
 
-    def __init__(self, baseui, path=None, create=False):
+    def __init__(self, baseui, path, create=False):
         repo.repository.__init__(self)
         self.root = os.path.realpath(util.expandpath(path))
         self.path = os.path.join(self.root, ".hg")


More information about the Mercurial-devel mailing list