diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-02-10 22:56:54 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2012-02-10 22:56:54 +0000 |
commit | d90cdb1b1073c38c498caf79d6cac39e19c16992 (patch) | |
tree | 6e1e036d47ea5802237defa14f43ae793e1b3f38 /app/models | |
parent | c5c8cd43c03f28add2ee3dce549f704cd19a224e (diff) | |
download | redmine-d90cdb1b1073c38c498caf79d6cac39e19c16992.tar.gz redmine-d90cdb1b1073c38c498caf79d6cac39e19c16992.zip |
scm: git: raise exception if "git log" is error and block is given in lib revision method (#8857)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8837 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/repository/git.rb | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 7532bcd6a..c5606f240 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -153,21 +153,25 @@ class Repository::Git < Repository from_scmid = nil from_scmid = h["branches"][br]["last_scmid"] if h["branches"][br] h["branches"][br] ||= {} - scm.revisions('', from_scmid, br, {:reverse => true}) do |rev| - db_rev = find_changeset_by_name(rev.revision) - transaction do - if db_rev.nil? - db_saved_rev = save_revision(rev) - parents = {} - parents[db_saved_rev] = rev.parents unless rev.parents.nil? - parents.each do |ch, chparents| - ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact + begin + scm.revisions('', from_scmid, br, {:reverse => true}) do |rev| + db_rev = find_changeset_by_name(rev.revision) + transaction do + if db_rev.nil? + db_saved_rev = save_revision(rev) + parents = {} + parents[db_saved_rev] = rev.parents unless rev.parents.nil? + parents.each do |ch, chparents| + ch.parents = chparents.collect{|rp| find_changeset_by_name(rp)}.compact + end end + h["branches"][br]["last_scmid"] = rev.scmid + merge_extra_info(h) + self.save end - h["branches"][br]["last_scmid"] = rev.scmid - merge_extra_info(h) - self.save end + rescue Redmine::Scm::Adapters::CommandFailed => e + logger.error("save revisions error: #{e.message}") end end end |