mercurial/bundlerepo.py
changeset 2740 386f04d6ecb3
parent 2673 109a22f5434a
child 3419 b19360aa21e9
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -237,3 +237,18 @@ class bundlerepository(localrepo.localre
             self.bundlefile.close()
         if self.tempfile is not None:
             os.unlink(self.tempfile)
+
+def instance(ui, path, create):
+    if create:
+        raise util.Abort(_('cannot create new bundle repository'))
+    path = util.drop_scheme('file', path)
+    if path.startswith('bundle:'):
+        path = util.drop_scheme('bundle', path)
+        s = path.split("+", 1)
+        if len(s) == 1:
+            repopath, bundlename = "", s[0]
+        else:
+            repopath, bundlename = s
+    else:
+        repopath, bundlename = '', path
+    return bundlerepository(ui, repopath, bundlename)