grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
Split the version field into AffectedVersion and FixVersion while having trac and bitbucket use AffectedVersion. Also put the trac milestone into the Fix Version.
draft
2020-08-11, Gary Kramlich
faf8f5a4120f
Split the version field into AffectedVersion and FixVersion while having trac and bitbucket use AffectedVersion. Also put the trac milestone into the Fix Version.
package
trac
import
(
"database/sql"
"keep.imfreedom.org/grim/youtrack-import/youtrack"
)
type
component
struct
{
Name
string
`db:"name"`
Owner
sql
.
NullString
`db:"owner"`
Description
sql
.
NullString
`db:"description"`
}
func
(
e
*
environment
)
loadComponents
(
users
map
[
string
]
*
youtrack
.
User
,
unknownUser
string
)
([]
youtrack
.
OwnedField
,
error
)
{
components
:=
[]
component
{}
err
:=
e
.
db
.
Select
(
&
components
,
`SELECT
distinct(t.component) AS name,
c.owner AS owner,
c.description AS description
FROM component c
FULL JOIN trac_pidgin.ticket t ON
c.name = t.component
ORDER BY t.component`
,
)
ytSubsystem
:=
make
([]
youtrack
.
OwnedField
,
len
(
components
))
for
idx
,
component
:=
range
components
{
ytSubsystem
[
idx
]
=
component
.
toYouTrack
(
users
,
unknownUser
)
}
return
ytSubsystem
,
err
}
func
(
c
*
component
)
toYouTrack
(
users
map
[
string
]
*
youtrack
.
User
,
unknownUser
string
)
youtrack
.
OwnedField
{
owner
:=
mapUser
(
convertString
(
c
.
Owner
),
unknownUser
,
users
)
return
youtrack
.
OwnedField
{
Value
:
c
.
Name
,
Description
:
convertString
(
c
.
Description
),
Owner
:
owner
,
}
}