開発したアプリなど一覧

Github で管理してる WordPress プラグインを SVN のリポジトリにコミットする

アフィリエイトリンクを含む場合があります

僕は普段バージョン管理システムには git を使用しているのですが、 WordPress のプラグインを公式に登録するには Subversion を使用しないといけない。なので git svn コマンドを使ってゴニョゴニョした。

github にリポジトリを用意

ボタン押していくだけなので省略

SVN と接続

svn log プラグインリポジトリの URL とコマンド打つ。

$ svn log http://plugins.svn.wordpress.org/simpleapplinks/ ------------------------------------------------------------------------ r1011796 | plugin-master | 2014-10-22 07:41:13 +0900 (Wed, 22 Oct 2014) | 1 line

adding simpleapplinks by ryomatsu ------------------------------------------------------------------------

この r から始まる数字リビジョン番号というのかな、git svn clone する際にこの数字を使用します。

$ git svn clone --no-minimize-url -s -r1011796 http://plugins.svn.wordpress.org/simpleapplinks/ WARNING: --prefix is not given, defaulting to empty prefix. This is probably not what you want! In order to stay compatible with regular remote-tracking refs, provide a prefix like --prefix=origin/ (remember the trailing slash), which will cause the SVN-tracking refs to be placed at refs/remotes/origin/*. NOTE: In Git v2.0, the default prefix will change from empty to 'origin/'. Initialized empty Git repository in /home/ryomatsu/project/simpleapplinks/simpleapplinks/.git/ r1011796 = 1cb72a9c49e46860328b81fc987411f0cd35f4c8 (refs/remotes/trunk) Checked out HEAD: http://plugins.svn.wordpress.org/simpleapplinks/trunk r1011796

これでローカルにリポジトリができた。cd しよう。

$ cd simpleapplinks $ ls -al total 12 drwxrwxr-x 3 ryomatsu ryomatsu 4096 Oct 22 22:28 . drwxrwxr-x 6 ryomatsu ryomatsu 4096 Oct 22 22:28 .. drwxrwxr-x 9 ryomatsu ryomatsu 4096 Oct 22 22:28 .git

svn リビジョンを取得しよう。git svn rebase はいらないかもしれないが一応。

$ git svn fetch --all $ git svn rebase Current branch master is up to date.

github との接続

github に保存されているプロジェクトを取得してこよう。

$ git remote add origin git@github.com:ryomatsu/SimpleAppLinks.git $ git fetch origin Enter passphrase for key '/home/ryomatsu/.ssh/id_rsa_github_ryomatsu': warning: no common commits remote: Counting objects: 29, done. remote: Compressing objects: 100% (20/20), done. remote: Total 29 (delta 9), reused 29 (delta 9) Unpacking objects: 100% (29/29), done. From github.com:ryomatsu/SimpleAppLinks * [new branch] master -> origin/master $ git branch --all * master remotes/origin/master remotes/trunk

取得できたら SVN へ rebase しよう。

$ git rebase --onto remotes/trunk --root remotes/origin/master First, rewinding head to replay your work on top of it... Applying: first commit Applying: change powerdby link's default setting to false Applying: fix plugin's name Applying: add readme and screenshot Applying: fix stable tag in readme.txt Applying: fix a bug that return 500 error when display iOS and Mac App Store if review is a few $

git log を見たらバージョンが古いのでアップデートのためのブランチを作成し、マージ。

$ git branch --all * (no branch) master remotes/origin/master remotes/trunk $ git checkout -b git-merge Switched to a new branch 'git-merge' $ git checkout master Switched to branch 'master' $ git merge git-merge Updating 1cb72a9..96911a9 Fast-forward README.md | 7 + ... $ git branch -d git-merge Deleted branch git-merge (was 96911a9).

SVN と GitHub へコミット

WordPress 公式のプラグインリポジトリへコミットします。git と違って commit でサーバに push までやってくれますね。

$ git svn dcommit

それから github へも -f をつけて push する。

$ git push -f origin master

これでおk

ついでにタグつけてバージョンを指定する(でいいのかなこれ。。)。

$ git tag 1.0 $ git svn tag 1.0 Copying http://plugins.svn.wordpress.org/simpleapplinks/trunk at r1012137 to http://plugins.svn.wordpress.org/simpleapplinks/tags/1.0... Found possible branch point: http://plugins.svn.wordpress.org/simpleapplinks/trunk => http://plugins.svn.wordpress.org/simpleapplinks/tags/1.0, 1012137 Found branch parent: (refs/remotes/tags/1.0) 9c010522ea0e1c0ccf7f49fc10c3d4787f403ef4 Following parent with do_switch Successfully followed parent r1014259 = 79502b39865ad8f237e463f84892501550e91e84 (refs/remotes/tags/1.0)

あとは元記事ではプラグインバナー等を保存する Assets ディレクトリの扱い方が書かれている。自分のプラグインは特に作成する予定が無いので省略。

WordPress Plugin Development with Git/GitHub

svn 久しぶりに触った、というか git-svn は初めてだ...。とりあえずこれで使えるようにはなった。

Sponsored Link

コメント

タイトルとURLをコピーしました