English 中文(简体)
Can status 方法来自 Svn::: 用户 ::: Cextext 返回一个数组
原标题:Can status method from Svn::Client::Context return an array
  • 时间:2012-05-27 19:23:11
  •  标签:
  • ruby
  • svn

我试图使用红宝石 s SVN 绑定来获取文件的承付日期。 下面的代码有效 。 但是, 我并不满足于需要使用块来获取状态方法的结果这一事实 。 是否有更好的方法?

ctx = Svn::Client::Context.new()
ctx.add_simple_prompt_provider(2) do |cred, realm, user_name, may_save|
  cred.username = "sorin"
  cred.password = "realyniftypassword"
end

svndate = nil
ctx.status(path, "HEAD", true, true) do |path, status| 
    break if status.entry.nil?
    svndate = status.entry.cmt_date
end 

next if svndate.nil?

我在找一样的东西,比如:

svndate = ctx.status(path, "HEAD", true, true)[0].entry.cmt_date

但 ctx. status 返回整数。

是否有更合适的方法?

我使用 Ubuntu deb 套件 libsvn-ruby1.8, 除了网上的几个例子之外, 我找不到任何文件。

问题回答

未来参考一下,有一个鲁比宝石 可能有所帮助。

http://rubygems.org/gems/svn_wc
https://github.com/dvwright/svn_wc/

require  svn_wc 
conf = {
  "svn_repo_master"       => "svn+ssh://[email protected]/opt/repo",
  "svn_user"              => "sorin",
  "svn_pass"              => "realyniftypassword",
  "svn_repo_working_copy" => "/tmp/local_working_repo/root",
  #"svn_repo_config_path"  => "/tmp/my_config"
}

svn = SvnWc::RepoAccess.new YAML::dump(conf)
repo_wc = conf[ svn_repo_working_copy ]
svn.list_entries(repo_wc, nil, verbose=true).each do |info|
  puts "#{info[:entry_name]} #{info[:cmt_date]}"
end




相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签