Wow, that's cool!
It would sure be awesome if I could say that I've written as many Bazaar plugins as Robert this month.
That sounds like work.
Perhaps I can do this with, like, 6 lines of Python.
I've now written a plug-in to provide desktop power management support to Bazaar. You can install it like this:
mkdir -p ~/.bazaar/plugins bzr branch lp:~ted-gould/+junk/bazaar-power-management ~/.bazaar/plugins/power_management
This hack-ish plug-in uses the initialization of the plug-in to call the DBus interface for power management to inhibit the power manager. It then relies on the fact that the power manager will drop an inhibit request from a client that disconnects from the bus which happens when the process exits. Both are relatively unsupported, and mostly undocumented ways to use the systems, but it works.
Why would you need something like this? Well if your trying to create a repository from a really slow SVN server which takes longer than the sleep timeout of your laptop (not that I've done this) you can end up really wishing your laptop hadn't gone to sleep. Yes, things restart, and you don't loose everything, but you'd really rather your laptop was awake the whole time. With this plug-in your laptop won't go to sleep while Bazaar is running.
The only thing left to consider is: What is Robert going to do to retaliate? 7 lines of Python?
posted Jul 4, 2008 | permanent link