Reputation: 19442
I'm having difficulties creating an hg-subrepo to a local hg repository.
I've created a "core" repository that I would like to be a subrepository inside another repo. I'm able to clone the "core" repo inside the target but when I go to create/checkin the .hgsub file, I get a parse error that prohibits me from committing the file.
PS C:\Temp\subrepo_experiments\target01> hg status
PS C:\Temp\subrepo_experiments\target01> hg clone C:\Temp\subrepo_experiments\core
destination directory: core
updating to branch default
resolving manifests
getting core_001.txt
getting core_002.txt
getting core_003.txt
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
PS C:\Temp\subrepo_experiments\target01> echo core = C:\Temp\subrepo_experiments\core > .hgsub
PS C:\Temp\subrepo_experiments\target01> hg status
? .hgsub
PS C:\Temp\subrepo_experiments\target01> hg add .hgsub
adding .hgsub
PS C:\Temp\subrepo_experiments\target01> hg commit
hg: parse error at .hgsub:1: ■c o r e
PS C:\Temp\subrepo_experiments\target01>
Upvotes: 1
Views: 2087
Reputation: 97282
You have re-read Subrepositories manuals, better - Subrepositories from "Mercurial Kick Start Exercises", at least first chapter of Introduction
Your mistake is bad definition of right side of subrepository. It have to be relative path (to the root of contaner-repository) or URL (for external subrepo).
If core is subdir of subrepo_experiments (which is root of main repo), then .hgsub will have the easieast form
core = core
It will be fully functional repository with subrepository in it
Repeated sample from Kick Start
z:\mainrepo>dir /B
.hg
subrepo
.hgsub
.hgsubstate
z:\mainrepo>dir subrepo /B
.hg
z:\mainrepo>type .hgsub
subrepo = subrepo
and just for testing
z:\>hg clone mainrepo main-clone -v
updating to branch default
resolving manifests
getting .hgsub
getting .hgsubstate
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
Note: Ry4an catched first main problem, which I miss going deeper
Upvotes: 0
Reputation: 78330
Whatever editor you used to create your .hgsub
file has created an abomination. It appears to be using 16-bit UTF-16 encoding and has a BOM (byte order mark) at the front. Use something that creates UTF-8 or ASCII text without a BOM, and you'll be in good shape. You can see this problem in the output:
hg: parse error at .hgsub:1: ■c o r e
It's telling you "Hey, there's a piece of nonsense at the front and then a non-printable character (NUL / 0x00 in this case) in between every character!
Upvotes: 4