Is it possible to change Mercurial subrepo paths from absolute to relative
Originally my subrepo's were defined with an absolute URL in .hgsub
, which is now causing some trouble. It makes "friendly dictator" workflow impossible since I want to use an intermediate server where users clone their working copies from. Then I would pull changes to the intermediate server before pushing them to the master repository (intermediate server is also the continuous integration host, thus I won't pull stuff directly to the master). The absolute paths prevent this as the cloned repo's would be pushed directly to the master.
Now the problem is that my hg
server spews out 404 errors when I try to push my changes made in the .开发者_开发问答hgsub
file. Below is an example of a change I made
# original subrepo definition
common = http://hgserver/disp/common
# and after the change
common = common
This does not work, it spews out the following error
$ hg push
pushing to http://hgserver/disp
pushing subrepo common
abort: HTTP Error 404: Not Found
Is is possible to change the subrepo configuration in this way or do I have to recreate the whole repository?
Yes, it should be changeable (and you're right that relative makes for a better work flow), however, the relative url path is taken as relative to the hg root
of the repo in which the .hgsub
lives -- not to where you happen to be pushing (which comes from .hg/hgrc
's deafult
entry in the paths
section.
Here's a pretty normal subrepo layout:
on server http://hgserver/disp/main
http://hgserver/disp/common # the "common" repo
http://hgserver/disp/main # the main repo
http://hgserver/disp/main/.hgsub # contains "common=../common"
Then after a clone everything just works and the same hgsub works fine on the server too.
There are a lot of stack overflow questions where people walk through the best layouts for relative subrepo setups, and while I've not tried switching from one to the other I think if you do the "next to" style of sub-repo with "../sibling"
I show above it'll work fine.
Note that a problem exist(ed) when:
- Using ssh (top repo)
- Subrepos listed relative to top (as suggested here - and generally desired) - and
- The top (ssh) repo referenced by absolute path.
See http://mercurial.808500.n3.nabble.com/subrepos-with-ssh-urls-with-absolute-paths-td1462834.html. Essentially it forces the use of absolute paths in the .hgsub file - which break the referred "friendly dictator" / integration server workflow.
A solution is much desired, but for now we'll have to use absolute paths and do a per-user re-map in a [subpaths]
section. :-(
Note: This is now fixed: https://www.mercurial-scm.org/repo/hg-stable/rev/71ea5b2b9517 This is Hg version 1.8.3 (and later)
精彩评论