Hg: [subpaths] section in .hgsub not able to accept other then lowercase names?

155 views Asked by At

Is it supposed to be possible to have case sensitive directory names containing mercurial subrepos?

I'm creating thin shell repository UberRepo with 2 sub-repositories: Foo and BaR.

If I name the directories foo, bar (lowercase) and put following content in .hgsub file:

foo= foo
bar= bar

[subpaths]
https://bitbucket\.org/teamname/uberrepo/foo = https://bitbucket.org/teamname/foo
https://bitbucket\.org/teamname/uberrepo/bar = https://bitbucket.org/teamname/bar

Then everything (push, pull, clone) works like a charm. The problem is that the directories with subrepos are in lowercase.

If I name the directories Foo, BaR than no matter of what I put into .hgsub I always get same 404 error, because hg is trying to push to https://bitbucket.org/teamname/uberrepo/Foo - basically no replacement is taking place.

What can I do to keep the non-lower-case directory names while still being able to make hg understand my simple subrepo structure?

Possible workaround: I have found that part of the problem might be that hg (based on hgrc settings) pushes username int o URL. It still does not answer why everything works fine with lowercase. But I have simply downloaded code of hg, searched the code responsible for replacements, fiddled around and found that this can be workarounded by usage of regex:

foo= foo
bar= bar

[subpaths]
^https://([^/]*)/teamname/uberrepo/([^/]*)$ = https://\1/teamname/\2

This solves the issue. Still it should not be needed and should be much easier than that in such simple case (as simple as just putting the exact url)

0

There are 0 answers