| #!/bin/sh |
| |
| set -o nounset |
| |
| # Copyright 2018-2021 Fairphone B.V. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| LOGFILE=$1 |
| |
| printHeading() { |
| echo "### $1" |
| } |
| |
| countPrintStat() { |
| echo -n "* **$(grep "$1" "${LOGFILE}" | wc -l)**" |
| echo " $2" |
| } |
| |
| printHeading "Stats" |
| countPrintStat "INFO: HEAD and AOSP-Partner reference point to the same commit. Nothing to do." \ |
| "projects are already up-to-date." |
| countPrintStat "INFO: AOSP-Partner ref. is already merged. Nothing to do." \ |
| "projects have the AOSP-Partner reference already in their history." |
| countPrintStat "INFO: Could fast-forward to the AOSP-Partner ref., but will still create a merge commit." \ |
| "projects could be fast-forwarded to the target reference." |
| countPrintStat "INFO: Continuing on top of local commits." \ |
| "projects have local commits that are not merged on the remote." |
| echo "" |
| |
| printHeading "Ignored and faulty projects" |
| countPrintStat "ERROR: Could not fetch the AOSP-Partner ref." \ |
| "projects failed while fetching the target reference." |
| countPrintStat "ERROR: ls-remote on origin failed." \ |
| "projects failed at ls-remote on origin." |
| countPrintStat "ERROR: Could not determine the remote revision of the target branch. Is this project |
| pointing to a branch?" \ |
| "projects don't seem to point to a branch." |
| countPrintStat "ERROR: Could not unshallow the target branch." \ |
| "projects failed to unshallow." |
| countPrintStat "ERROR: The AOSP-Partner ref does not exist on remote" \ |
| "projects seems to be missing the partner remote reference." |
| echo "" |
| |
| printHeading "Projects with merges" |
| countPrintStat "INFO: Successfully merged the AOSP-Partner ref." \ |
| "projects with successful merges in total." |
| countPrintStat "ERROR: Merge was successful but we are not on a branch. This merge needs to be pushed!" \ |
| "projects were merged without conflict but are not on a branch." |
| countPrintStat "WARNING: Merge was successful but we are not on a branch! However, the merge is empty so can be ignored." \ |
| "projects that are not on a branch have an empty merge. (safe to ignore)" |
| countPrintStat "INFO: Pushing for review…" \ |
| "projects were merged without conflict and can be pushed for review." |
| countPrintStat "ERROR: Could not push the merged HEAD to the remote" \ |
| "projects where pushing to Gerrit failed." |
| echo "" |
| |
| printHeading "Merge conflicts" |
| countPrintStat "ERROR: Could not merge the AOSP-Partner ref." \ |
| "projects with merge conflicts" |