Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
228d2a4c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
228d2a4c
编写于
7月 06, 2016
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add some more code comments.
上级
d9c75aec
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
3 deletion
+20
-3
app/models/concerns/note_on_diff.rb
app/models/concerns/note_on_diff.rb
+1
-0
app/models/merge_request.rb
app/models/merge_request.rb
+3
-2
lib/gitlab/diff/diff_refs.rb
lib/gitlab/diff/diff_refs.rb
+10
-0
lib/gitlab/diff/line_mapper.rb
lib/gitlab/diff/line_mapper.rb
+1
-1
lib/gitlab/diff/position.rb
lib/gitlab/diff/position.rb
+5
-0
未找到文件。
app/models/concerns/note_on_diff.rb
浏览文件 @
228d2a4c
...
...
@@ -31,6 +31,7 @@ module NoteOnDiff
false
end
# Returns an array of at most 16 highlighted lines above a diff note
def
truncated_diff_lines
prev_match_line
=
nil
prev_lines
=
[]
...
...
app/models/merge_request.rb
浏览文件 @
228d2a4c
...
...
@@ -186,8 +186,9 @@ class MergeRequest < ActiveRecord::Base
# This will not be the actual base commit if the target branch was merged into
# the source branch after the merge request was created, but it is good enough
# for the specific purpose of linking to a commit.
# It is not good enough for use in Gitlab::Git::DiffRefs, which need the
# true base commit.
# It is not good enough for use in `Gitlab::Git::DiffRefs`, which needs the
# true base commit, so we can't simply have `#diff_base_commit` fall back on
# this method.
def
likely_diff_base_commit
first_commit
.
parent
||
first_commit
end
...
...
lib/gitlab/diff/diff_refs.rb
浏览文件 @
228d2a4c
...
...
@@ -18,6 +18,16 @@ module Gitlab
head_sha
==
other
.
head_sha
end
# There is only one case in which we will have `start_sha` and `head_sha`,
# but not `base_sha`, which is when a diff is generated between an
# orphaned branch and another branch, which means there _is_ no base, but
# we're still able to highlight it, and to create diff notes, which are
# the primary things `DiffRefs` are used for.
# `DiffRefs` are "complete" when they have `start_sha` and `head_sha`,
# because `base_sha` can always be derived from this, to return an actual
# sha, or `nil`.
# We have `base_sha` directly available on `DiffRefs` because it's faster#
# than having to look it up in the repo every time.
def
complete?
start_sha
&&
head_sha
end
...
...
lib/gitlab/diff/line_mapper.rb
浏览文件 @
228d2a4c
...
...
@@ -26,7 +26,7 @@ module Gitlab
@diff_lines
||=
@diff_file
.
diff_lines
end
# Find old
line number based on new
line number.
# Find old
/new line number based on its old/new counterpart
line number.
def
map_line_number
(
from_line
,
from
:,
to
:)
# If no diff file could be found, the file wasn't changed, and the
# mapped line number is the same as the specified line number.
...
...
lib/gitlab/diff/position.rb
浏览文件 @
228d2a4c
...
...
@@ -28,6 +28,11 @@ module Gitlab
end
end
# `Gitlab::Diff::Position` objects are stored as serialized attributes in
# `DiffNote`, which use YAML to encode and decode objects.
# `#init_with` and `#encode_with` can be used to customize the en/decoding
# behavior. In this case, we override these to prevent memoized instance
# variables like `@diff_file` and `@diff_line` from being serialized.
def
init_with
(
coder
)
initialize
(
coder
[
'attributes'
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录