# HG changeset patch # User Matt Mackall # Date 2012-01-31 23:25:37 # Node ID 4b7aa1c899dcaaef108aa5ee0b47a87769dbf07f # Parent 6a959318c58ed8fc8d87f799bfe4ebf477a86c85 bundlerepo: try to find containing repo on creation (issue1812) diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -14,7 +14,7 @@ were part of the actual repository. from node import nullid from i18n import _ import os, tempfile, shutil -import changegroup, util, mdiff, discovery +import changegroup, util, mdiff, discovery, cmdutil import localrepo, changelog, manifest, filelog, revlog, error class bundlerevlog(revlog.revlog): @@ -274,6 +274,11 @@ def instance(ui, path, create): if create: raise util.Abort(_('cannot create new bundle repository')) parentpath = ui.config("bundle", "mainreporoot", "") + if not parentpath: + # try to find the correct path to the working directory repo + parentpath = cmdutil.findrepo(os.getcwd()) + if parentpath is None: + parentpath = '' if parentpath: # Try to make the full path relative so we get a nice, short URL. # In particular, we don't want temp dir names in test outputs.