Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
52daddc0
Commit
52daddc0
authored
Aug 30, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use updated_at as the last updated date when importing from GitHub
parent
08ab410f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
55 deletions
+15
-55
lib/gitlab/github_import/issue_formatter.rb
lib/gitlab/github_import/issue_formatter.rb
+1
-5
lib/gitlab/github_import/milestone_formatter.rb
lib/gitlab/github_import/milestone_formatter.rb
+6
-30
lib/gitlab/github_import/pull_request_formatter.rb
lib/gitlab/github_import/pull_request_formatter.rb
+1
-10
spec/lib/gitlab/github_import/issue_formatter_spec.rb
spec/lib/gitlab/github_import/issue_formatter_spec.rb
+2
-3
spec/lib/gitlab/github_import/milestone_formatter_spec.rb
spec/lib/gitlab/github_import/milestone_formatter_spec.rb
+2
-3
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
+3
-4
No files found.
lib/gitlab/github_import/issue_formatter.rb
View file @
52daddc0
...
@@ -12,7 +12,7 @@ module Gitlab
...
@@ -12,7 +12,7 @@ module Gitlab
author_id:
author_id
,
author_id:
author_id
,
assignee_id:
assignee_id
,
assignee_id:
assignee_id
,
created_at:
raw_data
.
created_at
,
created_at:
raw_data
.
created_at
,
updated_at:
updated_at
updated_at:
raw_data
.
updated_at
}
}
end
end
...
@@ -69,10 +69,6 @@ module Gitlab
...
@@ -69,10 +69,6 @@ module Gitlab
def
state
def
state
raw_data
.
state
==
'closed'
?
'closed'
:
'opened'
raw_data
.
state
==
'closed'
?
'closed'
:
'opened'
end
end
def
updated_at
state
==
'closed'
?
raw_data
.
closed_at
:
raw_data
.
updated_at
end
end
end
end
end
end
end
lib/gitlab/github_import/milestone_formatter.rb
View file @
52daddc0
...
@@ -3,14 +3,14 @@ module Gitlab
...
@@ -3,14 +3,14 @@ module Gitlab
class
MilestoneFormatter
<
BaseFormatter
class
MilestoneFormatter
<
BaseFormatter
def
attributes
def
attributes
{
{
iid:
number
,
iid:
raw_data
.
number
,
project:
project
,
project:
project
,
title:
title
,
title:
raw_data
.
title
,
description:
description
,
description:
raw_data
.
description
,
due_date:
due_date
,
due_date:
raw_data
.
due_on
,
state:
state
,
state:
state
,
created_at:
created_at
,
created_at:
raw_data
.
created_at
,
updated_at:
updated_at
updated_at:
raw_data
.
updated_at
}
}
end
end
...
@@ -20,33 +20,9 @@ module Gitlab
...
@@ -20,33 +20,9 @@ module Gitlab
private
private
def
number
raw_data
.
number
end
def
title
raw_data
.
title
end
def
description
raw_data
.
description
end
def
due_date
raw_data
.
due_on
end
def
state
def
state
raw_data
.
state
==
'closed'
?
'closed'
:
'active'
raw_data
.
state
==
'closed'
?
'closed'
:
'active'
end
end
def
created_at
raw_data
.
created_at
end
def
updated_at
state
==
'closed'
?
raw_data
.
closed_at
:
raw_data
.
updated_at
end
end
end
end
end
end
end
lib/gitlab/github_import/pull_request_formatter.rb
View file @
52daddc0
...
@@ -20,7 +20,7 @@ module Gitlab
...
@@ -20,7 +20,7 @@ module Gitlab
author_id:
author_id
,
author_id:
author_id
,
assignee_id:
assignee_id
,
assignee_id:
assignee_id
,
created_at:
raw_data
.
created_at
,
created_at:
raw_data
.
created_at
,
updated_at:
updated_at
updated_at:
raw_data
.
updated_at
}
}
end
end
...
@@ -103,15 +103,6 @@ module Gitlab
...
@@ -103,15 +103,6 @@ module Gitlab
'opened'
'opened'
end
end
end
end
def
updated_at
case
state
when
'merged'
then
raw_data
.
merged_at
when
'closed'
then
raw_data
.
closed_at
else
raw_data
.
updated_at
end
end
end
end
end
end
end
end
spec/lib/gitlab/github_import/issue_formatter_spec.rb
View file @
52daddc0
...
@@ -48,8 +48,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
...
@@ -48,8 +48,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
end
end
context
'when issue is closed'
do
context
'when issue is closed'
do
let
(
:closed_at
)
{
DateTime
.
strptime
(
'2011-01-28T19:01:12Z'
)
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
))
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
,
closed_at:
closed_at
))
}
it
'returns formatted attributes'
do
it
'returns formatted attributes'
do
expected
=
{
expected
=
{
...
@@ -62,7 +61,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
...
@@ -62,7 +61,7 @@ describe Gitlab::GithubImport::IssueFormatter, lib: true do
author_id:
project
.
creator_id
,
author_id:
project
.
creator_id
,
assignee_id:
nil
,
assignee_id:
nil
,
created_at:
created_at
,
created_at:
created_at
,
updated_at:
clos
ed_at
updated_at:
updat
ed_at
}
}
expect
(
issue
.
attributes
).
to
eq
(
expected
)
expect
(
issue
.
attributes
).
to
eq
(
expected
)
...
...
spec/lib/gitlab/github_import/milestone_formatter_spec.rb
View file @
52daddc0
...
@@ -40,8 +40,7 @@ describe Gitlab::GithubImport::MilestoneFormatter, lib: true do
...
@@ -40,8 +40,7 @@ describe Gitlab::GithubImport::MilestoneFormatter, lib: true do
end
end
context
'when milestone is closed'
do
context
'when milestone is closed'
do
let
(
:closed_at
)
{
DateTime
.
strptime
(
'2011-01-28T19:01:12Z'
)
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
))
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
,
closed_at:
closed_at
))
}
it
'returns formatted attributes'
do
it
'returns formatted attributes'
do
expected
=
{
expected
=
{
...
@@ -52,7 +51,7 @@ describe Gitlab::GithubImport::MilestoneFormatter, lib: true do
...
@@ -52,7 +51,7 @@ describe Gitlab::GithubImport::MilestoneFormatter, lib: true do
state:
'closed'
,
state:
'closed'
,
due_date:
nil
,
due_date:
nil
,
created_at:
created_at
,
created_at:
created_at
,
updated_at:
clos
ed_at
updated_at:
updat
ed_at
}
}
expect
(
formatter
.
attributes
).
to
eq
(
expected
)
expect
(
formatter
.
attributes
).
to
eq
(
expected
)
...
...
spec/lib/gitlab/github_import/pull_request_formatter_spec.rb
View file @
52daddc0
...
@@ -62,8 +62,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -62,8 +62,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
end
end
context
'when pull request is closed'
do
context
'when pull request is closed'
do
let
(
:closed_at
)
{
DateTime
.
strptime
(
'2011-01-28T19:01:12Z'
)
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
))
}
let
(
:raw_data
)
{
double
(
base_data
.
merge
(
state:
'closed'
,
closed_at:
closed_at
))
}
it
'returns formatted attributes'
do
it
'returns formatted attributes'
do
expected
=
{
expected
=
{
...
@@ -81,7 +80,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -81,7 +80,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
author_id:
project
.
creator_id
,
author_id:
project
.
creator_id
,
assignee_id:
nil
,
assignee_id:
nil
,
created_at:
created_at
,
created_at:
created_at
,
updated_at:
clos
ed_at
updated_at:
updat
ed_at
}
}
expect
(
pull_request
.
attributes
).
to
eq
(
expected
)
expect
(
pull_request
.
attributes
).
to
eq
(
expected
)
...
@@ -108,7 +107,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
...
@@ -108,7 +107,7 @@ describe Gitlab::GithubImport::PullRequestFormatter, lib: true do
author_id:
project
.
creator_id
,
author_id:
project
.
creator_id
,
assignee_id:
nil
,
assignee_id:
nil
,
created_at:
created_at
,
created_at:
created_at
,
updated_at:
merg
ed_at
updated_at:
updat
ed_at
}
}
expect
(
pull_request
.
attributes
).
to
eq
(
expected
)
expect
(
pull_request
.
attributes
).
to
eq
(
expected
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment