I have a mercurial repository myProject
:
myProject
|- file1.js
|- file2.css
|- useful.js
Now useful.js
is a file with a few useful classes in it. I use it in multiple projects and as such it has its own repository:
useful
|- useful.js
|- example.js
|- README
The idea is that other people can check out useful
, have alook at the file and the example and readme, and if they like it, they copy useful.js
into their own project and make use of it.
Since useful.js
is used in a few of my projects, what is the recommended way to keep it in sync? There is a restriction that useful.js
must live in the top-level folder myProject
, i.e. can't be nested. This makes it tricky to use subrepositories (and in any case, then I'd get the other files like example.js
and README
).
The other thing to note is that the useful
repo has a few branches: default
, version1
, and version2
. My projects that use useful.js
also have branches default
, version1
and version2
. I'd like to make sure that whenever I switch between branches in myProject
, my useful.js
switches branches too. If not for that I could probably live with a symbolic link.
This situation doesn't seem particularly uncommon; how do others handle it? Just write a hook on update
to check if I'm switching branches and switch accordingly? Plus hooks on commit
, push
, pull
? (basically replicate subrepo behaviour for the single file)?
cheers.