How to track a file (in various versions) used by several projects
Norman Gray
gray at nxg.name
Thu Oct 19 08:55:51 UTC 2023
Steve, hello.
On 12 Oct 2023, at 13:59, Steve Mullock wrote:
> 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.
What I do in a similar situation is that I regard the common library as a separate project, with a private 'distribution', in the sense that there's a 'dist' target in the Makefile, which includes a revision hash and date in a README at the top.
I unpack that into the projects that use it, and check the diffs in to those repos (that is, the other projects include the library code, rather than referring to it), and I'm good to go. That means the 'client' projects are independent of the library repo, and of each other. The unpack step is where I have the opportunity to quickly look at differences between the version previously absorbed in the client and the new one.
If the library needs changed, due to something in a client, then I make the changes in the client, or possibly several commits-worth of changes, so that I allow that version to drift slightly from the common library repo. But (key point) the first change I make is to edit 'MODIFIED' beside the library revision in the client-code README, so that I'lll get a conflict if I mistakenly try to unpack a subsequence library release on top of this one.
Once I'm content that the change is working in this client, then by checking the README, I can generate a diff, from the last absorbed release version, to the current client version, and apply that back in the library repo, hopefully straightforwardly.
If I've sone something like this in two clients in parallel, then this can result in some head-scratching, but I can usually sort it out.
Best wishes,
Norman
--
Norman Gray : https://nxg.me.uk
More information about the Mercurial
mailing list