Created
August 16, 2012 07:54
-
-
Save cointoss1973/3368195 to your computer and use it in GitHub Desktop.
Mercurialにて最後にpushされたリポジトリ群を取得するスクリプト
This file contains 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/bash | |
if [[ -z $1 ]]; then | |
echo "Usage: $0 repository" | |
exit 1; | |
fi | |
function getFirstRev # $1: Repository path | |
{ | |
if [[ $(uname -s) = MINGW* ]]; then | |
export LANGUAGE=C | |
else | |
export LANG=C | |
fi | |
TMP=/tmp/tmp.hg.$$ | |
hg rollback --dry-run -R$1 > $TMP | |
rollbackrev=`sed -e 's/repository tip rolled back to revision \([0-9-]*\) (undo commit)/\1/' $TMP` | |
rm $TMP | |
firstrev=`expr $rollbackrev + 1` | |
echo $firstrev | |
} | |
### for example (after a changegroup has been added via pull) | |
HG_NODE=`getFirstRev $1` | |
hg log -r "$HG_NODE:tip" -R$1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment