##// END OF EJS Templates
scm: mercurial: use to_s for revision in find_changeset_by_name method...
Toshi MARUYAMA -
r8818:6bdc2c36f112
parent child
Show More
@@ -73,14 +73,15 class Repository::Mercurial < Repository
73
73
74 # Finds and returns a revision with a number or the beginning of a hash
74 # Finds and returns a revision with a number or the beginning of a hash
75 def find_changeset_by_name(name)
75 def find_changeset_by_name(name)
76 return nil if name.nil? || name.empty?
76 return nil if name.blank?
77 if /[^\d]/ =~ name or name.to_s.size > 8
77 s = name.to_s
78 e = changesets.find(:first, :conditions => ['scmid = ?', name.to_s])
78 if /[^\d]/ =~ s or s.size > 8
79 e = changesets.find(:first, :conditions => ['scmid = ?', s])
79 else
80 else
80 e = changesets.find(:first, :conditions => ['revision = ?', name.to_s])
81 e = changesets.find(:first, :conditions => ['revision = ?', s])
81 end
82 end
82 return e if e
83 return e if e
83 changesets.find(:first, :conditions => ['scmid LIKE ?', "#{name}%"]) # last ditch
84 changesets.find(:first, :conditions => ['scmid LIKE ?', "#{s}%"]) # last ditch
84 end
85 end
85
86
86 # Returns the latest changesets for +path+; sorted by revision number
87 # Returns the latest changesets for +path+; sorted by revision number
General Comments 0
You need to be logged in to leave comments. Login now