end\r
\r
class Base\r
- @url = nil\r
- @login = nil\r
- @password = nil\r
\r
def initialize(url, login=nil, password=nil)\r
@url = url\r
identifier = 'HEAD' unless identifier and identifier > 0\r
entries = Entries.new\r
cmd = "svn list --xml #{target(path)}@#{identifier}"\r
+ cmd << " --username #{@login} --password #{@password}" if @login\r
shellout(cmd) do |io|\r
begin\r
doc = REXML::Document.new(io)\r
identifier_from = 'HEAD' unless identifier_from and identifier_from.to_i > 0\r
identifier_to = 1 unless identifier_to and identifier_to.to_i > 0\r
revisions = Revisions.new\r
- cmd = "svn log --xml -r #{identifier_from}:#{identifier_to} "\r
- cmd << "--verbose " if options[:with_paths]\r
+ cmd = "svn log --xml -r #{identifier_from}:#{identifier_to}"\r
+ cmd << " --username #{@login} --password #{@password}" if @login\r
+ cmd << " --verbose " if options[:with_paths]\r
cmd << target(path)\r
shellout(cmd) do |io|\r
begin\r
cmd << "#{identifier_to}:"\r
cmd << "#{identifier_from}"\r
cmd << "#{target(path)}@#{identifier_from}"\r
+ cmd << " --username #{@login} --password #{@password}" if @login\r
diff = []\r
shellout(cmd) do |io|\r
io.each_line do |line|\r
def cat(path, identifier=nil)\r
identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"\r
cmd = "svn cat #{target(path)}@#{identifier}"\r
+ cmd << " --username #{@login} --password #{@password}" if @login\r
cat = nil\r
shellout(cmd) do |io|\r
cat = io.read\r
\r
def shellout(cmd, &block)\r
logger.debug "Shelling out: #{cmd}" if logger && logger.debug?\r
- IO.popen(cmd) do |io|\r
+ IO.popen(cmd, "r+") do |io|\r
+ io.close_write\r
block.call(io) if block_given?\r
end\r
end\r
<div id="repository">
<% fields_for :repository, @project.repository, { :builder => TabularFormBuilder, :lang => current_language} do |repository| %>
<p><%= repository.text_field :url, :size => 60, :required => true %><br />(http://, https://, svn://, file:///)</p>
+<p><%= repository.text_field :login, :size => 30 %></p>
+<p><%= repository.password_field :password, :size => 30 %></p>
<% end %>
</div>
<%= javascript_tag "Element.hide('repository');" if @project.repository.nil? %>
--- /dev/null
+class AddRepositoryLoginAndPassword < ActiveRecord::Migration
+ def self.up
+ add_column :repositories, :login, :string, :limit => 60, :default => ""
+ add_column :repositories, :password, :string, :limit => 60, :default => ""
+ end
+
+ def self.down
+ remove_column :repositories, :login
+ remove_column :repositories, :password
+ end
+end