comparison mercurial/subrepo.py @ 18510:f254ab6207ae stable

subrepo: use sharepath if available when locating the source repo This is an alternative fix for issue3518, enabling sharing of repositories with subrepos, without unconditionally setting the default path in the resulting repo's hgrc file. Better test coverage is added here, but won't prove this code is working until fd903f89e42b is backed out. The problem with the original fix is, if a default path is not available to be copied over from the share source, the default path on the resulting repo is set to the source location. Since that's where the actual repository is stored, the path is essentially self-referential, so push, pull, incoming and outgoing effectively operate on itself. While incoming and outgoing make it look like nothing was changed, push currently hangs (see issue3657). In this case where there is not a real default path, these operations should abort with "default(-push) not found", like the source repo would. Note this problem with the original fix affected repos without subrepos too.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 27 Nov 2012 20:56:27 -0500
parents 6252b4f1c4b4
children 751135cca13c
comparison
equal deleted inserted replaced
18509:21daee53c101 18510:f254ab6207ae
262 return repo._subtoppath 262 return repo._subtoppath
263 if push and repo.ui.config('paths', 'default-push'): 263 if push and repo.ui.config('paths', 'default-push'):
264 return repo.ui.config('paths', 'default-push') 264 return repo.ui.config('paths', 'default-push')
265 if repo.ui.config('paths', 'default'): 265 if repo.ui.config('paths', 'default'):
266 return repo.ui.config('paths', 'default') 266 return repo.ui.config('paths', 'default')
267 if repo.sharedpath != repo.path:
268 # chop off the .hg component to get the default path form
269 return os.path.dirname(repo.sharedpath)
267 if abort: 270 if abort:
268 raise util.Abort(_("default path for subrepository not found")) 271 raise util.Abort(_("default path for subrepository not found"))
269 272
270 def itersubrepos(ctx1, ctx2): 273 def itersubrepos(ctx1, ctx2):
271 """find subrepos in ctx1 or ctx2""" 274 """find subrepos in ctx1 or ctx2"""