changeset 16042:4b7aa1c899dc stable

bundlerepo: try to find containing repo on creation (issue1812)
author Matt Mackall <mpm@selenic.com>
date Tue, 31 Jan 2012 17:25:37 -0600
parents 6a959318c58e
children 74d00b5d00cc
files mercurial/bundlerepo.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Mon Jan 30 16:37:15 2012 -0600
+++ b/mercurial/bundlerepo.py	Tue Jan 31 17:25:37 2012 -0600
@@ -14,7 +14,7 @@
 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 @@
     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.