search
LoginSignup
4

More than 5 years have passed since last update.

posted at

svn、チケット駆動開発時のtrunkマージスクリプト

「refs #1234」とかでチケット番号に紐付けてコミットしていることを前提
引数にチケットの番号のみを渡してmerge_ticket.shを実行、trunkにマージされる幸せ(▰˘◡˘▰)

svn
└── huge
      ├── branches
      │     └──── 1.1
      └── trunk

script
├── merge_ticket.sh
└── svn
      └── merge_ticket_number.sh
merge_ticket.sh
#!/bin/bash

PWDDIR=`pwd`
cd $PWDDIR

# 開発ディレクトリ
DIR=/home/soramugi/svn/huge/branches/1.1/
# trunk
TRUNK=/home/soramugi/svn/huge/trunk/

source svn/merge_ticket_number.sh $*
merge_ticket_number.sh
#!/bin/bash

set -e

# チケット番号に紐付けてコミットしていることを前提
# 引数にチケットの番号のみを渡す

if [ "$1" = '' ]; then
  exit 1
fi

SERCHE=''
for i in $@
do
  if [ "$SERCHE" != '' ]; then
    SERCHE=$SERCHE'\|'
  fi
  SERCHE=$SERCHE'#'$i
done


cd $DIR
pwd
RIPOURL=`svn info | grep URL: | grep -o 'http.\+'`
/usr/bin/svn up
REVISIONS=`/usr/bin/svn log | /bin/grep -B 3 "$SERCHE" | /bin/grep -o '^r[0-9]\+' | /bin/grep -o '[0-9]\+' | sort -n`

echo $REVISIONS

cd $TRUNK
pwd
/usr/bin/svn up

/usr/bin/svn merge -c "$REVISIONS" $RIPOURL

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
4