comparison mercurial/bundlerepo.py @ 5664:da72b4d24797

Fix income/pull with bundle and -R (issue 820). Uses ui.setconfig() to tell bundlerepo where the main repo is. This is needed for when the --repository option is used. Adds tests to test-bundle and a new test script test-mq-pull-from-bundle, which plays out the situation that initially made me detect this bug (hg -R .hg/patches pull ../bundle.hg).
author Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
date Tue, 18 Dec 2007 14:11:13 -0600
parents 7c1a9a21dcd7
children 3d666e8e6398
comparison
equal deleted inserted replaced
5663:99fdef2e6793 5664:da72b4d24797
254 os.unlink(tempfile) 254 os.unlink(tempfile)
255 255
256 def instance(ui, path, create): 256 def instance(ui, path, create):
257 if create: 257 if create:
258 raise util.Abort(_('cannot create new bundle repository')) 258 raise util.Abort(_('cannot create new bundle repository'))
259 parentpath = ui.config("bundle", "mainreporoot", "")
260 if parentpath:
261 # Try to make the full path relative so we get a nice, short URL.
262 # In particular, we don't want temp dir names in test outputs.
263 cwd = os.getcwd()
264 if parentpath == cwd:
265 parentpath = ''
266 else:
267 cwd = os.path.join(cwd,'')
268 if parentpath.startswith(cwd):
269 parentpath = parentpath[len(cwd):]
259 path = util.drop_scheme('file', path) 270 path = util.drop_scheme('file', path)
260 if path.startswith('bundle:'): 271 if path.startswith('bundle:'):
261 path = util.drop_scheme('bundle', path) 272 path = util.drop_scheme('bundle', path)
262 s = path.split("+", 1) 273 s = path.split("+", 1)
263 if len(s) == 1: 274 if len(s) == 1:
264 repopath, bundlename = "", s[0] 275 repopath, bundlename = parentpath, s[0]
265 else: 276 else:
266 repopath, bundlename = s 277 repopath, bundlename = s
267 else: 278 else:
268 repopath, bundlename = '', path 279 repopath, bundlename = parentpath, path
269 return bundlerepository(ui, repopath, bundlename) 280 return bundlerepository(ui, repopath, bundlename)