From 755088e87affd7c19c205647c3fbbc7eca9aa026 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 4 Apr 2016 23:35:40 +0200 Subject: [PATCH 1/4] travis-apidoc: fix old/new revisions in PR comments --- build-utils/travis-apidoc.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build-utils/travis-apidoc.sh b/build-utils/travis-apidoc.sh index 0ceab5ed7..47b30f3ac 100755 --- a/build-utils/travis-apidoc.sh +++ b/build-utils/travis-apidoc.sh @@ -66,7 +66,6 @@ if git diff --cached --exit-code --quiet; then fi # Commit the relevant changes. -OLD_REV="$(git rev-parse --short HEAD)" COMMIT_MSG="Update docs for $AWESOME_VERSION via Travis Last commit message: @@ -74,7 +73,6 @@ $(cd $REPO_DIR && git log -1 --pretty=format:%s) Build URL: https://travis-ci.org/awesomeWM/awesome/builds/${TRAVIS_BUILD_ID}" git commit -m "[relevant] $COMMIT_MSG" -NEW_REV="$(git rev-parse --short HEAD)" # Commit the irrelevant changes. mv .git ../doc @@ -87,15 +85,19 @@ git commit -m "[boilerplate] $COMMIT_MSG" git tag _old git reset --hard HEAD~2 git cherry-pick _old _old~1 +RELEVANT_REV="$(git rev-parse --short HEAD)" git tag -d _old git checkout "$BRANCH" +OLD_REV="$(git rev-parse --short HEAD)" git merge --no-ff -m "$COMMIT_MSG" merged-update +NEW_REV="$(git rev-parse --short HEAD)" git push --quiet origin "$BRANCH" # Generate compare view links. COMPARE_LINKS="Compare view: https://github.com/awesomeWM/apidoc/compare/${OLD_REV}...${NEW_REV}" +COMPARE_LINKS="$COMPARE_LINKS\nRelevant changes: https://github.com/awesomeWM/apidoc/commit/${RELEVANT_REV}" if [ "$BRANCH" != "gh-pages" ]; then COMPARE_LINKS="$COMPARE_LINKS\nComparison against master (gh-pages): https://github.com/awesomeWM/apidoc/compare/gh-pages...${NEW_REV}" fi From 7f17f6bc0f5486c909e43687ca24e7eb3d0adb72 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 4 Apr 2016 23:36:26 +0200 Subject: [PATCH 2/4] travis-apidoc: add link to pull request to commit messages --- build-utils/travis-apidoc.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-utils/travis-apidoc.sh b/build-utils/travis-apidoc.sh index 47b30f3ac..80cd7836d 100755 --- a/build-utils/travis-apidoc.sh +++ b/build-utils/travis-apidoc.sh @@ -72,6 +72,10 @@ Last commit message: $(cd $REPO_DIR && git log -1 --pretty=format:%s) Build URL: https://travis-ci.org/awesomeWM/awesome/builds/${TRAVIS_BUILD_ID}" +if [ "$TRAVIS_PULL_REQUEST" != false ]; then + COMMIT_MSG="$COMMIT_MSG +Pull request: https://github.com/awesomeWM/awesome/pull/${TRAVIS_PULL_REQUEST}" +fi git commit -m "[relevant] $COMMIT_MSG" # Commit the irrelevant changes. From a10431e7a433e1cd33fe5547d7b5e73526925276 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 5 Apr 2016 00:27:57 +0200 Subject: [PATCH 3/4] travis-apidoc: reference PR only in merge commit for less noise in the PR --- build-utils/travis-apidoc.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/build-utils/travis-apidoc.sh b/build-utils/travis-apidoc.sh index 80cd7836d..67c5c0bb2 100755 --- a/build-utils/travis-apidoc.sh +++ b/build-utils/travis-apidoc.sh @@ -72,10 +72,6 @@ Last commit message: $(cd $REPO_DIR && git log -1 --pretty=format:%s) Build URL: https://travis-ci.org/awesomeWM/awesome/builds/${TRAVIS_BUILD_ID}" -if [ "$TRAVIS_PULL_REQUEST" != false ]; then - COMMIT_MSG="$COMMIT_MSG -Pull request: https://github.com/awesomeWM/awesome/pull/${TRAVIS_PULL_REQUEST}" -fi git commit -m "[relevant] $COMMIT_MSG" # Commit the irrelevant changes. @@ -94,7 +90,12 @@ git tag -d _old git checkout "$BRANCH" OLD_REV="$(git rev-parse --short HEAD)" -git merge --no-ff -m "$COMMIT_MSG" merged-update +MERGE_COMMIT_MSG="$COMMIT_MSG" +if [ "$TRAVIS_PULL_REQUEST" != false ]; then + COMMIT_MSG="$COMMIT_MSG +Pull request: https://github.com/awesomeWM/awesome/pull/${TRAVIS_PULL_REQUEST}" +fi +git merge --no-ff -m "$MERGE_COMMIT_MSG" merged-update NEW_REV="$(git rev-parse --short HEAD)" git push --quiet origin "$BRANCH" From c431f06538c206fcf0cbac18d5424e3da750d080 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 5 Apr 2016 00:28:21 +0200 Subject: [PATCH 4/4] travis-apidoc: important note about valid json --- build-utils/travis-apidoc.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/build-utils/travis-apidoc.sh b/build-utils/travis-apidoc.sh index 67c5c0bb2..03a317d94 100755 --- a/build-utils/travis-apidoc.sh +++ b/build-utils/travis-apidoc.sh @@ -101,6 +101,7 @@ NEW_REV="$(git rev-parse --short HEAD)" git push --quiet origin "$BRANCH" # Generate compare view links. +# NOTE: use "\n" for line endings, not real ones for valid json! COMPARE_LINKS="Compare view: https://github.com/awesomeWM/apidoc/compare/${OLD_REV}...${NEW_REV}" COMPARE_LINKS="$COMPARE_LINKS\nRelevant changes: https://github.com/awesomeWM/apidoc/commit/${RELEVANT_REV}" if [ "$BRANCH" != "gh-pages" ]; then