scm: mercurial: use scmid as identifier (#3724).
Contributed by Yuya Nishihara. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4695 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
36b99a4ed3
commit
d67185ec7e
|
@ -27,11 +27,22 @@ class Repository::Mercurial < Repository
|
||||||
def scm_adapter
|
def scm_adapter
|
||||||
Redmine::Scm::Adapters::MercurialAdapter
|
Redmine::Scm::Adapters::MercurialAdapter
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.scm_name
|
def self.scm_name
|
||||||
'Mercurial'
|
'Mercurial'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the readable identifier for the given mercurial changeset
|
||||||
|
def self.format_changeset_identifier(changeset)
|
||||||
|
# "#{changeset.revision}:#{changeset.scmid}"
|
||||||
|
changeset.revision
|
||||||
|
end
|
||||||
|
|
||||||
|
# Returns the identifier for the given Mercurial changeset
|
||||||
|
def self.changeset_identifier(changeset)
|
||||||
|
changeset.scmid
|
||||||
|
end
|
||||||
|
|
||||||
def entries(path=nil, identifier=nil)
|
def entries(path=nil, identifier=nil)
|
||||||
entries=scm.entries(path, identifier)
|
entries=scm.entries(path, identifier)
|
||||||
if entries
|
if entries
|
||||||
|
|
|
@ -139,6 +139,13 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
||||||
@repository.reload
|
@repository.reload
|
||||||
assert_nil @repository.find_changeset_by_name('100000')
|
assert_nil @repository.find_changeset_by_name('100000')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_identifier
|
||||||
|
@repository.fetch_changesets
|
||||||
|
@repository.reload
|
||||||
|
c = @repository.changesets.find_by_revision('2')
|
||||||
|
assert_equal c.scmid, c.identifier
|
||||||
|
end
|
||||||
else
|
else
|
||||||
puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
|
puts "Mercurial test repository NOT FOUND. Skipping unit tests !!!"
|
||||||
def test_fake; assert true end
|
def test_fake; assert true end
|
||||||
|
|
Loading…
Reference in New Issue