Page MenuHomePhabricator
Paste P531

mediawiki/convert-wmf-branches
ActivePublic

Authored by Krinkle on Apr 17 2015, 5:17 PM.
#!/bin/bash -ue
if [ -z "${1:-}" ]; then
# Missing parameters
echo
echo " Usage: $(basename $0) <version>"
echo
echo ' Options:'
echo ' <version> MediaWiki version, e.g. "1.25"'
echo
exit 1
fi
remote='origin'
version=$1
git remote update $remote
git remote prune $remote
refs=`git for-each-ref --format='%(refname)' refs/remotes/${remote}/wmf/${version}wmf*`
branches=()
for ref in $refs; do
branch=$(echo $ref | cut -d '/' -f 4-6)
if git tag $branch $ref > /dev/null 2>&1; then
echo "... created tag $branch"
else
echo "Could not (re)create tag $branch"
fi
# Remove branches after publishing tags in case user is
# not authorised to publish forged tags in Gerrit.
branches+=("$branch")
done
echo "... publishing tags"
git push $remote --tags
if [ -n "${branches:-}" ]; then
for branch in "${branches[@]}"; do
if git push $remote ":refs/heads/$branch" > /dev/null 2>&1; then
echo "... removed branch $branch"
else
echo "Could not remove $branch"
fi
done
fi
git remote update $remote
git remote prune $remote

Event Timeline

Krinkle edited the content of this paste. (Show Details)Apr 17 2015, 5:17 PM
Krinkle changed the title of this paste from untitled to mediawiki/delete-wmf-tags.
Krinkle updated the paste's language from autodetect to autodetect.
Krinkle edited the content of this paste. (Show Details)Apr 17 2015, 5:20 PM
Krinkle edited the content of this paste. (Show Details)Apr 17 2015, 5:23 PM
Krinkle edited the content of this paste. (Show Details)Jun 8 2015, 3:52 PM
Krinkle changed the title of this paste from mediawiki/delete-wmf-tags to mediawiki/convert-wmf-branches.
Krinkle edited the content of this paste. (Show Details)Jun 8 2015, 4:22 PM
Krinkle edited the content of this paste. (Show Details)Jul 15 2016, 2:28 PM