Commit b629b129 authored by Brad King's avatar Brad King Committed by Code Review

Merge topic 'update-development-aliases' into master

9c85bf77 ENH: Deprecate the git stage aliases.
parents b74425b7 9c85bf77
......@@ -12,13 +12,10 @@ ${GITCONFIG} alias.pullall "!sh -c \"git pull && git submodule update --init\""
${GITCONFIG} alias.prepush 'log --graph --stat origin/master..'
# Staging aliases
stage_cmd="ssh git@${projectUrl} stage ${project}"
git_branch="\$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')"
${GITCONFIG} alias.stage-cmd "!${stage_cmd}"
${GITCONFIG} alias.stage-push "!sh -c \"git fetch stage --prune && git push stage HEAD\""
${GITCONFIG} alias.stage-branch "!sh -c \"${stage_cmd} print\""
${GITCONFIG} alias.stage-merge-next "!sh -c \"${stage_cmd} merge -b next ${git_branch}\""
${GITCONFIG} alias.stage-merge "!sh -c \"${stage_cmd} merge ${git_branch}\""
stage_deprecated="The stage aliases have been deprecated. Please use Gerrit."
${GITCONFIG} alias.stage-cmd "!sh -c \"echo ${stage_deprecated}\""
${GITCONFIG} alias.stage-push "!sh -c \"echo ${stage_deprecated}\""
${GITCONFIG} alias.stage-branch "!sh -c \"echo ${stage_deprecated}\""
${GITCONFIG} alias.stage-merge "!sh -c \"echo ${stage_deprecated}\""
# Alias to push the current topic branch to Gerrit
${GITCONFIG} alias.gerrit-push "!bash Utilities/Scripts/git-gerrit-push"
${GITCONFIG} alias.gerrit-merge "!bash Utilities/Scripts/git-gerrit-merge"
#!/usr/bin/env bash
die() {
echo 'gerrit-merge failure' 1>&2
echo '--------------------' 1>&2
echo '' 1>&2
echo "$@" 1>&2
exit 1
}
remote=gerrit
SUBDIRECTORY_OK=Yes
. "$(git --exec-path)/git-sh-setup"
topic="$(git symbolic-ref HEAD | sed -e 's|^refs/heads/||')"
# Provide a method to check if a patch is present in Gerrit, show its status
gerrit_remote=$(git config remote.gerrit.url)
if test -n "$gerrit_remote"; then
gerrit_url=$(echo $gerrit_remote | cut -d ':' -f 1)
gerrit_project=$(echo $gerrit_remote | cut -d ':' -f 2)
else
die "Gerrit remote not set."
fi
ssh $gerrit_url gerrit ls-projects >/dev/null || die "Could not connect to Gerrit."
head_sha=$(git rev-parse HEAD)
commit_count=$(ssh $gerrit_url gerrit query -- commit:$head_sha | \
awk '/rowCount/ { print $2 }')
if test "$commit_count" -lt 1; then
read -ep "Are you sure you want to merge '$topic' to VTK master? [N/y]: " merge_it
if test "$merge_it" != "y" -a "$merge_it" != "Y"; then
die "Merge cancelled."
fi
fi
echo "Merging topic '$topic' into VTK master."
git stage-push && git stage-merge
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment