0

I have a mercurial repo structured as follows:

/parent
    /child1
    /child2

with the following webconfig file for hg serve:

[paths]
/ = ./*
/parent/child1 = ./parent/child1/*
/parent/child2 = ./parent/child2/*

[web]
allow_push = *
push_ssl = false

I want to be able to clone /parent/child1 or /parent/child2 and update them, then later clone /parent and have all the changes from the children. Preferably showing the commits for the children as well.

I'd also like to be able to easily add /grandchild to one of the children at any time and have it function the same as the children (can clone parent or child folder and get all changes)

The current setup will let me clone the children as I want, but any changes are not reflected in the parent repository.

I'm using hg server --web-config to serve these repos.

I believe I need to use .hgsub to achieve these results, but I'm not sure how and most of the places I find with info link to the old mercurial website, which now doesn't exist.

Other subrepo related configs I've found are just for mapping /parent/child1 to /child1 (I will have a lot of subrepos that may be named similar or the same, so I'd prefer not to have each available in the base) or for mapping someone else's repo as a dependency.

This is an example of what I'd like to be able to do (cmd example):

hg clone http://server/parent/child1 child1
cd child1
echo changes >file1.txt
hg commit -m "changes to child1"
hg push

cd ..
hg clone http://server/parent parent
cd parent/child1
echo new changes >>file1.txt
hg commit -m "changes to child1 again"
hg push

cd ../../child1
hg pull -u
type file1.txt

which should print

changes
new changes

Is this possible with mercurial serve? How can I achieve what I want with a web config? I'm still setting up my mercurial server, so I don't need to worry about history.

If it's not possible, is there another version control software that can do as I need?

Zoe
  • 27,060
  • 21
  • 118
  • 148
Kelly Bang
  • 727
  • 6
  • 16
  • The parent repository records which revision it requires of the child repositories. Thus if you commit to a child repository, a checkout or clone of the parent repository will and must not update the checked-out version of the child repository. Thus what you want is incompatible on how a version control software must work. – planetmaker Jun 03 '17 at 17:31
  • 1
    You can get something similiar, if you *always* commit on the parent repository, but do so with the recursive flag, to work on all subrepositories. – planetmaker Jun 03 '17 at 17:32
  • Hmm thats a pain. Do you know of any different version control software programs that could do as I need? I'll update the question – Kelly Bang Jun 04 '17 at 02:10
  • *Any* vcs must store in the parent repository the version of the child repositories it relies on. No single VCS will do differently - it would be a bug: otherwise the child repository could change in a way which breaks the behaviour of the parent repository. – planetmaker Jun 05 '17 at 13:12
  • You can find subrepo wiki page here - https://www.mercurial-scm.org/wiki/Subrepository. It is moved to the new location – Vadim Kotov Jun 16 '17 at 12:33

0 Answers0