--- a/mercurial/bundlerepo.py Thu Mar 20 11:12:35 2008 -0500
+++ b/mercurial/bundlerepo.py Sat Mar 15 12:04:28 2008 -0400
@@ -12,8 +12,8 @@
from node import hex, nullid, short
from i18n import _
-import changegroup, util, os, struct, bz2, tempfile, mdiff
-import localrepo, changelog, manifest, filelog, revlog
+import changegroup, util, os, struct, bz2, tempfile, shutil, mdiff
+import repo, localrepo, changelog, manifest, filelog, revlog
class bundlerevlog(revlog.revlog):
def __init__(self, opener, indexfile, bundlefile,
@@ -153,7 +153,13 @@
class bundlerepository(localrepo.localrepository):
def __init__(self, ui, path, bundlename):
- localrepo.localrepository.__init__(self, ui, path)
+ self._tempparent = None
+ try:
+ localrepo.localrepository.__init__(self, ui, path)
+ except repo.RepoError:
+ self._tempparent = tempfile.mkdtemp()
+ tmprepo = localrepo.instance(ui,self._tempparent,1)
+ localrepo.localrepository.__init__(self, ui, self._tempparent)
if path:
self._url = 'bundle:' + path + '+' + bundlename
@@ -252,6 +258,8 @@
tempfile = getattr(self, 'tempfile', None)
if tempfile is not None:
os.unlink(tempfile)
+ if self._tempparent:
+ shutil.rmtree(self._tempparent, True)
def instance(ui, path, create):
if create: