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:
Toshi MARUYAMA
2011-01-08 06:24:27 +00:00
parent 3ad213c29a
commit e2df831b53
3 changed files with 40 additions and 1 deletions
+11
View File
@@ -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?