Page MenuHomePhabricator
Paste P531

mediawiki/convert-wmf-branches
ActivePublic

Authored by Krinkle on Apr 17 2015, 5:17 PM.
Referenced Files
F4277367: mediawiki/convert-wmf-branches
Jul 15 2016, 2:28 PM
F176354: mediawiki/convert-wmf-branches
Jun 8 2015, 4:22 PM
F176345: mediawiki/convert-wmf-branches
Jun 8 2015, 3:52 PM
F116106: mediawiki_delete-wmf-tags
Apr 17 2015, 5:23 PM
F116105: mediawiki_delete-wmf-tags
Apr 17 2015, 5:20 PM
F116103: mediawiki_delete-wmf-tags
Apr 17 2015, 5:17 PM
Subscribers
None
#!/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 changed the title of this paste from untitled to mediawiki/delete-wmf-tags.
Krinkle updated the paste's language from autodetect to autodetect.
Krinkle changed the title of this paste from mediawiki/delete-wmf-tags to mediawiki/convert-wmf-branches.