comparison app/models/repository/.svn/text-base/mercurial.rb.svn-base @ 120:cd2282d2aa55 cannam

Merge from the default branch. Note that this is not a valid SVN repository any more (use default, redmine-1.1 etc for SVN updates).
author Chris Cannam
date Thu, 13 Jan 2011 14:33:08 +0000
parents af80e5618e9b 8661b858af72
children eeebe205a056
comparison
equal deleted inserted replaced
118:b859cc0c4fa1 120:cd2282d2aa55
25 validates_presence_of :url 25 validates_presence_of :url
26 26
27 def scm_adapter 27 def scm_adapter
28 Redmine::Scm::Adapters::MercurialAdapter 28 Redmine::Scm::Adapters::MercurialAdapter
29 end 29 end
30 30
31 def self.scm_name 31 def self.scm_name
32 'Mercurial' 32 'Mercurial'
33 end 33 end
34 34
35 # Returns the readable identifier for the given mercurial changeset
36 def self.format_changeset_identifier(changeset)
37 "#{changeset.revision}:#{changeset.scmid}"
38 end
39
40 # Returns the identifier for the given Mercurial changeset
41 def self.changeset_identifier(changeset)
42 changeset.scmid
43 end
44
45 def diff_format_revisions(cs, cs_to, sep=':')
46 super(cs, cs_to, ' ')
47 end
48
35 def entries(path=nil, identifier=nil) 49 def entries(path=nil, identifier=nil)
36 entries=scm.entries(path, identifier) 50 entries=scm.entries(path, identifier)
37 if entries 51 if entries
38 entries.each do |entry| 52 entries.each do |entry|
39 next unless entry.is_file? 53 next unless entry.is_file?
51 entry.lastrev.revision = change.revision 65 entry.lastrev.revision = change.revision
52 end 66 end
53 end 67 end
54 end 68 end
55 entries 69 entries
70 end
71
72 # Finds and returns a revision with a number or the beginning of a hash
73 def find_changeset_by_name(name)
74 return nil if name.nil? || name.empty?
75 if /[^\d]/ =~ name or name.to_s.size > 8
76 e = changesets.find(:first, :conditions => ['scmid = ?', name.to_s])
77 else
78 e = changesets.find(:first, :conditions => ['revision = ?', name.to_s])
79 end
80 return e if e
81 changesets.find(:first, :conditions => ['scmid LIKE ?', "#{name}%"]) # last ditch
56 end 82 end
57 83
58 # Returns the latest changesets for +path+; sorted by revision number 84 # Returns the latest changesets for +path+; sorted by revision number
59 def latest_changesets(path, rev, limit=10) 85 def latest_changesets(path, rev, limit=10)
60 if path.blank? 86 if path.blank?