Commit 9c85bf77 authored by Marcus D. Hanwell's avatar Marcus D. Hanwell

ENH: Deprecate the git stage aliases.

We have moved to Gerrit and so the stage aliases are no longer required.
The instructions at show the updated
workflow. The gerrit-push alias should be used in conjunction with the
Gerrit interface for review and merging of changes.

Change-Id: Ic142ab8e6c7a80922a31496b663e5b45b094d1f3
parent a41a4d09
......@@ -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
. "$(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)
die "Gerrit remote not set."
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."
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