Project

General

Profile

Patch #4262 » bzr-fixes.patch

Ivan Korotkov, 2009-11-22 00:54

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,
98 98
                                       :path => path_param,
99 99
                                       :rev => @changeset.revision) + ') ' if c.action == 'M'
100 100
        text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank?
101
        text << " - #{c.revision}" unless c.revision.blank? or c.revision.length <= 8
101 102
      end
102 103
      output << "<li class='#{style}'>#{text}</li>"
103 104
      output << render_changes_tree(tree[file][:s]) if s
......
173 174
  end
174 175

  
175 176
  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?)))
177
      content_tag('p', form.text_field(:url, :label => 'Branch location', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)) +
178
                       '<br />(local path, http://, https://)')
177 179
  end
178 180
  
179 181
  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 78
          identifier_from = 'last:1' unless identifier_from and identifier_from.to_i > 0
78 79
          identifier_to = 1 unless identifier_to and identifier_to.to_i > 0
79 80
          revisions = Revisions.new
80
          cmd = "#{BZR_BIN} log -v --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}"
81
          cmd = "#{BZR_BIN} log --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}"
82
          cmd << " -v" if options[:with_paths]
83
          cmd << " --limit #{options[:limit].to_i}" if options[:limit]
81 84
          shellout(cmd) do |io|
82 85
            revision = nil
83 86
            parsing = nil
......
117 120
                      when 'removed'
118 121
                        revision.paths << {:action => 'D', :path => "/#{path}", :revision => revid}
119 122
                      when 'renamed'
120
                        new_path = path.split('=>').last
121
                        revision.paths << {:action => 'M', :path => "/#{new_path.strip}", :revision => revid} if new_path
123
                        old_path, new_path = path.split('=>')                      
124
                        if new_path
125
                          revision.paths << {:action => 'R', 
126
                                             :path => "/#{new_path.strip}", 
127
                                             :revision => revid,
128
                                             :from_path => "/#{old_path.strip}"}
129
                        end
122 130
                      end
123 131
                    end
124 132
                  end
(2-2/3)