comparison app/models/repository/darcs.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbce1fd3b1b7
children 51d7f3e06556 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # Redmine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang 2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
18 require 'redmine/scm/adapters/darcs_adapter' 18 require 'redmine/scm/adapters/darcs_adapter'
19 19
20 class Repository::Darcs < Repository 20 class Repository::Darcs < Repository
21 validates_presence_of :url, :log_encoding 21 validates_presence_of :url, :log_encoding
22 22
23 def self.human_attribute_name(attribute_key_name) 23 def self.human_attribute_name(attribute_key_name, *args)
24 attr_name = attribute_key_name 24 attr_name = attribute_key_name.to_s
25 if attr_name == "url" 25 if attr_name == "url"
26 attr_name = "path_to_repository" 26 attr_name = "path_to_repository"
27 end 27 end
28 super(attr_name) 28 super(attr_name, *args)
29 end 29 end
30 30
31 def self.scm_adapter_class 31 def self.scm_adapter_class
32 Redmine::Scm::Adapters::DarcsAdapter 32 Redmine::Scm::Adapters::DarcsAdapter
33 end 33 end
64 entry.lastrev.time = changeset.committed_on 64 entry.lastrev.time = changeset.committed_on
65 entry.lastrev.author = changeset.committer 65 entry.lastrev.author = changeset.committer
66 end 66 end
67 end 67 end
68 end 68 end
69 load_entries_changesets(entries)
69 entries 70 entries
70 end 71 end
71 72
72 def cat(path, identifier=nil) 73 def cat(path, identifier=nil)
73 patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s) 74 patch = identifier.nil? ? nil : changesets.find_by_revision(identifier.to_s)
77 def diff(path, rev, rev_to) 78 def diff(path, rev, rev_to)
78 patch_from = changesets.find_by_revision(rev) 79 patch_from = changesets.find_by_revision(rev)
79 return nil if patch_from.nil? 80 return nil if patch_from.nil?
80 patch_to = changesets.find_by_revision(rev_to) if rev_to 81 patch_to = changesets.find_by_revision(rev_to) if rev_to
81 if path.blank? 82 if path.blank?
82 path = patch_from.changes.collect{|change| change.path}.join(' ') 83 path = patch_from.filechanges.collect{|change| change.path}.join(' ')
83 end 84 end
84 patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil 85 patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil
85 end 86 end
86 87
87 def fetch_changesets 88 def fetch_changesets