, Johann Schmitz

The commit messages of the last-hope Overlay are now published via Twitter. Follow @LastHopeOverlay to stay in touch.

The post-commit hook is a simple python script using the python-twitter module:

#!/usr/bin/python
import twitter
import sys

def post_update(message):
    api = twitter.Api(consumer_key='CONSUMER_KEY', consumer_secret='CONSUMER_SECRET', access_token_key='ACCESS_TOKEN', access_token_secret='ACCESS_SECRET')
    api.VerifyCredentials()

    update = message
    if len(update) > 140:
        update = "%s..." % update[:137]

    api.PostUpdate(update)

if __name__ == "__main__" and len(sys.argv) > 1:
    post_update(' '.join(sys.argv[1:]))

Since twitter only supports OAuth for authentication and authorization, you have to register a new application at https://dev.twitter.com/apps. Assign the read/write access level to the application and create a new access token for your account. Fill the values in the code and run it: python twitter- update.py "This is an example message". Install it as a post-commit hook and all commit message are now send to twitter.