mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Rename default branch to ‘main’.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
(cherry picked from commit 646c04eff2)
This commit is contained in:
@@ -5,7 +5,7 @@ cd "$(dirname "$0")/.."
|
||||
remote="$(git config zulip.zulipRemote)" || remote=upstream
|
||||
{
|
||||
git describe --always --tags --match='[0-9]*'
|
||||
branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/master" "refs/remotes/$remote/*.x")"
|
||||
branches="$(git for-each-ref --format='%(objectname)' "refs/remotes/$remote/main" "refs/remotes/$remote/*.x")"
|
||||
mapfile -t branches <<<"$branches"
|
||||
if merge_base="$(git merge-base -- HEAD "${branches[@]}")"; then
|
||||
git describe --always --tags --match='[0-9]*' -- "$merge_base"
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
set -e
|
||||
|
||||
# usage: clean-branches
|
||||
# Deletes any local branches which are ancestors of origin/master,
|
||||
# Deletes any local branches which are ancestors of origin/main,
|
||||
# and also any branches in origin which are ancestors of
|
||||
# origin/master and are named like $USER-*.
|
||||
# origin/main and are named like $USER-*.
|
||||
|
||||
# usage: clean-branches --reviews
|
||||
# Deletes all the above mentioned branches as well as branches
|
||||
@@ -18,13 +18,13 @@ fi
|
||||
push_args=()
|
||||
|
||||
function is_merged() {
|
||||
! git rev-list -n 1 origin/master.."$1" | grep -q .
|
||||
! git rev-list -n 1 origin/main.."$1" | grep -q .
|
||||
}
|
||||
|
||||
function clean_ref() {
|
||||
ref="$1"
|
||||
case "$ref" in
|
||||
*/master | */HEAD)
|
||||
*/main | */HEAD)
|
||||
return
|
||||
;;
|
||||
|
||||
@@ -56,8 +56,8 @@ function clean_ref() {
|
||||
esac
|
||||
}
|
||||
|
||||
if [ "$(git symbolic-ref HEAD)" != 'refs/heads/master' ]; then
|
||||
echo "Check out master before you run this script." >&2
|
||||
if [ "$(git symbolic-ref HEAD)" != 'refs/heads/main' ]; then
|
||||
echo "Check out main before you run this script." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Lint all commit messages that are newer than upstream/master if running
|
||||
# Lint all commit messages that are newer than upstream/main if running
|
||||
# locally or the commits in the push or PR if in CircleCI.
|
||||
|
||||
# The rules can be found in /.gitlint
|
||||
@@ -12,9 +12,9 @@ $(git remote -v)
|
||||
" =~ '
|
||||
'([^[:space:]]*)[[:space:]]*(https://github\.com/|ssh://git@github\.com/|git@github\.com:)"$repository"(\.git|/)?\ \(fetch\)'
|
||||
' ]]; then
|
||||
range="${BASH_REMATCH[1]}/master..HEAD"
|
||||
range="${BASH_REMATCH[1]}/main..HEAD"
|
||||
else
|
||||
range="upstream/master..HEAD"
|
||||
range="upstream/main..HEAD"
|
||||
fi
|
||||
|
||||
commits=$(git log "$range" | wc -l)
|
||||
|
||||
@@ -15,7 +15,7 @@ branch=$1
|
||||
branch_ref=$(git rev-list --max-count=1 "$branch") || error_out "Unknown branch: $branch"
|
||||
|
||||
if [ "$old_ref" == "$branch_ref" ]; then
|
||||
new_ref=master
|
||||
new_ref=main
|
||||
else
|
||||
if ref_name=$(git describe --all --exact "$old_ref"); then
|
||||
new_ref=$(echo "$ref_name" | perl -pe 's{^(heads|remotes)/}{}')
|
||||
@@ -28,10 +28,10 @@ fi
|
||||
|
||||
git fetch -p
|
||||
|
||||
git rebase origin/master "$branch" || error_out "Rebase onto origin/master failed"
|
||||
git rebase origin/main "$branch" || error_out "Rebase onto origin/main failed"
|
||||
|
||||
git push . HEAD:master
|
||||
git push origin master || error_out "Push of master to origin/master failed"
|
||||
git push . HEAD:main
|
||||
git push origin main || error_out "Push of main to origin/main failed"
|
||||
|
||||
git checkout "$new_ref"
|
||||
git branch -D "$branch"
|
||||
|
||||
@@ -32,7 +32,7 @@ EXCLUDED_URLS = [
|
||||
"https://www.transifex.com/zulip/zulip/announcements/",
|
||||
"https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh",
|
||||
# Requires authentication
|
||||
"https://circleci.com/gh/zulip/zulip/tree/master",
|
||||
"https://circleci.com/gh/zulip/zulip/tree/main",
|
||||
"https://circleci.com/gh/zulip/zulip/16617",
|
||||
"https://www.linkedin.com/company/zulip-project",
|
||||
# Returns 403 errors to HEAD requests
|
||||
@@ -54,8 +54,8 @@ VNU_IGNORE_REGEX = re.compile(r"|".join(VNU_IGNORE))
|
||||
|
||||
DEPLOY_ROOT = os.path.abspath(os.path.join(__file__, "../../../../../.."))
|
||||
|
||||
ZULIP_SERVER_GITHUB_FILE_URL_PREFIX = "https://github.com/zulip/zulip/blob/master"
|
||||
ZULIP_SERVER_GITHUB_DIRECTORY_URL_PREFIX = "https://github.com/zulip/zulip/tree/master"
|
||||
ZULIP_SERVER_GITHUB_FILE_URL_PREFIX = "https://github.com/zulip/zulip/blob/main"
|
||||
ZULIP_SERVER_GITHUB_DIRECTORY_URL_PREFIX = "https://github.com/zulip/zulip/tree/main"
|
||||
|
||||
|
||||
class BaseDocumentationSpider(scrapy.Spider):
|
||||
|
||||
@@ -127,7 +127,7 @@ Rough steps:
|
||||
probably have to be logged in in the Zulip organization view, rather than
|
||||
via your personal account.
|
||||
1. `ssh zulipdev@base.zulipdev.org`
|
||||
1. `git pull upstream master`
|
||||
1. `git pull upstream main`
|
||||
1. `tools/provision`
|
||||
1. `git clean -f`, in case things were added/removed from `.gitignore`.
|
||||
1. `tools/run-dev.py`, let it run to completion, and then Ctrl-C (to clear
|
||||
|
||||
@@ -12,6 +12,6 @@ remote=${2:-"upstream"}
|
||||
|
||||
set -x
|
||||
git fetch "$remote" "pull/$request_id/head"
|
||||
git checkout -B "review-${request_id}" "$remote/master"
|
||||
git checkout -B "review-${request_id}" "$remote/main"
|
||||
git reset --hard FETCH_HEAD
|
||||
git pull --rebase
|
||||
|
||||
@@ -39,7 +39,7 @@ NEED_TO_DOWNGRADE = """
|
||||
It looks like you checked out a branch that expects an older
|
||||
version of dependencies than the version you provisioned last.
|
||||
This may be ok, but it's likely that you either want to rebase
|
||||
your branch on top of upstream/master or re-provision your VM.
|
||||
your branch on top of upstream/main or re-provision your VM.
|
||||
|
||||
Do this: `./tools/provision`
|
||||
"""
|
||||
|
||||
@@ -7,9 +7,9 @@ usage: $0 [--merge] PULL_REQUEST_ID [REMOTE]
|
||||
|
||||
Force-push our HEAD to the given GitHub pull request branch.
|
||||
|
||||
Useful for a maintainer to run just before pushing to master,
|
||||
Useful for a maintainer to run just before pushing to main,
|
||||
after tweaking the branch and/or rebasing to latest. This causes
|
||||
GitHub to see the subsequent push to master as representing a
|
||||
GitHub to see the subsequent push to main as representing a
|
||||
merge of the PR, rather than requiring the PR to be manually
|
||||
(and to the casual observer misleadingly) closed instead.
|
||||
|
||||
|
||||
16
tools/review
16
tools/review
@@ -33,21 +33,21 @@ def check_git_pristine() -> None:
|
||||
exit("Git is not pristine:\n" + output)
|
||||
|
||||
|
||||
def ensure_on_clean_master() -> None:
|
||||
def ensure_on_clean_main() -> None:
|
||||
branch = get_git_branch()
|
||||
if branch != "master":
|
||||
if branch != "main":
|
||||
exit(f"You are still on a feature branch: {branch}")
|
||||
check_git_pristine()
|
||||
run(["git", "fetch", "upstream", "master"])
|
||||
run(["git", "rebase", "upstream/master"])
|
||||
run(["git", "fetch", "upstream", "main"])
|
||||
run(["git", "rebase", "upstream/main"])
|
||||
|
||||
|
||||
def create_pull_branch(pull_id: int) -> None:
|
||||
run(["git", "fetch", "upstream", f"pull/{pull_id}/head"])
|
||||
run(["git", "checkout", "-B", f"review-{pull_id}", "FETCH_HEAD"])
|
||||
run(["git", "rebase", "upstream/master"])
|
||||
run(["git", "log", "upstream/master..", "--oneline"])
|
||||
run(["git", "diff", "upstream/master..", "--name-status"])
|
||||
run(["git", "rebase", "upstream/main"])
|
||||
run(["git", "log", "upstream/main..", "--oneline"])
|
||||
run(["git", "diff", "upstream/main..", "--name-status"])
|
||||
|
||||
print()
|
||||
print(f"PR: {pull_id}")
|
||||
@@ -60,7 +60,7 @@ def review_pr() -> None:
|
||||
except Exception:
|
||||
exit("please provide an integer pull request id")
|
||||
|
||||
ensure_on_clean_master()
|
||||
ensure_on_clean_main()
|
||||
create_pull_branch(pull_id)
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ if [ -z "$SERVER" ] || [ -z "$ROLES" ]; then
|
||||
echo
|
||||
echo "[repo]"
|
||||
echo "repo_url=git@github.com:zulip/zulip.git"
|
||||
echo "branch=master"
|
||||
echo "branch=main"
|
||||
echo "[aws]"
|
||||
echo "zone_id=Z2U988IEXAMPLE"
|
||||
echo "security_groups=sg-01234567"
|
||||
|
||||
Reference in New Issue
Block a user