LoginSignup
4
4

More than 5 years have passed since last update.

SVNからGitへ移行した際のタグ付けを行うスクリプト

Posted at

SVNからGitへ移行した際のタグ付けを行うスクリプト

SVNに全然タグが打たれてないじゃない!

Ω ΩΩ< な、なんだってー!!

wikiに書かれてた

リビジョンとリリースバージョンがwikiに記載されてた

スクリプトでタグ付けする

wikiを元に,リビジョンとタグの名前をリスト化

gittags.txtは,リビジョン番号とタグの名前をスペース区切りで記載していく

gittags.txt
1207 v1.4.0
1104 v1.3.9
900 v1.3.8
864 v1.3.7
743 v1.3.6
644 v1.3.5
845 v1.3.4
521 v1.3.3
500 v1.3.2
452 v1.3.1
240 v1.3.0
102 v1.2.8
100 v1.2.7

タグの作成スクリプト

trunk@リビジョン番号 というコミットメッセージを元に,該当のGitハッシュを検索

create_tags.sh
#!/bin/bash

# gittags.txtから読み込んむ
[ -f gittags.txt ] || exit 1
while read line
do 
  # 配列に入れる
  a=($line)

  # gitの対象リビジョンを取得
  hash=`git log --grep "trunk@${a[0]} " | sed -n -e "s/^commit\s\(.\+\)/\1/p"`

  # タグ付け
  git tag ${a[1]} ${hash}
done < gittags.txt

間違えてタグ付けしてしまったときの全削除スクリプト

delete_tags.sh
#!/bin/bash

array=`git tag`
git tag -d $array
4
4
0

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
  3. You can use dark theme
What you can do with signing up
4
4