comparison app/models/.svn/text-base/repository.rb.svn-base @ 119:8661b858af72

* Update to Redmine trunk rev 4705
author Chris Cannam
date Thu, 13 Jan 2011 14:12:06 +0000
parents 513646585e45
children cd2282d2aa55 07fa8a8b56a8
comparison
equal deleted inserted replaced
39:150ceac17a8d 119:8661b858af72
84 end 84 end
85 85
86 def diff(path, rev, rev_to) 86 def diff(path, rev, rev_to)
87 scm.diff(path, rev, rev_to) 87 scm.diff(path, rev, rev_to)
88 end 88 end
89 89
90 def diff_format_revisions(cs, cs_to, sep=':')
91 text = ""
92 text << cs_to.format_identifier + sep if cs_to
93 text << cs.format_identifier if cs
94 text
95 end
96
90 # Returns a path relative to the url of the repository 97 # Returns a path relative to the url of the repository
91 def relative_path(path) 98 def relative_path(path)
92 path 99 path
93 end 100 end
94 101
95 # Finds and returns a revision with a number or the beginning of a hash 102 # Finds and returns a revision with a number or the beginning of a hash
96 def find_changeset_by_name(name) 103 def find_changeset_by_name(name)
104 return nil if name.nil? || name.empty?
97 changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%'])) 105 changesets.find(:first, :conditions => (name.match(/^\d*$/) ? ["revision = ?", name.to_s] : ["revision LIKE ?", name + '%']))
98 end 106 end
99 107
100 def latest_changeset 108 def latest_changeset
101 @latest_changeset ||= changesets.find(:first) 109 @latest_changeset ||= changesets.find(:first)