Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
9d00bb08
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,发现更多精彩内容 >>
提交
9d00bb08
编写于
4月 14, 2015
作者:
D
Douwe Maan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Import Google Code issue assignee when mapped.
上级
2f797a14
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
3 deletion
+26
-3
lib/gitlab/google_code_import/importer.rb
lib/gitlab/google_code_import/importer.rb
+14
-0
spec/fixtures/GoogleCodeProjectHosting.json
spec/fixtures/GoogleCodeProjectHosting.json
+5
-0
spec/lib/gitlab/google_code_import/importer_spec.rb
spec/lib/gitlab/google_code_import/importer_spec.rb
+7
-3
未找到文件。
lib/gitlab/google_code_import/importer.rb
浏览文件 @
9d00bb08
...
...
@@ -99,10 +99,24 @@ module Gitlab
end
labels
<<
nice_status_name
(
raw_issue
[
"status"
])
assignee_id
=
nil
if
raw_issue
.
has_key?
(
"owner"
)
username
=
user_map
[
raw_issue
[
"owner"
][
"name"
]]
if
username
.
start_with?
(
"@"
)
username
=
username
[
1
..-
1
]
if
user
=
User
.
find_by
(
username:
username
)
assignee_id
=
user
.
id
end
end
end
issue
=
project
.
issues
.
create!
(
title:
raw_issue
[
"title"
],
description:
body
,
author_id:
project
.
creator_id
,
assignee_id:
assignee_id
,
state:
raw_issue
[
"state"
]
==
"closed"
?
"closed"
:
"opened"
)
issue
.
add_labels_by_names
(
labels
)
...
...
spec/fixtures/GoogleCodeProjectHosting.json
浏览文件 @
9d00bb08
...
...
@@ -344,6 +344,11 @@
"name"
:
"schattenpr..."
,
"htmlLink"
:
"https://code.google.com/u/106498139506637530000/"
},
"owner"
:
{
"kind"
:
"projecthosting#issuePerson"
,
"name"
:
"thilo..."
,
"htmlLink"
:
"https://code.google.com/u/104224918623172014000/"
},
"updated"
:
"2009-11-18T05:14:58.000Z"
,
"published"
:
"2009-11-18T00:20:19.000Z"
,
"closed"
:
"2009-11-18T05:14:58.000Z"
,
...
...
spec/lib/gitlab/google_code_import/importer_spec.rb
浏览文件 @
9d00bb08
require
"spec_helper"
describe
Gitlab
::
GoogleCodeImport
::
Importer
do
let
(
:mapped_user
)
{
create
(
:user
,
username:
"thilo123"
)
}
let
(
:raw_data
)
{
JSON
.
parse
(
File
.
read
(
Rails
.
root
.
join
(
"spec/fixtures/GoogleCodeProjectHosting.json"
)))
}
let
(
:client
)
{
Gitlab
::
GoogleCodeImport
::
Client
.
new
(
raw_data
)
}
let
(
:import_data
)
{
{
"repo"
=>
client
.
repo
(
"tint2"
).
raw_data
,
"user_map"
=>
{
"thilo..."
=>
"@
thilo123
"
"thilo..."
=>
"@
#{
mapped_user
.
username
}
"
}
}
}
let
(
:project
)
{
create
(
:project
,
import_data:
import_data
)
}
subject
{
described_class
.
new
(
project
)
}
subject
{
described_class
.
new
(
project
)
}
describe
"#execute"
do
it
"imports status labels"
do
subject
.
execute
...
...
@@ -43,6 +45,8 @@ describe Gitlab::GoogleCodeImport::Importer do
issue
=
project
.
issues
.
first
expect
(
issue
).
to_not
be_nil
expect
(
issue
.
iid
).
to
eq
(
169
)
expect
(
issue
.
author
).
to
eq
(
project
.
creator
)
expect
(
issue
.
assignee
).
to
eq
(
mapped_user
)
expect
(
issue
.
state
).
to
eq
(
"closed"
)
expect
(
issue
.
label_names
).
to
include
(
"Priority: Medium"
)
expect
(
issue
.
label_names
).
to
include
(
"Status: Fixed"
)
...
...
@@ -65,7 +69,7 @@ describe Gitlab::GoogleCodeImport::Importer do
note
=
project
.
issues
.
first
.
notes
.
first
expect
(
note
).
to_not
be_nil
expect
(
note
.
note
).
to
include
(
"Comment 1"
)
expect
(
note
.
note
).
to
include
(
"@
thilo123
"
)
expect
(
note
.
note
).
to
include
(
"@
#{
mapped_user
.
username
}
"
)
expect
(
note
.
note
).
to
include
(
"November 18, 2009 05:14"
)
expect
(
note
.
note
).
to
include
(
"applied, thanks."
)
expect
(
note
.
note
).
to
include
(
"Status: Fixed"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录