mirror of https://github.com/zulip/zulip.git
upgrade-zulip-from-git: Extract code to set zulip upstream remote.
This commit is contained in:
parent
3853a8bf20
commit
96e42b8e81
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
upstream_url="https://github.com/zulip/zulip.git"
|
||||||
|
if ! git remote | grep -qx upstream; then
|
||||||
|
git remote add upstream "$upstream_url"
|
||||||
|
else
|
||||||
|
git remote set-url upstream "$upstream_url"
|
||||||
|
fi
|
||||||
|
|
||||||
|
git fetch --prune --quiet --tags --all
|
|
@ -25,8 +25,9 @@ from scripts.lib.zulip_tools import (
|
||||||
|
|
||||||
config_file = get_config_file()
|
config_file = get_config_file()
|
||||||
deploy_options = get_deploy_options(config_file)
|
deploy_options = get_deploy_options(config_file)
|
||||||
upstream_url = "https://github.com/zulip/zulip.git"
|
remote_url = get_config(
|
||||||
remote_url = get_config(config_file, "deployment", "git_repo_url", upstream_url)
|
config_file, "deployment", "git_repo_url", "https://github.com/zulip/zulip.git"
|
||||||
|
)
|
||||||
|
|
||||||
assert_running_as_root(strip_lib_from_paths=True)
|
assert_running_as_root(strip_lib_from_paths=True)
|
||||||
|
|
||||||
|
@ -132,21 +133,7 @@ try:
|
||||||
preexec_fn=su_to_zulip,
|
preexec_fn=su_to_zulip,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Ensure upstream remote is configured; we need this to make `git describe` accurate.
|
subprocess.check_call(["./scripts/lib/update-git-upstream"], preexec_fn=su_to_zulip)
|
||||||
remotes = subprocess.check_output(["git", "remote"], preexec_fn=su_to_zulip).split(b"\n")
|
|
||||||
if b"upstream" not in remotes:
|
|
||||||
subprocess.check_call(
|
|
||||||
["git", "remote", "add", "upstream", upstream_url], preexec_fn=su_to_zulip
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
subprocess.check_call(
|
|
||||||
["git", "remote", "set-url", "upstream", upstream_url], preexec_fn=su_to_zulip
|
|
||||||
)
|
|
||||||
|
|
||||||
logging.info("Fetching the latest commits")
|
|
||||||
subprocess.check_call(
|
|
||||||
["git", "fetch", "--prune", "--quiet", "--tags", "--all"], preexec_fn=su_to_zulip
|
|
||||||
)
|
|
||||||
|
|
||||||
# Generate the deployment directory via git worktree from our local repository.
|
# Generate the deployment directory via git worktree from our local repository.
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue