Do-It-Yourself Dropbox based on Mercurial:
#!/bin/sh 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 ..../sync.sh . # sync.sh is the script above $ touch file1 file2 $ ./sync.sh # This will add file1 & file2 $ rm file2 $ ./sync.sh # This will delete file2 $ touch file3 file4 $ ./sync.sh file3 # This will add file3 but not file4
I also have a script update.sh
that doesn’t synchronize remotely:
#!/bin/sh 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.
\..*\.sw[op] \.*~