Having read this past question for git, I would like to ask if there exists something like that, but
- can be done programmatically (file list) on each machine;
- works for Mercurial.
The reason for this is that I would like to include in my public dotfiles repository some configuration files that store password in plaintext. I know I could write a wraparound script for hg(1) but I would like to know if there are alternative approaches, just for the sake of curiosity.
Thank you.
You could use a pair of
pre-commitandpost-updatehooks to encrypt/decrypt as necessary. See http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html for more details.However, it’s worth pointing out that if you’re storing encrypted text in your repo you’ll be unable to create meaningful diffs — essentially everything will be like a binary file but also poorly compressible.