Some days ago I ranted about an issue I had with Mercurial and Dropbox; basically, I did put a mercurial repo in a dropbox folder, and ended up with this kind of mess
Mercurial repos inside Dropbox are not a great idea after all. But I had one problem: I sometimes forget to push changes to some files, and Dropbox comes to the rescue; at the same time I need history for such files, and I don't want problems to arise.
I found quite an easy solution:
- Create your dropbox-aware folder, e.g. "somefolder"
- create a .hg folder inside it, e.g. "somefolder/.hg"
- now use your dropbox client, be it the CLI or the GUI, enable Selective Sync and remove such .hg folder from being synced on your current machine. You must take this step on all machines that you want to use with such technique.
- disabling sync for .hg should remove it from the somefolder directory.
Now you can use
hg init inside "somefolder", and you'll obtain a non-synced hg repository.
What for? Whatever! I just create a repo on bitbucket and push/pull changes to/from here.
On other machines, after making sure you've excluded .hg from syncing, you can just use
hg clone -U YOUR_REPO_URL
to obtain such .hg directory.
- it's impossible to get errors or conflicts like the one I previously mentioned
- you get full storicization
- Dropbox syncs the actual working copy, letting you have the latest version always 100% synced without manual intervention.