Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
c5ba87a2
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,发现更多精彩内容 >>
提交
c5ba87a2
编写于
1月 15, 2015
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #8096 from cirosantilli/regex-to-string
Replace regex methods by string ones since faster and more readable
上级
9c4015f3
cd688a60
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
21 addition
and
21 deletion
+21
-21
app/models/commit.rb
app/models/commit.rb
+4
-4
app/models/project_services/campfire_service.rb
app/models/project_services/campfire_service.rb
+2
-2
app/models/project_services/hipchat_service.rb
app/models/project_services/hipchat_service.rb
+2
-2
app/models/project_services/pushover_service.rb
app/models/project_services/pushover_service.rb
+2
-2
app/models/project_services/slack_message.rb
app/models/project_services/slack_message.rb
+2
-2
app/models/user.rb
app/models/user.rb
+1
-1
app/services/git_push_service.rb
app/services/git_push_service.rb
+4
-4
app/services/notification_service.rb
app/services/notification_service.rb
+1
-1
lib/api/internal.rb
lib/api/internal.rb
+2
-2
lib/tasks/gitlab/import.rake
lib/tasks/gitlab/import.rake
+1
-1
未找到文件。
app/models/commit.rb
浏览文件 @
c5ba87a2
...
@@ -75,11 +75,11 @@ class Commit
...
@@ -75,11 +75,11 @@ class Commit
return
no_commit_message
if
title
.
blank?
return
no_commit_message
if
title
.
blank?
title_end
=
title
.
index
(
/\n/
)
title_end
=
title
.
index
(
"
\n
"
)
if
(
!
title_end
&&
title
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
if
(
!
title_end
&&
title
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
title
[
0
..
79
]
<<
"…"
.
html_safe
title
[
0
..
79
]
<<
"…"
.
html_safe
else
else
title
.
split
(
/\n/
,
2
).
first
title
.
split
(
"
\n
"
,
2
).
first
end
end
end
end
...
@@ -87,11 +87,11 @@ class Commit
...
@@ -87,11 +87,11 @@ class Commit
#
#
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
# cut off, ellipses (`&hellp;`) are prepended to the commit message.
def
description
def
description
title_end
=
safe_message
.
index
(
/\n/
)
title_end
=
safe_message
.
index
(
"
\n
"
)
@description
||=
if
(
!
title_end
&&
safe_message
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
@description
||=
if
(
!
title_end
&&
safe_message
.
length
>
100
)
||
(
title_end
&&
title_end
>
100
)
"…"
.
html_safe
<<
safe_message
[
80
..-
1
]
"…"
.
html_safe
<<
safe_message
[
80
..-
1
]
else
else
safe_message
.
split
(
/\n/
,
2
)[
1
].
try
(
:chomp
)
safe_message
.
split
(
"
\n
"
,
2
)[
1
].
try
(
:chomp
)
end
end
end
end
...
...
app/models/project_services/campfire_service.rb
浏览文件 @
c5ba87a2
...
@@ -60,9 +60,9 @@ class CampfireService < Service
...
@@ -60,9 +60,9 @@ class CampfireService < Service
message
<<
"[
#{
project
.
name_with_namespace
}
] "
message
<<
"[
#{
project
.
name_with_namespace
}
] "
message
<<
"
#{
push
[
:user_name
]
}
"
message
<<
"
#{
push
[
:user_name
]
}
"
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
<<
"pushed new branch
#{
ref
}
\n
"
message
<<
"pushed new branch
#{
ref
}
\n
"
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
<<
"removed branch
#{
ref
}
\n
"
message
<<
"removed branch
#{
ref
}
\n
"
else
else
message
<<
"pushed
#{
push
[
:total_commits_count
]
}
commits to
#{
ref
}
. "
message
<<
"pushed
#{
push
[
:total_commits_count
]
}
commits to
#{
ref
}
. "
...
...
app/models/project_services/hipchat_service.rb
浏览文件 @
c5ba87a2
...
@@ -58,12 +58,12 @@ class HipchatService < Service
...
@@ -58,12 +58,12 @@ class HipchatService < Service
message
=
""
message
=
""
message
<<
"
#{
push
[
:user_name
]
}
"
message
<<
"
#{
push
[
:user_name
]
}
"
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
<<
"pushed new branch <a href=
\"
"
\
message
<<
"pushed new branch <a href=
\"
"
\
"
#{
project
.
web_url
}
/commits/
#{
URI
.
escape
(
ref
)
}
\"
>
#{
ref
}
</a>"
\
"
#{
project
.
web_url
}
/commits/
#{
URI
.
escape
(
ref
)
}
\"
>
#{
ref
}
</a>"
\
" to <a href=
\"
#{
project
.
web_url
}
\"
>"
\
" to <a href=
\"
#{
project
.
web_url
}
\"
>"
\
"
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
""
)
}
</a>
\n
"
"
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
""
)
}
</a>
\n
"
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
<<
"removed branch
#{
ref
}
from <a href=
\"
#{
project
.
web_url
}
\"
>
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
''
)
}
</a>
\n
"
message
<<
"removed branch
#{
ref
}
from <a href=
\"
#{
project
.
web_url
}
\"
>
#{
project
.
name_with_namespace
.
gsub!
(
/\s/
,
''
)
}
</a>
\n
"
else
else
message
<<
"pushed to branch <a href=
\"
"
\
message
<<
"pushed to branch <a href=
\"
"
\
...
...
app/models/project_services/pushover_service.rb
浏览文件 @
c5ba87a2
...
@@ -80,9 +80,9 @@ class PushoverService < Service
...
@@ -80,9 +80,9 @@ class PushoverService < Service
before
=
push_data
[
:before
]
before
=
push_data
[
:before
]
after
=
push_data
[
:after
]
after
=
push_data
[
:after
]
if
before
=~
/000000/
if
before
.
include?
(
'000000'
)
message
=
"
#{
push_data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
message
=
"
#{
push_data
[
:user_name
]
}
pushed new branch
\"
#{
ref
}
\"
."
elsif
after
=~
/000000/
elsif
after
.
include?
(
'000000'
)
message
=
"
#{
push_data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
message
=
"
#{
push_data
[
:user_name
]
}
deleted branch
\"
#{
ref
}
\"
."
else
else
message
=
"
#{
push_data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
message
=
"
#{
push_data
[
:user_name
]
}
push to branch
\"
#{
ref
}
\"
."
...
...
app/models/project_services/slack_message.rb
浏览文件 @
c5ba87a2
...
@@ -77,11 +77,11 @@ class SlackMessage
...
@@ -77,11 +77,11 @@ class SlackMessage
end
end
def
new_branch?
def
new_branch?
before
=~
/000000/
before
.
include?
(
'000000'
)
end
end
def
removed_branch?
def
removed_branch?
after
=~
/000000/
after
.
include?
(
'000000'
)
end
end
def
branch_url
def
branch_url
...
...
app/models/user.rb
浏览文件 @
c5ba87a2
...
@@ -488,7 +488,7 @@ class User < ActiveRecord::Base
...
@@ -488,7 +488,7 @@ class User < ActiveRecord::Base
end
end
def
temp_oauth_email?
def
temp_oauth_email?
email
=~
/\Atemp-email-for-oauth/
email
.
start_with?
(
'temp-email-for-oauth'
)
end
end
def
public_profile?
def
public_profile?
...
...
app/services/git_push_service.rb
浏览文件 @
c5ba87a2
...
@@ -111,23 +111,23 @@ class GitPushService
...
@@ -111,23 +111,23 @@ class GitPushService
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
# Return if this is not a push to a branch (e.g. new commits)
# Return if this is not a push to a branch (e.g. new commits)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
oldrev
!=
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_to_new_branch?
(
ref
,
oldrev
)
def
push_to_new_branch?
(
ref
,
oldrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
oldrev
==
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
oldrev
==
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_remove_branch?
(
ref
,
newrev
)
def
push_remove_branch?
(
ref
,
newrev
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
=
ref
.
split
(
'/'
)
ref_parts
[
1
]
=~
/heads/
&&
newrev
==
Gitlab
::
Git
::
BLANK_SHA
ref_parts
[
1
]
.
include?
(
'heads'
)
&&
newrev
==
Gitlab
::
Git
::
BLANK_SHA
end
end
def
push_to_branch?
(
ref
)
def
push_to_branch?
(
ref
)
ref
=~
/refs\/heads/
ref
.
include?
(
'refs/heads'
)
end
end
def
is_default_branch?
(
ref
)
def
is_default_branch?
(
ref
)
...
...
app/services/notification_service.rb
浏览文件 @
c5ba87a2
...
@@ -118,7 +118,7 @@ class NotificationService
...
@@ -118,7 +118,7 @@ class NotificationService
return
true
unless
note
.
noteable_type
.
present?
return
true
unless
note
.
noteable_type
.
present?
# ignore gitlab service messages
# ignore gitlab service messages
return
true
if
note
.
note
=~
/\A_Status changed to closed_/
return
true
if
note
.
note
.
start_with?
(
'_Status changed to closed_'
)
return
true
if
note
.
cross_reference?
&&
note
.
system
==
true
return
true
if
note
.
cross_reference?
&&
note
.
system
==
true
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
opts
=
{
noteable_type:
note
.
noteable_type
,
project_id:
note
.
project_id
}
...
...
lib/api/internal.rb
浏览文件 @
c5ba87a2
...
@@ -25,8 +25,8 @@ module API
...
@@ -25,8 +25,8 @@ module API
# project. This applies the correct project permissions to
# project. This applies the correct project permissions to
# the wiki repository as well.
# the wiki repository as well.
access
=
access
=
if
project_path
=~
/\.wiki\Z/
if
project_path
.
end_with?
(
'.wiki'
)
project_path
.
sub!
(
/\.wiki\Z/
,
'
'
)
project_path
.
chomp!
(
'.wiki
'
)
Gitlab
::
GitAccessWiki
.
new
Gitlab
::
GitAccessWiki
.
new
else
else
Gitlab
::
GitAccess
.
new
Gitlab
::
GitAccess
.
new
...
...
lib/tasks/gitlab/import.rake
浏览文件 @
c5ba87a2
...
@@ -25,7 +25,7 @@ namespace :gitlab do
...
@@ -25,7 +25,7 @@ namespace :gitlab do
puts
"Processing
#{
repo_path
}
"
.
yellow
puts
"Processing
#{
repo_path
}
"
.
yellow
if
path
=~
/\.wiki\Z/
if
path
.
end_with?
(
'.wiki'
)
puts
" * Skipping wiki repo"
puts
" * Skipping wiki repo"
next
next
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录