From f644875beca98da4587c14f2627a87ed1e55ec39 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Fri, 22 Jul 2022 13:39:28 -0400
Subject: [PATCH] give more hints describing the changes

---
 ci-tools/update-production | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/ci-tools/update-production b/ci-tools/update-production
index 0fc76c17..1ed0a12e 100755
--- a/ci-tools/update-production
+++ b/ci-tools/update-production
@@ -37,6 +37,29 @@ ensure_changes() {
     fi
 }
 
+describe_merge_request() {
+    git show $rev | grep 'See merge request' | sed -e 's/See merge request //' | tr -d '[:space:]'
+}
+
+describe_merge_requests() {
+    local RANGE=$1
+    shift
+    local TARGET=$1
+    shift
+
+    # Find all of the relevant merge revisions
+    local onelines=$(git log --merges --first-parent -m --oneline "$RANGE" | grep "into '$TARGET'")
+
+    # Describe each merge revision
+    local IFS=$'\n'
+    for line in $onelines; do
+	local rev=$(echo "$line" | cut -d ' ' -f 1)
+	echo -n "* "
+	describe_merge_request $rev
+	echo
+    done
+}
+
 describe_update() {
     local SOURCE_BRANCH=$1
     shift
@@ -51,6 +74,10 @@ describe_update() {
 
     local WHEN=$(git log --max-count=1 --format='%cI' origin/"$TARGET_BRANCH")
 
+    # Describe all of the MRs that were merged into the source branch that are
+    # about to be merged into the target branch.
+    local MR=$(describe_merge_requests origin/"$TARGET_BRANCH"...origin/"$SOURCE_BRANCH" "$SOURCE_BRANCH")
+
     echo "\
 Changes from $SOURCE_BRANCH since $WHEN
 =======================================
@@ -61,6 +88,10 @@ Deployment Notes
 $NOTES
 \`\`\`
 
+Included Merge Requests
+-----------------------
+$MR
+
 Diff Stat
 ---------
 \`\`\`
-- 
GitLab