about summary refs log tree commit diff
path: root/pkgs/by-name/az/azure-cli/commit-update-hunks.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/az/azure-cli/commit-update-hunks.sh')
-rwxr-xr-xpkgs/by-name/az/azure-cli/commit-update-hunks.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/by-name/az/azure-cli/commit-update-hunks.sh b/pkgs/by-name/az/azure-cli/commit-update-hunks.sh
new file mode 100755
index 0000000000000..7a9d913e260e7
--- /dev/null
+++ b/pkgs/by-name/az/azure-cli/commit-update-hunks.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# Just a tiny imperfect helper script to commit generated updates.
+#
+# First, ensure that that `git add -p extensions-generated.nix` only
+# returns a series of clean update hunks, where each hunk updates a
+# single package version. All additions/removals must be committed
+# by hand.
+# The script will then commit the remaining hunks with fitting commit messages.
+
+while true; do
+  echo -e "y\nq" | git add -p extensions-generated.nix || break
+  pname=$(git diff --no-ext-diff --cached | grep "pname =" | cut -d'"' -f2 | head -n1) || break
+  versions=$(git diff --no-ext-diff --cached | grep "version =" | cut -d'"' -f2) || break
+  oldver=$(echo "$versions" | head -n1) || break
+  newver=$(echo "$versions" | tail -n1) || break
+  commitmsg="azure-cli-extensions.${pname}: ${oldver} -> ${newver}"
+  git commit -m "$commitmsg"
+done