Skip to content
Snippets Groups Projects
Commit f254ab62 authored by Matt Harbison's avatar Matt Harbison
Browse files

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.
parent 21daee53
No related branches found
No related tags found
No related merge requests found
......@@ -264,6 +264,9 @@
return repo.ui.config('paths', 'default-push')
if repo.ui.config('paths', 'default'):
return repo.ui.config('paths', 'default')
if repo.sharedpath != repo.path:
# chop off the .hg component to get the default path form
return os.path.dirname(repo.sharedpath)
if abort:
raise util.Abort(_("default path for subrepository not found"))
......
......@@ -725,6 +725,19 @@
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ test -f ../shared/subrepo-1/.hg/sharedpath
[1]
$ hg -R ../shared in
comparing with $TESTTMP/subrepo-status (glob)
searching for changes
no changes found
[1]
$ hg -R ../shared/subrepo-2 showconfig paths
paths.default=$TESTTMP/subrepo-status/subrepo-2
$ hg -R ../shared/subrepo-1 sum --remote
parent: -1:000000000000 tip (empty repository)
branch: default
commit: (clean)
update: (current)
remote: (synced)
Check hg update --clean
$ cd $TESTTMP/t
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment