scm: mercurial: rewrite MercurialAdapter#info by using helper extention (#4455).
Contributed by Yuya Nishihara. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4846 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
40d72c354a
commit
608025fd04
|
@ -79,18 +79,10 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
def info
|
def info
|
||||||
cmd = "#{self.class.sq_bin} -R #{target('')} root"
|
tip = summary['repository']['tip']
|
||||||
root_url = nil
|
Info.new(:root_url => CGI.unescape(summary['repository']['root']),
|
||||||
shellout(cmd) do |io|
|
:lastrev => Revision.new(:revision => tip['revision'],
|
||||||
root_url = io.read
|
:scmid => tip['node']))
|
||||||
end
|
|
||||||
return nil if $? && $?.exitstatus != 0
|
|
||||||
info = Info.new({:root_url => root_url.chomp,
|
|
||||||
:lastrev => revisions(nil,nil,nil,{:limit => 1}).last
|
|
||||||
})
|
|
||||||
info
|
|
||||||
rescue CommandFailed
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def summary
|
def summary
|
||||||
|
|
|
@ -47,7 +47,7 @@ begin
|
||||||
REPOSITORY_PATH + "//"].each do |repo|
|
REPOSITORY_PATH + "//"].each do |repo|
|
||||||
adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo)
|
adp = Redmine::Scm::Adapters::MercurialAdapter.new(repo)
|
||||||
assert_equal REPOSITORY_PATH, adp.info.root_url
|
assert_equal REPOSITORY_PATH, adp.info.root_url
|
||||||
# assert_equal '16', adp.info.lastrev.revision
|
assert_equal '16', adp.info.lastrev.revision
|
||||||
assert_equal '4cddb4e45f52',adp.info.lastrev.scmid
|
assert_equal '4cddb4e45f52',adp.info.lastrev.scmid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue