Fixed: error when browsing an empty Mercurial repository (#1046).

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1343 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-04-12 17:13:17 +00:00
parent 6d2a89142a
commit 7aaa538fd9
2 changed files with 5 additions and 2 deletions

View File

@ -58,7 +58,9 @@ class Repository::Mercurial < Repository
# latest revision found in database
db_revision = latest_changeset ? latest_changeset.revision.to_i : -1
# latest revision in the repository
scm_revision = scm_info.lastrev.identifier.to_i
latest_revision = scm_info.lastrev
return if latest_revision.nil?
scm_revision = latest_revision.identifier.to_i
if db_revision < scm_revision
logger.debug "Fetching changesets for repository #{url}" if logger && logger.debug?
identifier_from = db_revision + 1

View File

@ -105,7 +105,8 @@ module Redmine
line_feeds += 1 if line.chomp.empty?
end
end
revisions << build_revision_from_changeset(changeset)
# Add the last changeset if there is one left
revisions << build_revision_from_changeset(changeset) if changeset[:date]
end
return nil if $? && $?.exitstatus != 0
revisions