Do-It-Yourself Dropbox based on Mercurial:


set -o errexit  # Exit as soon as a command returns an error

hg pull --update
hg commit --addremove --message "Update from $(hostname)" $@
hg push

How to use it:

$ hg clone <remote repo> ./shared
$ cd shared
$ cp ..../ .  # is the script above
$ touch file1 file2
$ ./  # This will add file1 & file2
$ rm file2
$ ./  # This will delete file2
$ touch file3 file4
$ ./ file3  # This will add file3 but not file4

I also have a script that doesn’t synchronize remotely:


hg commit --addremove --message "Update from $(hostname)" $@

If you’re using an editor that writes temporary files in the directory like Vim or Emacs don’t forget to add the relevant regex in the directory’s .hgignore.