diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-01 18:02:53 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-01 18:02:53 +0300 |
commit | e0609a7800000196e561f54124f4ac06e6d780f0 (patch) | |
tree | fc99a9dbad6eb97bcfab63ec5aae692fe0b8ceff /lib | |
parent | 958e727f7074b323609019bba086b66da9cf17e0 (diff) | |
parent | e2576d588fef876e743f55b0b5b0620da43ab1c1 (diff) |
Merge branch 'show-diff-stats-for-mr'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/diff/file.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/diff/line.rb | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/diff/file.rb b/lib/gitlab/diff/file.rb index 4daf65331e8..142058aa69d 100644 --- a/lib/gitlab/diff/file.rb +++ b/lib/gitlab/diff/file.rb @@ -44,6 +44,14 @@ module Gitlab diff.old_path end end + + def added_lines + diff_lines.select(&:added?).size + end + + def removed_lines + diff_lines.select(&:removed?).size + end end end end diff --git a/lib/gitlab/diff/line.rb b/lib/gitlab/diff/line.rb index 8ac1b15e88a..0072194606e 100644 --- a/lib/gitlab/diff/line.rb +++ b/lib/gitlab/diff/line.rb @@ -7,6 +7,14 @@ module Gitlab @text, @type, @index = text, type, index @old_pos, @new_pos = old_pos, new_pos end + + def added? + type == 'new' + end + + def removed? + type == 'old' + end end end end |