Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVN-GitLab Migration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Stud.IP
Plugins
SVN-GitLab Migration
Commits
56f9f4ed
Commit
56f9f4ed
authored
6 years ago
by
Jan-Hendrik Willms
Browse files
Options
Downloads
Patches
Plain Diff
get ticket/issue mapping from migration, re
#2
parent
6331feeb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
config.json
+3
-0
3 additions, 0 deletions
config.json
migrate.php
+3
-2
3 additions, 2 deletions
migrate.php
src/Migration.php
+6
-2
6 additions, 2 deletions
src/Migration.php
with
12 additions
and
4 deletions
config.json
0 → 100644
+
3
−
0
View file @
56f9f4ed
{
"gitlab-access-token"
:
"se7cRwBAyySpFnzWmk7a"
}
This diff is collapsed.
Click to expand it.
migrate.php
+
3
−
2
View file @
56f9f4ed
...
...
@@ -24,6 +24,7 @@ $getopt = new Getopt(array(
array
(
'v'
,
'version'
,
Getopt
::
NO_ARGUMENT
,
'Just shows the version'
)
));
$issue_mapping
=
[];
try
{
$getopt
->
parse
();
...
...
@@ -55,11 +56,11 @@ try {
$migration
=
new
Migration
(
$getopt
->
getOption
(
'gitlab'
),
$getopt
->
getOption
(
'token'
),
$getopt
->
getOption
(
'admin'
),
$getopt
->
getOption
(
'trac'
),
$getopt
->
getOption
(
'link'
),
$userMapping
);
// If we have a component, migrate it
if
(
!
is_null
(
$getopt
->
getOption
(
'component'
)))
{
$migration
->
migrateComponent
(
$getopt
->
getOption
(
'component'
),
$getopt
->
getOption
(
'project'
));
$issue_mapping
=
$migration
->
migrateComponent
(
$getopt
->
getOption
(
'component'
),
$getopt
->
getOption
(
'project'
));
}
// If we have a custom query, migrate it
if
(
!
is_null
(
$getopt
->
getOption
(
'query'
)))
{
$migration
->
migrateQuery
(
$getopt
->
getOption
(
'query'
),
$getopt
->
getOption
(
'project'
));
$issue_mapping
=
$migration
->
migrateQuery
(
$getopt
->
getOption
(
'query'
),
$getopt
->
getOption
(
'project'
));
}
}
catch
(
UnexpectedValueException
$e
)
{
echo
"Error: "
.
$e
->
getMessage
()
.
"
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
src/Migration.php
+
6
−
2
View file @
56f9f4ed
...
...
@@ -43,7 +43,7 @@ class Migration
*/
public
function
migrateComponent
(
$tracComponentName
,
$gitLabProject
)
{
$openTickets
=
$this
->
trac
->
listOpenTicketsForComponent
(
$tracComponentName
);
$this
->
migrate
(
$openTickets
,
$gitLabProject
);
return
$this
->
migrate
(
$openTickets
,
$gitLabProject
);
}
/**
...
...
@@ -54,7 +54,7 @@ class Migration
*/
public
function
migrateQuery
(
$tracQuery
,
$gitLabProject
)
{
$openTickets
=
$this
->
trac
->
listTicketsForQuery
(
$tracQuery
);
$this
->
migrate
(
$openTickets
,
$gitLabProject
);
return
$this
->
migrate
(
$openTickets
,
$gitLabProject
);
}
/**
...
...
@@ -93,6 +93,7 @@ class Migration
* @param string $gitLabProject GitLab project in which the issues should be created
*/
private
function
migrate
(
$openTickets
,
$gitLabProject
)
{
$mapping
=
[];
foreach
(
$openTickets
as
$ticket
)
{
$originalTicketId
=
$ticket
[
0
];
$title
=
$ticket
[
3
][
'summary'
];
...
...
@@ -115,6 +116,8 @@ class Migration
echo
'Created a GitLab issue #'
.
$issue
[
'iid'
]
.
' for Trac ticket #'
.
$originalTicketId
.
' : '
.
$this
->
gitLab
->
getUrl
()
.
'/'
.
$gitLabProject
.
'/issues/'
.
$issue
[
'iid'
]
.
"
\n
"
;
$mapping
[
$originalTicketId
]
=
$issue
[
'iid'
];
// If there are comments on the ticket, create notes on the issue
/*if (is_array($ticket[4]) && count($ticket[4])) {
foreach($ticket[4] as $comment) {
...
...
@@ -126,6 +129,7 @@ class Migration
echo "\tAlso created " . count($ticket[4]) . " note(s)\n";
}*/
}
return
$mapping
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment