Python script for automatic synchronization based on inotify
René Mayrhofer
rene at mayrhofer.eu.org
Mon Mar 14 17:02:01 CET 2011
Am 2011-03-12 21:25, schrieb seanh:
> 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.
The current version of the script already implements its own "event
coalescing" for two reasons: the pyinotify library only added this with
version 0.9, which does not seem to be commonly available in
distributions, and it allows to pre-filter the events somewhat. Details
are in FileChangeHandler._file_events and the _filter_and_handle_actions
method.
Within "readfrequency" seconds (configurable in the .autosync config
file), all events will be handled as one commit. Specifically, if
another event occurs within this time frame, then the timer will be
re-started before a commit would occur.
However, I like the idea of making this file-specific instead of a
global coalesce event timer. In practice, it might not be too different
from the current implementation, but it is certainly worth considering.
I just added it to the TODO comments in the header of the script.
Btw, the project is now online at http://gitorious.org/dvcs-autosync and
should even include the full history (already close to a year, although
with very irregular commit intervals ;-) ).
best regards,
Rene
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.madduck.net/pipermail/vcs-home/attachments/20110314/0d29834f/attachment.pgp>
More information about the vcs-home
mailing list