Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Commit hook to log commit messages as highlights to RescueTime
#!/bin/sh
#
# Log commit messages as a 'highlight' in RescueTime Premium for Mercurial
#
# To enable this hook:
#
# 1. Get your API key from https://www.rescuetime.com/integrations/git
# 2. Place this file somewhere
# 3. Make sure it has executable permissions (chmod +x post-commit)
# 4. add line commit=path/to/this to [hooks] session of your .hgrc
# 5. all commits will be automatically logged as highlight events.
#
#
API_KEY=<your_rescue_time_api_key>
# REQUIRED FIELDS - Today's date and commit message
MESSAGE=$(hg log -r $HG_NODE --template '{desc|firstline}')
DATE_TODAY=$(date +"%Y-%m-%d")
# OPTIONAL - Label
LABEL='code commit'
#if [[ ${#MESSAGE} -gt 10 ]]; then
curl --data "key=$API_KEY&highlight_date=$DATE_TODAY&description=$MESSAGE&source=$LABEL" https://www.rescuetime.com/anapi/highlights_post
#fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.