Using subrepositories¶
Adding a subrepository¶
Using sub-repositories leaves a few rough edges but can be handy in other regards. Here we describe things which need to be paid attention to, using OpenGFX Mars as an example.
When using sub-repositories it's generally advised to use a lean main repository with sub-repositories which contain the "real" content, e.g.:
opengfx-mars |- graphics |- houses |- trains ...
Where in opengfx-mars itself there are only references to the single repos: main graphics repo and the code of all the single grfs which make up the series of related NewGRFs.
The main repo knows about the sub repos it contains by means of the .hgsub file which indicates how and where the sub repos are found. It's essential that each subrepo is mentioned three times, once for each way it can be accessed: locally, ssh and http. First comes the relative path inside the main repository itself:
graphics = graphics trains = trains houses = houses
that means that you have in your local file system repositories in
~/opengfx-mars (main repo) ~/opengfx-mars/graphics (sub-repo) ~/opengfx-mars/trains (sub-repo) ~/opengfx-mars/houses (sub-repo)
and then the web paths need to be added to .hgsub in the [subpaths] section so that mercurial knows where to actually push the subrepos to:
[subpaths] ssh://hg@hg.openttdcoop.org/opengfx-mars/graphics = ssh://hg@hg.openttdcoop.org/opengfx-mars-graphics ssh://hg@hg.openttdcoop.org/opengfx-mars/trains = ssh://hg@hg.openttdcoop.org/opengfx-mars-trains ssh://hg@hg.openttdcoop.org/opengfx-mars/houses = ssh://hg@hg.openttdcoop.org/opengfx-mars-houses http://hg.openttdcoop.org/opengfx-mars/graphics = http://hg.openttdcoop.org/opengfx-mars-graphics http://hg.openttdcoop.org/opengfx-mars/trains = http://hg.openttdcoop.org/opengfx-mars-trains http://hg.openttdcoop.org/opengfx-mars/houses = http://hg.openttdcoop.org/opengfx-mars-houses
If you want to add at any stage another sub repository, add reference them in this file, following the pattern as shown above. Additionally make sure that in your local checkout of the repository you actually find the subrepository in the path relative to the main repo as described in the first entry.
Updating the main repository to use newer versions of sub repositories¶
The main repository does not automatically update to newer versions found in the sub repositories. If you want to record a new version on the main repository level, then make sure that each sub repository has checked out the version you want to record. And then commit at the main repository (it may indicate that there are no changes, but it will record the checked-out versions of the individual sub repositories):
planetmaker:~/ottd/grfdev/opengfx-mars$ hg st planetmaker:~/ottd/grfdev/opengfx-mars$ cat .hgsubstate fe7c32abda8aca4136065b786ca193042a855ff1 aircraft 7cf3aae8c450ae3b294c1d1a09ee42fc8e1f3309 airports 3bf1f7a355477db2e4ba8c36b44d9354ae2acf55 graphics ef29d6ee23404f6c66ed72476dcfb9dfd2d4e38b houses d32790de839e3166be8b1f6c756c03a9cd4d0a2a industries 240c1a93999730f4f9895d9507b9c003688c83e4 landscape f0b9128f53aa1e3ac225c3f64cf04a65be9be0b2 rv b80b98e7051572e18124b135ae662f19352a88ad townnames f0ceb6e4416f4916ad866916644ea5c25fe317a5 trains ingo@aeolus:~/ottd/grfdev/opengfx-mars$ hg id -R landscape 1a29562b3f0e tip planetmaker:~/ottd/grfdev/opengfx-mars$ hg ci -m "Update: Subrepositories" planetmaker:~/ottd/grfdev/opengfx-mars$ hg push Übertrage nach ssh://hg@hg.openttdcoop.org/opengfx-mars Keine Änderung im Unterarchiv aircraft seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-aircraft Keine Änderung im Unterarchiv airports seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-airports Keine Änderung im Unterarchiv graphics seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-graphics Keine Änderung im Unterarchiv houses seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-houses Keine Änderung im Unterarchiv industries seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-industries Keine Änderung im Unterarchiv landscape seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-landscape Keine Änderung im Unterarchiv rv seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-rv Keine Änderung im Unterarchiv townnames seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-townnames Keine Änderung im Unterarchiv trains seit der letzen Übertragung zu ssh://hg@hg.openttdcoop.org/opengfx-mars-trains Suche nach Änderungen Gegenseite: Füge Änderungssätze hinzu Gegenseite: Füge Manifeste hinzu Gegenseite: Füge Dateiänderungen hinzu Gegenseite: Fügte 1 Änderungssätze mit 1 Änderungen an 1 Dateien hinzu Gegenseite: Building 3ab7229aba15fe5d3740e2eefc7d8f5e53d2f448 planetmaker:~/ottd/grfdev/opengfx-mars$ hg export tip # HG changeset patch # User planetmaker <planetmaker@openttd.org> # Date 1415367780 -3600 # Fri Nov 07 14:43:00 2014 +0100 # Node ID 3ab7229aba15fe5d3740e2eefc7d8f5e53d2f448 # Parent 3ebbf8ddcd47dc5cae504362aa655cbd48e9c7e0 Update: Subrepositories diff --git a/.hgsubstate b/.hgsubstate --- a/.hgsubstate +++ b/.hgsubstate @@ -2,8 +2,8 @@ 7cf3aae8c450ae3b294c1d1a09ee42fc8e1f3309 airports 3bf1f7a355477db2e4ba8c36b44d9354ae2acf55 graphics ef29d6ee23404f6c66ed72476dcfb9dfd2d4e38b houses -d32790de839e3166be8b1f6c756c03a9cd4d0a2a industries -240c1a93999730f4f9895d9507b9c003688c83e4 landscape -f0b9128f53aa1e3ac225c3f64cf04a65be9be0b2 rv +41204893be84fc3cc148a2c4f28373964b1f63a2 industries +1a29562b3f0e4e35bb6a064666b803a5f98d153a landscape +3570de7f46c966bd56f6f0d5d3f84ba1f41fb6d0 rv b80b98e7051572e18124b135ae662f19352a88ad townnames f0ceb6e4416f4916ad866916644ea5c25fe317a5 trains