Project

General

Profile

Patch #4262 » bzr-fixes-r3235.patch

Improved patch - Ivan Korotkov, 2009-12-24 13:37

View differences:

app/helpers/repositories_helper.rb (working copy)
91 91
                             :id => @project,
92 92
                             :path => path_param,
93 93
                             :rev => @changeset.revision) unless s || c.action == 'D'
94
        text << " - #{c.revision}" unless c.revision.blank?
94
        text << " - #{c.revision}" unless c.revision.blank? or c.revision.length > 8
95 95
        text << ' (' + link_to('diff', :controller => 'repositories',
96 96
                                       :action => 'diff',
97 97
                                       :id => @project,
......
173 173
  end
174 174

  
175 175
  def bazaar_field_tags(form, repository)
176
      content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)))
176
      content_tag('p', form.text_field(:url, :label => 'Branch location', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)) +
177
                       '<br />(local path, http://, https://)')
177 178
  end
178 179
  
179 180
  def filesystem_field_tags(form, repository)
app/models/repository/bazaar.rb (working copy)
28 28
  def self.scm_name
29 29
    'Bazaar'
30 30
  end
31
  
31

  
32
  def latest_changesets(path, rev, limit=10)
33
    if path.blank?
34
      changesets.find(:all, :include => :user,
35
                            :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
36
                            :limit => limit)
37
    else
38
      entry = changes.first(:conditions => ["path = ?", path.with_leading_slash], :limit => 1)
39
      return [] unless entry
40
      changes.find(:all, :include => {:changeset => :user}, 
41
                         :conditions => ["changes.revision = ?", entry.revision],
42
                         :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
43
                         :limit => limit).collect(&:changeset)
44
    end
45
  end
46

  
32 47
  def entries(path=nil, identifier=nil)
33 48
    entries = scm.entries(path, identifier)
34 49
    if entries
......
42 57
        c = Change.find(:first,
43 58
                        :include => :changeset,
44 59
                        :conditions => ["#{Change.table_name}.revision = ? and #{Changeset.table_name}.repository_id = ?", e.lastrev.revision, id],
45
                        :order => "#{Changeset.table_name}.revision DESC")
60
                        :order => "#{Changeset.table_name}.committed_on DESC")
46 61
        if c
47 62
          e.lastrev.identifier = c.changeset.revision
48 63
          e.lastrev.name = c.changeset.revision
......
79 94
                Change.create(:changeset => changeset,
80 95
                              :action => change[:action],
81 96
                              :path => change[:path],
97
                              :from_path => change[:from_path],
98
                              :from_revision => change[:from_revision],
82 99
                              :revision => change[:revision])
83 100
              end
84 101
            end
lib/redmine/scm/adapters/bazaar_adapter.rb (working copy)
77 77
          identifier_from = 'last:1' unless identifier_from and identifier_from.to_i > 0
78 78
          identifier_to = 1 unless identifier_to and identifier_to.to_i > 0
79 79
          revisions = Revisions.new
80
          cmd = "#{BZR_BIN} log -v --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}"
80
          cmd = "#{BZR_BIN} log --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}"
81
          cmd << " -v" if options[:with_paths]
82
          cmd << " --limit #{options[:limit].to_i}" if options[:limit]
81 83
          shellout(cmd) do |io|
82 84
            revision = nil
83 85
            parsing = nil
......
117 119
                      when 'removed'
118 120
                        revision.paths << {:action => 'D', :path => "/#{path}", :revision => revid}
119 121
                      when 'renamed'
120
                        new_path = path.split('=>').last
121
                        revision.paths << {:action => 'M', :path => "/#{new_path.strip}", :revision => revid} if new_path
122
                        old_path, new_path = path.split('=>')                      
123
                        if new_path
124
                          revision.paths << {:action => 'R', 
125
                                             :path => "/#{new_path.strip}", 
126
                                             :revision => revid,
127
                                             :from_path => "/#{old_path.strip}"}
128
                        end
122 129
                      end
123 130
                    end
124 131
                  end
(3-3/3)