[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg-devel
Subject:    [PATCH] release.sh: remove "git push origin" policy, replace with
From:       peter.hutterer () who-t ! net (Peter Hutterer)
Date:       2009-07-30 1:38:20
Message-ID: 20090730013815.GA10735 () dingo ! bne ! redhat ! com
[Download RAW message or body]

Running 'git push origin' at the end of the script will push changes on the
master branch - even if the release is supposed to be a stable branch
release. This may result in not-yet-ready changes being pushed to master.

This patch removes this default git push policy and replaces it with a
warning message if the object belonging to the tag is not on the remote yet.
Requirements: the tag must be on the currently checked-out branch, it is not
possible to cut a branch release from master anymore.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
The check that the tagged object is in origin/branchname seems a bit clumsy,
better suggestions appreciated.

 release.sh |   28 ++++++++++++++++++++++++++--
 1 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/release.sh b/release.sh
index 71efa72..0065cf6 100755
--- a/release.sh
+++ b/release.sh
@@ -129,6 +129,31 @@ if [ "x$ignorechanges" != "x1" ]; then
     set -e
 fi
 
+# Check if the object has been pushed. Do do so
+# 1. Check if the current branch has the object. If not, abort.
+# 2. Check if the object is on origin/branchname. If not, abort.
+local_sha=`git rev-list -1 $tag_current`
+current_branch=`git branch | grep "\*" | sed -e "s/\* //"`
+set +e
+git rev-list $current_branch | grep $local_sha > /dev/null
+if [ $? -eq 1 ]; then
+    echo "Cannot find tag '$tag_current' on current branch. Aborting."
+    echo "Switch to the correct branch and re-run the script."
+    exit 1
+fi
+
+revs=`git rev-list origin/$current_branch..$current_branch | wc -l`
+if [ $revs -ne 0 ]; then
+    git rev-list origin/$current_branch..$current_branch | grep $local_sha > /dev/null
+
+    if [ $? -ne 1 ]; then
+        echo "origin/$current_branch doesn't have object $local_sha"
+        echo "for tag '$tag_current'. Did you push branch first? Aborting."
+        exit 1
+    fi
+fi
+set -e
+
 tarball_dir="$(dirname $(find . -name config.status))"
 module="${tag_current%-*}"
 if [ "x$module" = "x$tag_current" ]; then
@@ -199,7 +224,6 @@ echo "    at: $announce"
 echo "installing release into server"
 scp $tarball_dir/$targz $tarball_dir/$tarbz2 $user@$host_people:$srv_path
 
-echo "pushing changes upstream"
-git push origin
+echo "pushing tag upstream"
 git push origin $tag_current
 
-- 
1.6.3.rc1.2.g0164.dirty


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic