Commit 88033500232f12234a9546aa9b89111bcdbfecef
1 parent
494cd02b
Exists in
master
and in
4 other branches
CHANGELOG updated. Fixed MR bug. Logger improved
Showing
4 changed files
with
23 additions
and
5 deletions
Show diff stats
CHANGELOG
app/assets/stylesheets/gitlab_bootstrap.scss
app/models/merge_request.rb
... | ... | @@ -128,7 +128,7 @@ class MergeRequest < ActiveRecord::Base |
128 | 128 | |
129 | 129 | def unmerged_diffs |
130 | 130 | commits = project.repo.commits_between(target_branch, source_branch).map {|c| Commit.new(c)} |
131 | - diffs = project.repo.diff(commits.first.prev_commit.id, commits.last.id) | |
131 | + diffs = project.repo.diff(commits.first.prev_commit.id, commits.last.id) rescue [] | |
132 | 132 | end |
133 | 133 | |
134 | 134 | def last_commit | ... | ... |
lib/gitlab/logger.rb
1 | 1 | module Gitlab |
2 | - class Logger | |
2 | + class Logger < ::Logger | |
3 | 3 | def self.error(message) |
4 | - @@logger ||= ::Logger.new(File.join(Rails.root, "log/githost.log")) | |
5 | - message = Time.now.to_s(:long) + " -> " + message | |
6 | - @@logger.error(message) | |
4 | + build.error(message) | |
5 | + end | |
6 | + | |
7 | + def self.info(message) | |
8 | + build.info(message) | |
7 | 9 | end |
8 | 10 | |
9 | 11 | def self.read_latest |
10 | 12 | path = Rails.root.join("log/githost.log") |
11 | 13 | logs = File.read(path).split("\n") |
12 | 14 | end |
15 | + | |
16 | + def self.build | |
17 | + new(File.join(Rails.root, "log/githost.log")) | |
18 | + end | |
19 | + | |
20 | + def format_message(severity, timestamp, progname, msg) | |
21 | + "#{timestamp.to_s(:long)} -> #{severity} -> #{msg}\n" | |
22 | + end | |
13 | 23 | end |
14 | 24 | end | ... | ... |