grim/youtrack-import
Clone
Summary
Browse
Changes
Graph
Convert the custom DebianBug and GnomeBug links to their absolute urls. Fixes YI-47
draft
2020-08-17, Gary Kramlich
fa48081b3a1c
Convert the custom DebianBug and GnomeBug links to their absolute urls. Fixes YI-47
package
trac
import
(
"database/sql"
"keep.imfreedom.org/grim/youtrack-import/youtrack"
)
type
version
struct
{
Name
string
`db:"name"`
Time
int64
`db:"time"`
Description
sql
.
NullString
`db:"description"`
}
func
(
e
*
environment
)
loadVersions
()
([]
youtrack
.
Version
,
error
)
{
versions
:=
[]
version
{}
// we grab both the versions and the milestones as milestones are
// essentially treated as the fix version in trac.
err
:=
e
.
db
.
Select
(
&
versions
,
`SELECT
a.name, a.time, a.description
FROM
trac_pidgin.version a
UNION ALL
SELECT
b.name, b.due as time, b.description
FROM
trac_pidgin.milestone b
WHERE NOT EXISTS
(SELECT NULL FROM trac_pidgin.version c WHERE c.name = b.name)
ORDER BY
name`
,
)
ytVersions
:=
make
([]
youtrack
.
Version
,
len
(
versions
))
for
idx
,
version
:=
range
versions
{
ytVersions
[
idx
]
=
version
.
toYouTrack
()
}
return
ytVersions
,
err
}
func
(
v
*
version
)
toYouTrack
()
youtrack
.
Version
{
ytVersion
:=
youtrack
.
Version
{
Name
:
v
.
Name
,
Description
:
convertString
(
v
.
Description
),
}
if
v
.
Time
!=
0
{
ytVersion
.
Released
=
true
ytVersion
.
ReleaseDate
=
convertTime
(
v
.
Time
)
}
return
ytVersion
}