Index: app/helpers/repositories_helper.rb =================================================================== --- app/helpers/repositories_helper.rb (revision 3083) +++ app/helpers/repositories_helper.rb (working copy) @@ -91,13 +91,14 @@ :id => @project, :path => path_param, :rev => @changeset.revision) unless s || c.action == 'D' - text << " - #{c.revision}" unless c.revision.blank? + text << " - #{c.revision}" unless c.revision.blank? or c.revision.length > 8 text << ' (' + link_to('diff', :controller => 'repositories', :action => 'diff', :id => @project, :path => path_param, :rev => @changeset.revision) + ') ' if c.action == 'M' text << ' ' + content_tag('span', c.from_path, :class => 'copied-from') unless c.from_path.blank? + text << " - #{c.revision}" unless c.revision.blank? or c.revision.length < 8 end output << "
  • #{text}
  • " output << render_changes_tree(tree[file][:s]) if s @@ -173,7 +174,8 @@ end def bazaar_field_tags(form, repository) - content_tag('p', form.text_field(:url, :label => 'Root directory', :size => 60, :required => true, :disabled => (repository && !repository.new_record?))) + content_tag('p', form.text_field(:url, :label => 'Branch location', :size => 60, :required => true, :disabled => (repository && !repository.new_record?)) + + '
    (local path, http://, https://)') end def filesystem_field_tags(form, repository) Index: app/models/repository/bazaar.rb =================================================================== --- app/models/repository/bazaar.rb (revision 3083) +++ app/models/repository/bazaar.rb (working copy) @@ -28,7 +28,22 @@ def self.scm_name 'Bazaar' end - + + def latest_changesets(path, rev, limit=10) + if path.blank? + changesets.find(:all, :include => :user, + :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", + :limit => limit) + else + entry = changes.first(:conditions => ["path = ?", path.with_leading_slash], :limit => 1) + return [] unless entry + changes.find(:all, :include => {:changeset => :user}, + :conditions => ["changes.revision = ?", entry.revision], + :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC", + :limit => limit).collect(&:changeset) + end + end + def entries(path=nil, identifier=nil) entries = scm.entries(path, identifier) if entries @@ -42,7 +57,7 @@ c = Change.find(:first, :include => :changeset, :conditions => ["#{Change.table_name}.revision = ? and #{Changeset.table_name}.repository_id = ?", e.lastrev.revision, id], - :order => "#{Changeset.table_name}.revision DESC") + :order => "#{Changeset.table_name}.committed_on DESC") if c e.lastrev.identifier = c.changeset.revision e.lastrev.name = c.changeset.revision @@ -79,6 +94,8 @@ Change.create(:changeset => changeset, :action => change[:action], :path => change[:path], + :from_path => change[:from_path], + :from_revision => change[:from_revision], :revision => change[:revision]) end end Index: lib/redmine/scm/adapters/bazaar_adapter.rb =================================================================== --- lib/redmine/scm/adapters/bazaar_adapter.rb (revision 3083) +++ lib/redmine/scm/adapters/bazaar_adapter.rb (working copy) @@ -77,7 +78,9 @@ identifier_from = 'last:1' unless identifier_from and identifier_from.to_i > 0 identifier_to = 1 unless identifier_to and identifier_to.to_i > 0 revisions = Revisions.new - cmd = "#{BZR_BIN} log -v --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}" + cmd = "#{BZR_BIN} log --show-ids -r#{identifier_to.to_i}..#{identifier_from} #{target(path)}" + cmd << " -v" if options[:with_paths] + cmd << " --limit #{options[:limit].to_i}" if options[:limit] shellout(cmd) do |io| revision = nil parsing = nil @@ -117,8 +120,13 @@ when 'removed' revision.paths << {:action => 'D', :path => "/#{path}", :revision => revid} when 'renamed' - new_path = path.split('=>').last - revision.paths << {:action => 'M', :path => "/#{new_path.strip}", :revision => revid} if new_path + old_path, new_path = path.split('=>') + if new_path + revision.paths << {:action => 'R', + :path => "/#{new_path.strip}", + :revision => revid, + :from_path => "/#{old_path.strip}"} + end end end end