Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundlerepo.py @ 2740:386f04d6ecb3
clean up hg.py: move repo constructor code into each repo module
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Mon, 31 Jul 2006 07:11:12 -0700 |
parents | 109a22f5434a |
children | b19360aa21e9 |
line wrap: on
line diff
--- a/mercurial/bundlerepo.py Sun Jul 30 22:52:34 2006 -0700 +++ b/mercurial/bundlerepo.py Mon Jul 31 07:11:12 2006 -0700 @@ -237,3 +237,18 @@ 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)