Renaming main git branches from debian/master to debian/latest
Amin Bandali
bandali at canonical.com
Tue Aug 29 03:13:13 BST 2023
Hi folks,
Jeremy (Cc'd) and I propose to rename the main git development branch
for Debian GNOME team from 'debian/master' to 'debian/latest', and
similarly from 'ubuntu/master' to 'ubuntu/latest' where they exist.
Rationale
---------
- This aligns with the 2020 update to DEP-14.
- debian/latest would also parallel upstream/latest, which we use for
our git-buildpackage workflow.
- This follows the industry-wide efforts towards deprecation of the
term 'master' where possible.
Implementation details
----------------------
We believe it would be best if we make this change across all of our
repositories under the gnome-team group on Salsa, on a single day.
We propose to do this on Monday, 4 September 2023.
Once the change is carried out, you'd need to manually checkout the
debian/latest branch or just do a new 'gbp clone' to continue working
on gnome-team packages.
GitHub added a feature to simplify renaming branches, but GitLab
doesn't have this yet. So, to automate this, we can use sed, git
itself, and the glab CLI tool by GitLab to make the following changes:
1. Change debian-branch in debian/gbp.conf from 'debian/master' to
'debian/latest'. This will cause many gbp commands to fail until
the user switches to the debian/latest branch, so it's a helpful
hint.
2. Push that change to both debian/master and debian/latest.
3. Update each repo's settings on Salsa to use debian/latest as the
default branch.
4. Update each repo's settings on Salsa to "protect" debian/master to
prevent any future pushes to the branch, effectively archiving it.
5. If ubuntu/master exists, follow similar steps as 1, 2, and 4.
6. Update the gnome-team group settings on Salsa to use debian/latest
as the default branch for new projects (repos) going forward.
I have written a small script, git-debian-latest.sh, to carry out
steps 1 through 5. You can find it attached to this message.
I welcome and appreciate your feedback/suggestions, and I would be
happy to try and address any questions or concerns you may have.
Thanks,
-a
References
----------
https://dep-team.pages.debian.net/deps/dep14/
https://github.com/github/renaming
https://inclusivenaming.org
https://gitlab.com/gitlab-org/cli
-------------- next part --------------
#!/bin/sh
# Copyright (C) 2023 Canonical Ltd.
#
# Author: Amin Bandali <bandali at ubuntu.com>
# This file:
# https://people.ubuntu.com/~bandali/gnome-team/git-debian-latest.sh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -ux
# glab repo clone -g gnome-team --paginate
master_to_latest()
{
sed -i "/debian-branch/s|$1/master|$1/latest|" debian/gbp.conf
git add debian/gbp.conf
git commit -m"Change debian-branch from $1/master to $1/latest"
git push origin "$1/master"
git branch -m "$1/latest"
git push -u origin "$1/latest"
}
for dir in ./*/
do
(
cd $dir
if [ -d .git ] && [ "$(git branch --show-current)" = "debian/master" ]
then
# debian/master -> debian/latest
master_to_latest debian
if git show-ref -q ubuntu/master
then
# ubuntu/master -> ubuntu/latest
git branch ubuntu/master origin/ubuntu/master
git checkout ubuntu/master
master_to_latest ubuntu
fi
# make debian/latest the default branch
glab api -XPUT /projects/:id -F 'default_branch=debian/latest'
# prevent pushes and merges into debian/master
glab api -XPOST /projects/:id/protected_branches \
-F 'name=debian/master' \
-F 'push_access_level=0' \
-F 'merge_access_level=0'
if git show-ref -q ubuntu/master
then
# prevent pushes and merges into ubuntu/master
glab api -XPOST /projects/:id/protected_branches \
-F 'name=ubuntu/master' \
-F 'push_access_level=0' \
-F 'merge_access_level=0'
fi
fi
)
done
More information about the pkg-gnome-maintainers
mailing list