scripts: Add script to look up commits referenced in Fixes I've been using (an earlier version of) this for a while, so it's about time to clean it up and publish it.
diff --git a/scripts/find-commits b/scripts/find-commits new file mode 100755 index 0000000..dccc439 --- /dev/null +++ b/scripts/find-commits
@@ -0,0 +1,32 @@ +#!/bin/bash -eu + +SCRIPTS="$(dirname "$0")" +. "$SCRIPTS"/lsq-defs + +find_commit() { + local full_hash upstream base_ver queue + + if full_hash="$(git rev-parse "$1")" && [ "$full_hash" ]; then + if upstream="$(git describe --contains --match 'v*' "$full_hash" 2>/dev/null)"; then + echo "upstream: ${upstream%%[~^]*}" + else + echo "upstream: not yet released" + fi + for base_ver in $STABLE_BASE_VERSIONS; do + git check-in-stable "$full_hash" "$base_ver" | sed 's/^/'"$base_ver"': /' + queue="$(get_queue $base_ver)" + (cd "$queue" && grep -rl "$full_hash" | sed 's/^/'"$base_ver"': queued: /') + done + fi + echo --- +} + +if [ $# -eq 0 ]; then + while read hash; do + find_commit "$hash" + done +else + for hash in "$@"; do + find_commit "$hash" + done +fi