scm: mercurial: accept both of revision and nodeid as changeset id (#3724).
Contributed by Yuya Nishihara. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4654 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -55,6 +55,17 @@ class Repository::Mercurial < Repository
|
||||
entries
|
||||
end
|
||||
|
||||
# Finds and returns a revision with a number or the beginning of a hash
|
||||
def find_changeset_by_name(name)
|
||||
if /[^\d]/ =~ name or name.to_s.size > 8
|
||||
e = changesets.find(:first, :conditions => ['scmid = ?', name.to_s])
|
||||
else
|
||||
e = changesets.find(:first, :conditions => ['revision = ?', name.to_s])
|
||||
end
|
||||
return e if e
|
||||
changesets.find(:first, :conditions => ['scmid LIKE ?', "#{name}%"]) # last ditch
|
||||
end
|
||||
|
||||
# Returns the latest changesets for +path+; sorted by revision number
|
||||
def latest_changesets(path, rev, limit=10)
|
||||
if path.blank?
|
||||
|
||||
Reference in New Issue
Block a user