From 40ac4b926fc675b7f5a81f578f754daaf5c2bb69 Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sun, 19 May 2013 10:33:55 -0400 Subject: [PATCH] Fixed a bug in hgversion re: identification of tag sha1s, got changelog working in both git and hg --- gitversion | 2 +- hgversion | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gitversion b/gitversion index 53d5fbe..c2c31e1 100644 --- a/gitversion +++ b/gitversion @@ -9,7 +9,7 @@ fi REBUILDING=0 SHA1=$(git rev-parse HEAD) -TAG=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null) +TAG=$(git describe --tags `git rev-list --tags --max-count=1 HEAD` 2>/dev/null) BUILD=0 CHANGELOG="$(git log --format="format:$LOGSPEC" ${BRANCH}@{0}..HEAD)" if [ "$TAG" == "" ]; then diff --git a/hgversion b/hgversion index f739a08..739447e 100644 --- a/hgversion +++ b/hgversion @@ -10,18 +10,18 @@ SHA1=$(hg identify -i | grep -Eo "[a-zA-Z0-9]+") TAG=$(hg parents --template '{latesttag}') TAGSHA=$(hg identify -r $TAG | cut -d ' ' -f 1) BUILD=0 -CHANGELOG="$(hg log -X .hgtags --style=changelog -r ${TAG}:${SHA1})" +CHANGELOG="$(hg log --branch $BRANCH -X .hgtags --style=changelog -r ${TAG}:${SHA1})" if [ "$TAG" == "" ]; then BUILD=0 REBUILDING=1 MAJOR=$BRANCH else - MAJOR=$(echo $TAG | cut -d , -f 2) - BUILD=$(echo $TAG | cut -d , -f 3) + MAJOR=$(echo $TAG | cut -d \| -f 2) + BUILD=$(echo $TAG | cut -d \| -f 3) SHORTTAGSHA=${TAGSHA:0:12} - hg log -r ${SHA1} | grep "Added tag build|${BRANCH}|${BUILD} for changeset ${SHORTTAGSHA}" >/dev/null + hg log -r tip | grep "Added tag build|${BRANCH}|${BUILD} for changeset ${SHORTTAGSHA}" >/dev/null if [ $? -ne 0 ] && [ "$TAGSHA" != "$SHA1" ]; then - CHANGELOG="$(hg log -X .hgtags --style=changelog -r ${SHORTTAGSHA}:${SHA1})" + CHANGELOG="$(hg log --branch $BRANCH -X .hgtags --style=changelog -r ${SHORTTAGSHA}:${SHA1})" BUILD=$(expr $BUILD + 1) REBUILDING=1 else