How to track a file (in various versions) used by several projects

Steve Mullock sjm at kore.co.uk
Fri Oct 20 09:25:02 UTC 2023


Dear John

Another useful reply, thanks

From:           	John W <jwdevel at gmail.com>
Copies to:      	mercurial at lists.mercurial-scm.org

> 
> In addition to the "named branches" approach (which seems fine for
> your case), you can also have different usernames for the different
> repos.
> You can do this by modifying the .hg/hgrc file for a given repo,
> changing the ui.username config entry. I have used this approach with
> some success sharing code between systems, having names like
> "me-laptop at example.com" on one and "me-server at example.com" on another.
> You can see this easily when looking at the commits.

That is a helpful idea I had not thought of. TortoiseHg provides a GUI so I don't have to hand 
edit the hgrc file.
 
> Having a repo-inside-a-repo is supported. The sub-repo's files will be
> ignored by the parent repo.
> Note: this is entirely separate from Mercurial's "subrepos"
> extension[1], which make the parent repo aware of the sub-repos, and
> lets you operate on them as a group. If you simply do nothing but make
> a repo-inside-a-repo, it will be auto-ignored by the parent repo. In
> that simple case, if you want to make changes in the sub-repo, you
> would change dir to be inside there, and work normally.

It is also helpful to know that this tactic has no obvious bear-traps.

I'll probably continue with named branches for now, because it involves fewer repositories. It 
is going to be an advance on the add-hoc hand-checked tactics I used before. It will be easier 
to understand any limitations after I have been using it in anger for a while.

> You can make convenience aliases in the top-level
>    shared repo so you can write "hg pull sysA" (no idea what this
>    looks like in Tortoise though).

Just BTW TortoiseHg also makes this easy. I use it for backups and for rare occasions when I 
share a repository with colleagues. 

Thanks again

Steve





-- 
Dr. S.J. Mullock 
http://www.kore.co.uk
Kore Technology Ltd
Cambridgeshire Business Park
Ely, Cambs.
CB7 4EA, UK
Tel. (Int.+ 44) (0) 1353 653030
Fax. (Int.+ 44) (0) 1353 653031
Registered in England, No. 2643175





More information about the Mercurial mailing list