Hi guys,
The FAQ, and hginit.com have been really useful for helping me make the transition from svn to hg.
However, when it comes to using Hg's subrepository feature in the manner of subversion's externals, I've tried everythign and cannot replicate the nice behavior of svn externals.
Here's the simplest example of what I want to do:
Init "
lib" repository
This repository is never to be used as a standalone; it's always included by main
repositories, as a sub-repository.
Init one or more including repositories
To keep the example simple, I'll "init" a repository called "main"
Have "main" include "
lib" as a subrepository
Importantly -- AND HERE'S WHAT I CAN'T GET TO WORK:
When I modify a file inside of "main/lib", and I push the modification,
then that change gets pushed to the "
lib" repository -- NOT to a copy
inside of "main".
Command lines speak louder than words. I've tried so many variations on this theme, but here's the gist. If someone can reply, in command lines, I'll be forever grateful!
1. Init "
lib" repository
$ cd /home/moi/hgrepos ## Where I'm storing my hg repositories, on my main server
$ hg init
lib
$ echo "foo" lib/lib.txt
$ hg add
lib
$ hg ci -A -m "Init
lib"
lib
2. Init "main" repository, and include "
lib" as a subrepos
$ cd /home/moi/hgrepos
$ hg init main
$ echo "foo" main/main.txt
$ hg add main
$ cd main
$ hg clone ../lib
lib
$ echo "lib=lib" .hgsub
$ hg ci -A -m "Init main" .
This all works fine, but when I make a clone of the "main" repository, and make local
modifications to files in "main/lib", and push them, the changes get pushed to "main/lib",
NOT to "
lib".
IN COMMAND-LINE-ESE, THIS IS THE PROBLEM:
$ /home/moi/hg-test
$ hg clone ssh://
[email protected]/hgrepos/lib
lib
$ hg clone ssh://
[email protected]/hgrepos/main main
$ cd main
$ echo foo lib/lib.txt
$ hg st
M
lib.txt
$ hg com -m "Modified
lib.txt, from inside the main repos"
lib.txt
$ hg push
pushing to ssh://
[email protected]/hgrepos/main/lib
That last line of output from hg shows the problem.
It shows that I've made a modification to a COPY of a file in
lib, NOT to a file in the
lib repository. If this were working as I'd like it to work, the push would be to hgrepos/lib, NOT to hgrepos/main/lib. I.e., I would see:
$ hg push
pushing to ssh://
[email protected]/hgrepos/lib
IF YOU CAN ANSWER THIS IN TERMS
OF COMMAND LINES RATHER THAN IN ENGLISH,
I WILL BE ETERNALLY GRATEFUL!
Thank you in advance!
Emily in Portland