Python script for automatic synchronization based on inotify
snhmnd at gmail.com
Sat Mar 12 21:25:26 CET 2011
On Wed, Mar 09, 2011 at 09:17:07PM +0100, René Mayrhofer wrote:
> How does it do it? ------------------------ 0. Set up desktop
> notifications (for these nice bubble-style popups when anything
> happens) and log into a Jabber/XMPP account specified in the config
> 1. Monitor a specific path for changes with inotify. At the moment,
> only one path is supported and multiple skript instances have to be
> run for multiple disjoint paths. This path is assumed to be (part of)
> a repository. Currently tested with git, but should support most DVCS
> (the config file allows to specify the DVCS commands called when
> interacting with it).
> 2. When changes are detected, check them into the repository that is
> being monitored (or delete, or move, etc.). It automatically ignores
> any patterns listed in .gitignore and the config file allows to
> exclude other directories (e.g. repositories within the main
> 3. Wait for a configurable time. When nothing else changes in between,
> 4. Wait a few seconds longer (again configurable) and, if nothing else
> is commited, initiate a push.
> 5. After the push has finished, send an XMPP message to self (that is,
> to all clients logged in with the same account) to notify other
> accounts of the push.
> [At any time in between]. When receiving a proper XMPP message, pull
> from the repository.
This sounds great! One thought: I think in many use-cases lots of small
changes to a file will be saved one after another and then no changes
for a while, or else lots of files will be changed in a short time and
then no changes for a while. It sounds like in cases like these your
script will make many small commits? I wonder if it could for example
wait until each file has not been modified for five minutes and then
commit, that way you might get a smaller number of larger commits.
More information about the vcs-home