Rename default branch to ‘main’
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
285a946a1f
commit
53e59c8c09
2
.github/workflows/zulip-tests.yml
vendored
2
.github/workflows/zulip-tests.yml
vendored
|
@ -3,7 +3,7 @@ name: build
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Zulip API
|
# Zulip API
|
||||||
|
|
||||||
[![Build status](https://github.com/zulip/python-zulip-api/workflows/build/badge.svg?branch=master)](
|
[![Build status](https://github.com/zulip/python-zulip-api/workflows/build/badge.svg)](
|
||||||
https://github.com/zulip/python-zulip-api/actions?query=branch%3Amaster+workflow%3Abuild)
|
https://github.com/zulip/python-zulip-api/actions?query=branch%3Amain+workflow%3Abuild)
|
||||||
[![Coverage status](https://img.shields.io/codecov/c/github/zulip/python-zulip-api/master.svg)](
|
[![Coverage status](https://img.shields.io/codecov/c/github/zulip/python-zulip-api)](
|
||||||
https://codecov.io/gh/zulip/python-zulip-api)
|
https://codecov.io/gh/zulip/python-zulip-api)
|
||||||
|
|
||||||
This repository contains the source code for Zulip's PyPI packages:
|
This repository contains the source code for Zulip's PyPI packages:
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# usage: clean-branches
|
# 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
|
# 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
|
# usage: clean-branches --reviews
|
||||||
# Deletes all the above mentioned branches as well as branches
|
# Deletes all the above mentioned branches as well as branches
|
||||||
|
@ -18,13 +18,13 @@ fi
|
||||||
push_args=()
|
push_args=()
|
||||||
|
|
||||||
function is_merged {
|
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 {
|
function clean_ref {
|
||||||
ref="$1"
|
ref="$1"
|
||||||
case "$ref" in
|
case "$ref" in
|
||||||
*/master | */HEAD)
|
*/main | */HEAD)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -56,8 +56,8 @@ function clean_ref {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$(git symbolic-ref HEAD)" != 'refs/heads/master' ]; then
|
if [ "$(git symbolic-ref HEAD)" != 'refs/heads/main' ]; then
|
||||||
echo "Check out master before you run this script." >&2
|
echo "Check out main before you run this script." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ branch_ref=$(git rev-list --max-count=1 "$branch")
|
||||||
[ $? -ne 0 ] && error_out "Unknown branch: $branch"
|
[ $? -ne 0 ] && error_out "Unknown branch: $branch"
|
||||||
|
|
||||||
if [ "$old_ref" == "$branch_ref" ]; then
|
if [ "$old_ref" == "$branch_ref" ]; then
|
||||||
new_ref=master
|
new_ref=main
|
||||||
else
|
else
|
||||||
ref_name=$(git describe --all --exact "$old_ref")
|
ref_name=$(git describe --all --exact "$old_ref")
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
@ -31,12 +31,12 @@ fi
|
||||||
|
|
||||||
git fetch -p
|
git fetch -p
|
||||||
|
|
||||||
git rebase origin/master "$branch"
|
git rebase origin/main "$branch"
|
||||||
[ $? -ne 0 ] && error_out "Rebase onto origin/master failed"
|
[ $? -ne 0 ] && error_out "Rebase onto origin/main failed"
|
||||||
|
|
||||||
git push . HEAD:master
|
git push . HEAD:main
|
||||||
git push origin master
|
git push origin main
|
||||||
[ $? -ne 0 ] && error_out "Push of master to origin/master failed"
|
[ $? -ne 0 ] && error_out "Push of main to origin/main failed"
|
||||||
|
|
||||||
git checkout "$new_ref"
|
git checkout "$new_ref"
|
||||||
git branch -D "$branch"
|
git branch -D "$branch"
|
||||||
|
|
|
@ -12,6 +12,6 @@ fi
|
||||||
request_id="$1"
|
request_id="$1"
|
||||||
remote=${2:-"upstream"}
|
remote=${2:-"upstream"}
|
||||||
git fetch "$remote" "pull/$request_id/head"
|
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 reset --hard FETCH_HEAD
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Edited at Line 14 Col 97 (zulip -> python-zulip-api)
|
# Edited at Line 14 Col 97 (zulip -> python-zulip-api)
|
||||||
# Please don't edit here; instead update the zulip/zulip copy and then resync this file.
|
# Please don't edit here; instead update the zulip/zulip copy and then resync this file.
|
||||||
|
|
||||||
# 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 Gh-Actions.
|
# locally or the commits in the push or PR Gh-Actions.
|
||||||
|
|
||||||
# The rules can be found in /.gitlint
|
# The rules can be found in /.gitlint
|
||||||
|
@ -16,9 +16,9 @@ $(git remote -v)
|
||||||
" =~ '
|
" =~ '
|
||||||
'([^[:space:]]*)[[:space:]]*(https://github\.com/|ssh://git@github\.com/|git@github\.com:)"$repository"(\.git|/)?\ \(fetch\)'
|
'([^[:space:]]*)[[:space:]]*(https://github\.com/|ssh://git@github\.com/|git@github\.com:)"$repository"(\.git|/)?\ \(fetch\)'
|
||||||
' ]]; then
|
' ]]; then
|
||||||
range="${BASH_REMATCH[1]}/master..HEAD"
|
range="${BASH_REMATCH[1]}/main..HEAD"
|
||||||
else
|
else
|
||||||
range="upstream/master..HEAD"
|
range="upstream/main..HEAD"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
commits=$(git log "$range" | wc -l)
|
commits=$(git log "$range" | wc -l)
|
||||||
|
|
16
tools/review
16
tools/review
|
@ -32,21 +32,21 @@ def check_git_pristine() -> None:
|
||||||
exit("Git is not pristine:\n" + output)
|
exit("Git is not pristine:\n" + output)
|
||||||
|
|
||||||
|
|
||||||
def ensure_on_clean_master() -> None:
|
def ensure_on_clean_main() -> None:
|
||||||
branch = get_git_branch()
|
branch = get_git_branch()
|
||||||
if branch != "master":
|
if branch != "main":
|
||||||
exit(f"You are still on a feature branch: {branch}")
|
exit(f"You are still on a feature branch: {branch}")
|
||||||
check_git_pristine()
|
check_git_pristine()
|
||||||
run("git fetch upstream master")
|
run("git fetch upstream main")
|
||||||
run("git rebase upstream/master")
|
run("git rebase upstream/main")
|
||||||
|
|
||||||
|
|
||||||
def create_pull_branch(pull_id: int) -> None:
|
def create_pull_branch(pull_id: int) -> None:
|
||||||
run("git fetch upstream pull/%d/head" % (pull_id,))
|
run("git fetch upstream pull/%d/head" % (pull_id,))
|
||||||
run(f"git checkout -B review-{pull_id} FETCH_HEAD")
|
run(f"git checkout -B review-{pull_id} FETCH_HEAD")
|
||||||
run("git rebase upstream/master")
|
run("git rebase upstream/main")
|
||||||
run("git log upstream/master.. --oneline")
|
run("git log upstream/main.. --oneline")
|
||||||
run("git diff upstream/master.. --name-status")
|
run("git diff upstream/main.. --name-status")
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print("PR: %d" % (pull_id,))
|
print("PR: %d" % (pull_id,))
|
||||||
|
@ -59,7 +59,7 @@ def review_pr() -> None:
|
||||||
except Exception:
|
except Exception:
|
||||||
exit("please provide an integer pull request id")
|
exit("please provide an integer pull request id")
|
||||||
|
|
||||||
ensure_on_clean_master()
|
ensure_on_clean_main()
|
||||||
create_pull_branch(pull_id)
|
create_pull_branch(pull_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class IRCBot(irc.bot.SingleServerIRCBot):
|
||||||
|
|
||||||
def connect(self, *args: Any, **kwargs: Any) -> None:
|
def connect(self, *args: Any, **kwargs: Any) -> None:
|
||||||
# Taken from
|
# Taken from
|
||||||
# https://github.com/jaraco/irc/blob/master/irc/client_aio.py,
|
# https://github.com/jaraco/irc/blob/main/irc/client_aio.py,
|
||||||
# in particular the method of AioSimpleIRCClient
|
# in particular the method of AioSimpleIRCClient
|
||||||
self.c = self.reactor.loop.run_until_complete(self.connection.connect(*args, **kwargs))
|
self.c = self.reactor.loop.run_until_complete(self.connection.connect(*args, **kwargs))
|
||||||
print("Listening now. Please send an IRC message to verify operation")
|
print("Listening now. Please send an IRC message to verify operation")
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# stdin in the form
|
# stdin in the form
|
||||||
# <oldrev> <newrev> <refname>
|
# <oldrev> <newrev> <refname>
|
||||||
# For example:
|
# For example:
|
||||||
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
|
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/main
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
|
@ -19,12 +19,12 @@ ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
# Returns a dictionary encoding the stream and subject to send the
|
# Returns a dictionary encoding the stream and subject to send the
|
||||||
# notification to (or None to send no notification).
|
# notification to (or None to send no notification).
|
||||||
#
|
#
|
||||||
# The default code below will send every commit pushed to "master" to
|
# The default code below will send every commit pushed to "main" to
|
||||||
# * stream "commits"
|
# * stream "commits"
|
||||||
# * topic "master"
|
# * topic "main"
|
||||||
# And similarly for branch "test-post-receive" (for use when testing).
|
# And similarly for branch "test-post-receive" (for use when testing).
|
||||||
def commit_notice_destination(repo: str, branch: str, commit: str) -> Optional[Dict[str, str]]:
|
def commit_notice_destination(repo: str, branch: str, commit: str) -> Optional[Dict[str, str]]:
|
||||||
if branch in ["master", "test-post-receive"]:
|
if branch in ["main", "test-post-receive"]:
|
||||||
return dict(stream=STREAM_NAME, subject=f"{branch}")
|
return dict(stream=STREAM_NAME, subject=f"{branch}")
|
||||||
|
|
||||||
# Return None for cases where you don't want a notice sent
|
# Return None for cases where you don't want a notice sent
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
# Zulip hook for Mercurial changeset pushes.
|
# Zulip hook for Mercurial changeset pushes.
|
||||||
#
|
#
|
||||||
# This hook is called when changesets are pushed to the master repository (ie
|
# This hook is called when changesets are pushed to the default repository (ie
|
||||||
# `hg push`). See https://zulip.com/integrations for installation instructions.
|
# `hg push`). See https://zulip.com/integrations for installation instructions.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -23,7 +23,7 @@ def format_summary_line(
|
||||||
information about the changeset and links to the changelog if a
|
information about the changeset and links to the changelog if a
|
||||||
web URL has been configured:
|
web URL has been configured:
|
||||||
|
|
||||||
Jane Doe <jane@example.com> pushed 1 commit to master (170:e494a5be3393):
|
Jane Doe <jane@example.com> pushed 1 commit to default (170:e494a5be3393):
|
||||||
"""
|
"""
|
||||||
revcount = tip - base
|
revcount = tip - base
|
||||||
plural = "s" if revcount > 1 else ""
|
plural = "s" if revcount > 1 else ""
|
||||||
|
|
|
@ -28,7 +28,7 @@ client = zulip.Client(
|
||||||
def get_deployment_details() -> Dict[str, str]:
|
def get_deployment_details() -> Dict[str, str]:
|
||||||
# "gear deployments" output example:
|
# "gear deployments" output example:
|
||||||
# Activation time - Deployment ID - Git Ref - Git SHA1
|
# Activation time - Deployment ID - Git Ref - Git SHA1
|
||||||
# 2017-01-07 15:40:30 -0500 - 9e2b7143 - master - b9ce57c - ACTIVE
|
# 2017-01-07 15:40:30 -0500 - 9e2b7143 - main - b9ce57c - ACTIVE
|
||||||
dep = subprocess.check_output(["gear", "deployments"], universal_newlines=True).splitlines()[1]
|
dep = subprocess.check_output(["gear", "deployments"], universal_newlines=True).splitlines()[1]
|
||||||
splits = dep.split(" - ")
|
splits = dep.split(" - ")
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ ZULIP_API_KEY = "0123456789abcdef0123456789abcdef"
|
||||||
# Returns a dictionary encoding the stream and subject to send the
|
# Returns a dictionary encoding the stream and subject to send the
|
||||||
# notification to (or None to send no notification).
|
# notification to (or None to send no notification).
|
||||||
#
|
#
|
||||||
# The default code below will send every commit pushed to "master" to
|
# The default code below will send every commit pushed to "main" to
|
||||||
# * stream "deployments"
|
# * stream "deployments"
|
||||||
# * topic "master"
|
# * topic "main"
|
||||||
# And similarly for branch "test-post-receive" (for use when testing).
|
# And similarly for branch "test-post-receive" (for use when testing).
|
||||||
def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
|
def deployment_notice_destination(branch: str) -> Optional[Dict[str, str]]:
|
||||||
if branch in ["master", "test-post-receive"]:
|
if branch in ["main", "master", "test-post-receive"]:
|
||||||
return dict(stream="deployments", subject=f"{branch}")
|
return dict(stream="deployments", subject=f"{branch}")
|
||||||
|
|
||||||
# Return None for cases where you don't want a notice sent
|
# Return None for cases where you don't want a notice sent
|
||||||
|
|
Loading…
Reference in a new issue