Mercurial > hg > soundsoftware-site
diff 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 |
line wrap: on
line diff
--- a/app/models/repository/.svn/text-base/mercurial.rb.svn-base Thu Jan 13 13:21:03 2011 +0000 +++ b/app/models/repository/.svn/text-base/mercurial.rb.svn-base Thu Jan 13 14:33:08 2011 +0000 @@ -27,11 +27,25 @@ def scm_adapter Redmine::Scm::Adapters::MercurialAdapter end - + def self.scm_name 'Mercurial' end - + + # Returns the readable identifier for the given mercurial changeset + def self.format_changeset_identifier(changeset) + "#{changeset.revision}:#{changeset.scmid}" + end + + # Returns the identifier for the given Mercurial changeset + def self.changeset_identifier(changeset) + changeset.scmid + end + + def diff_format_revisions(cs, cs_to, sep=':') + super(cs, cs_to, ' ') + end + def entries(path=nil, identifier=nil) entries=scm.entries(path, identifier) if entries @@ -55,6 +69,18 @@ entries end + # Finds and returns a revision with a number or the beginning of a hash + def find_changeset_by_name(name) + return nil if name.nil? || name.empty? + 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?