diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -12,8 +12,8 @@ of the GNU General Public License, incor 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 bundlefilelog(bundlerevlog, filelo 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 @@ class bundlerepository(localrepo.localre 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: