Change in osmo-ci[master]: Add scripts/osmocom-list-commits.sh

osmith gerrit-no-reply at lists.osmocom.org
Mon Mar 18 13:03:04 UTC 2019


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/13301


Change subject: Add scripts/osmocom-list-commits.sh
......................................................................

Add scripts/osmocom-list-commits.sh

Generate a table of Osmocom repositories and their latest tag, related
commit, and last commit on master.

Related: OS#3840
Change-Id: I91cab0139229e6c1c67e889d33b3d984025bc9da
---
A scripts/osmocom-list-commits.sh
1 file changed, 67 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/01/13301/1

diff --git a/scripts/osmocom-list-commits.sh b/scripts/osmocom-list-commits.sh
new file mode 100755
index 0000000..b8eca3f
--- /dev/null
+++ b/scripts/osmocom-list-commits.sh
@@ -0,0 +1,67 @@
+#!/bin/sh -e
+
+URL="https://git.osmocom.org"
+REPOS="
+	libosmo-abis
+	libosmocore
+	libosmo-netif
+	libosmo-sccp
+	osmo-bsc
+	osmo-bts
+	osmo-ggsn
+	osmo-hlr
+	osmo-mgw
+	osmo-msc
+	osmo-pcu
+"
+
+# Print commit of HEAD for an Osmocom git repository, e.g.:
+# "f90496f577e78944ce8db1aa5b900477c1e479b0"
+# $1: repository
+get_head_commit() {
+	# git output:
+	# f90496f577e78944ce8db1aa5b900477c1e479b0        HEAD
+	ret="$(git ls-remote "$URL/$1" HEAD)"
+	ret="$(echo "$ret" | awk '{print $1}')"
+	echo "$ret"
+}
+
+# Print last tag and related commit for an Osmocom git repository, e.g.:
+# "ec798b89700dcca5c5b28edf1a1cd16ea311f30a        refs/tags/1.0.1"
+# $1: repository
+get_last() {
+	# git output:
+	# ec798b89700dcca5c5b28edf1a1cd16ea311f30a        refs/tags/1.0.1
+	# eab5f594b0a7cf50ad97b039f73beff42cc8312a        refs/tags/1.0.1^{}
+	# ...
+	# 41e7cf115d4148a9f34fcb863b68b2d5370e335d        refs/tags/1.3.1^{}
+	# 8a9f12dc2f69bf3a4e861cc9a81b71bdc5f13180        refs/tags/3G_2016_09
+	# ee618ecbedec82dfd240334bc87d0d1c806477b0        refs/tags/debian/0.9.13-0_jrsantos.1
+	# a3fdd24af099b449c9856422eb099fb45a5595df        refs/tags/debian/0.9.13-0_jrsantos.1^{}
+	# ...
+	ret="$(git ls-remote --tags "$URL/$1")"
+	ret="$(echo "$ret" | grep 'refs/tags/[0-9.]*$')"
+	ret="$(echo "$ret" | sort -n -k2)"
+	ret="$(echo "$ret" | tail -n 1)"
+	echo "$ret"
+}
+
+# Header
+format_str="%-17s %s %-37s %9s %-40s %s\n"
+printf "$format_str" "# repository" " " "clone URL" "last tag" "last tag commit" "HEAD commit"
+
+# Table
+for repo in $REPOS; do
+	last="$(get_last "$repo")"
+	last_tag="$(echo "$last" | cut -d/ -f 3)"
+	last_commit="$(echo "$last" | awk '{print $1}')"
+	head_commit="$(get_head_commit "$repo")"
+
+	printf "$format_str" \
+		"$repo.git" \
+		"=" \
+		"$URL/$repo" \
+		"$last_tag" \
+		"$last_commit" \
+		"$head_commit"
+done

-- 
To view, visit https://gerrit.osmocom.org/13301
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I91cab0139229e6c1c67e889d33b3d984025bc9da
Gerrit-Change-Number: 13301
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190318/9b7a57d6/attachment.html>


More information about the gerrit-log mailing list