Created
May 25, 2015 05:06
-
-
Save intari/8f260bc260acd3b24eae to your computer and use it in GitHub Desktop.
Commit hook to log commit messages as highlights to RescueTime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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