subversion-ruby-binding の実験。
いろいろな検索しても決定的な API 説明サイトはみつからない。
- http://www.oneofthewolves.com/2007/04/24/acts-as-subversioned-the-future/
> > One of the Wolves » Acts as Subversioned: The Future.
ActiveRecord として subversion を利用する plugin があるらしい。
download してみたが、使い方(テスト動作のさせかた)が不明。
私が ActiveRecord について理解ができてないのが原因だ。
また、
- http://collaboa.org/download
という プログラムソースには ./lib/actionsubversion/lib 以下に subversion を扱って
いる例がある。これを読んで勉強してみようとおもう。
断片情報でつくってみた実験コード。
$ cat access.rb
require "svn/core"
require "svn/client"
require "svn/repos"
require "svn/info"
require 'pp'
#-----------
# See http://www.oneofthewolves.com/2007/03/06/ruby-subversion-bindings-finally-some-documentation/
#-----------
reppath= "file:///usr/local/svn-reps"
reppath= "/usr/local/svn-reps"
# repos = Svn::Repos.create(h/path/where/repsitory/should/be/createdh)
repos = Svn::Repos.open(reppath)
pp repos
info = Svn::Info.new(reppath, repos.fs.youngest_rev)
diffs = info.diffs
pp diffs
#-----------
# See http://hisashim.livejournal.com/2007/07/24/
#----------
path= "/Users/kato/zzz/test2/svn-reps/test"
Svn::Client::Context.new.log(path, 10, "head", 100, false, false) { |changed_paths, rev, author, date, message|
p [changed_paths, rev, author, date, message]
}
#-------------
# See http://svn.collab.net/viewvc/svn/trunk/tools/hook-scripts/commit-email.rb
#-------------
entries,props = Svn::Ra::Session#dir(path, nil)
pp entries
pp props
走らせてみた例。
$ ruby access.rb
#<SWIG::TYPE_p_svn_repos_t:0x14dba10>
{"test/test01.txt"=>
{:added=>
#<Svn::Info::DiffEntry:0x14d3888
@added_line=2,
@body=
"--- test/test01.txt¥t2007-08-25 13:06:09 JST (rev 46)¥n+++ test/test01.txt¥t2007-08-25 15:21:32 JST (rev 47)¥n@@ -0,0 +1,2 @@¥n+aaa¥n+bbb¥n",
@deleted_line=0,
@type=:added>},
"test/test02.txt"=>
{:added=>
#<Svn::Info::DiffEntry:0x14d078c
@added_line=2,
@body=
"--- test/test02.txt¥t2007-08-25 13:06:09 JST (rev 46)¥n+++ test/test02.txt¥t2007-08-25 15:21:32 JST (rev 47)¥n@@ -0,0 +1,2 @@¥n+aaa¥n+bbb¥n",
@deleted_line=0,
@type=:added>},
"test/test.txt"=>
{:modified=>
#<Svn::Info::DiffEntry:0x14d6aec
@added_line=1,
@body=
"--- test/test.txt¥t2007-08-25 13:06:09 JST (rev 46)¥n+++ test/test.txt¥t2007-08-25 15:21:32 JST (rev 47)¥n@@ -1 +1,2 @@¥n aaa¥n+bbb¥n",
@deleted_line=0,
@type=:modified>}}
[nil, 46, "kato", Sat Aug 25 13:06:09 +0900 2007, "test"]
[nil, 47, "", Sat Aug 25 15:21:32 +0900 2007, "commmit"]
SWIG::TYPE_p_svn_ra_session_t
nil
最近のコメント