How to track a file (in various versions) used by several projects
Steve Mullock
sjm at kore.co.uk
Thu Oct 12 12:59:58 UTC 2023
I have used Mercurial (via TortoiseHg mostly) for a number of projects where a scripting
language (Autoit) controls a piece of custom equipment. I break my code up into functional
chunks, with the intention of reusing some parts in multiple projects. So for example, the
code for systemA and systemB might both include "driver.au3". I would have a repository for
systemA, a repository for systemB etc. There might be 3 - 10 projects that make use of
driver.au3. They each have their own copy. They are updated independently.
When I have to update systemA, a change to driver.au3 may be desirable, but I don't want to
break other systems so only the copy local to the systemA repository is changed. The change is
recorded the next time I commit systemA as part of the systemA repository. Now I would like to
prevent the various copies of driver.au3 diverging too far from each other; they will diverge
temporarily, but I will always strive to merge them again. At the moment I am doing it by
hand, trying to spot common ancestors and making merges when I start a new system.
I do have a repository for a directory only containing the "latest" driver.au3 and I copy in
what I hope are improvements, but I don't see any structure in that repository.
I am trying to think of a work-flow using Mercurial that would help with this. I suspect that
the situation is quite common, so someone has already thought of the best way. At the moment I
am thinking I would need a separate directory/repository containing just driver.au3 for each
system. Will I have problems if I make a repository in a subdirectory of another repository?
Can a single driver.au3 file be part of both the systemA repository (in the sub-directory) and
also be the sole file tracked in the subdirectory repository?
If I am going in the wrong direction, I would be grateful for a warning and perhaps a
suggestion of a better way.
Steve
More information about the Mercurial
mailing list