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

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1343 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Jean-Philippe Lang 17 years ago
parent 6d2a89142a
commit 7aaa538fd9
  1. 4
      app/models/repository/mercurial.rb
  2. 3
      lib/redmine/scm/adapters/mercurial_adapter.rb

@ -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

@ -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

Loading…
Cancel
Save