jasonwryan.com

Miscellaneous ephemera…

Using Mercurial to Share Dotfiles

I posted a couple of weeks back about using dropbox to share dotfiles and while I am pleased with how well that works, I had always intended to see how well a version control system would handle that (relatively trivial) chore.

I chose Mercurial only because it is the system used by the suckless community and, as their philosophy and the products they produce are of such exceptional quality, no further investigation seemed necessary.

Installing mercurial, on both my Arch machines and the Ubuntu box was simple enough:

1
# pacman -S mercurial

Then, rather than use my /home directory as the local repo (which for some reason—probably completely irrational—seemed somewhat risky), I opted to create the repository in a separate directory in my home folder and link to the relevant files.

I signed up for a free account at bitbucket and created a repository called “dotfiles.”

The it was just a matter of cloning the new repository to my local machine:

1
hg clone https://jasonwryan@bitbucket.org/jasonwryan/dotfiles/

and then entering the newly created directory and linking to the files that I wanted to share:

1
2
cd dotfiles/ ln /home/jason/.Xdefaults ln /home/jason/.apvlvrc

Note: I initially tried symlinking, but Mercurial didn’t like that at all, hence the hard links…

Then it was just a matter of telling Mercurial that the requisite files are in the folder:

1
hg add

Commit the changes:

1
hg ci

…and then push the changes to the bitbucket repository:

1
hg push

This was certainly a lot quicker to setup than the Dropbox method but, for all that I am using it for, it seems a little like overkill. I’ll chalk it up as a good way for me to get my head around vcs more than anything else…

The Mercurial Book

For more information on Mercurial, I highly recommend Bryan O'Sullivan’s excellent Mercurial: The Definitive Guide.

Update

Post edited to reflect that fact that I now run two repos, one for the workstation (as described here), and a second one for my EeePC – which I did successfully create in /home without any apocalyptic consequences.

Comments