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
2b79c1a3
Commit
2b79c1a3
authored
6 years ago
by
Thomas Hackl
Browse files
Options
Downloads
Patches
Plain Diff
respect sensitive tickets
parent
9816bbf9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/GitLab.php
+7
-3
7 additions, 3 deletions
src/GitLab.php
src/Migration.php
+6
-2
6 additions, 2 deletions
src/Migration.php
with
13 additions
and
5 deletions
src/GitLab.php
+
7
−
3
View file @
2b79c1a3
...
...
@@ -68,12 +68,13 @@ class GitLab
* @param int $assigneeId Numeric user id of the user asigned to the issue. Can be null.
* @param int $authorId Numeric user id of the user who created the issue. Only used in admin mode. Can be null.
* @param array $labels Array of string labels to be attached to the issue. Analoguous to trac keywords.
* @param bool $confidential Is this issue confidential?
* @return Gitlab\Model\Issue
*/
public
function
createIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
)
{
public
function
createIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
,
$confidential
=
false
)
{
try
{
// Try to add, potentially as an admin (SUDO authorId)
$issue
=
$this
->
doCreateIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
,
$this
->
isAdmin
);
$issue
=
$this
->
doCreateIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
,
$confidential
,
$this
->
isAdmin
);
}
catch
(
\Gitlab\Exception\RuntimeException
$e
)
{
// If adding has failed because of SUDO (author does not have access to the project), create an issue without SUDO (as the Admin user whose token is configured)
if
(
$this
->
isAdmin
)
{
...
...
@@ -170,7 +171,7 @@ class GitLab
}
// Actually creates the issue
private
function
doCreateIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
,
$isAdmin
)
{
private
function
doCreateIssue
(
$projectId
,
$title
,
$description
,
$createdAt
,
$assigneeId
,
$authorId
,
$labels
,
$confidential
,
$isAdmin
)
{
$issueProperties
=
array
(
'title'
=>
$title
,
'description'
=>
$description
,
...
...
@@ -178,6 +179,9 @@ class GitLab
'labels'
=>
$labels
,
'created_at'
=>
$createdAt
);
if
(
$confidential
)
{
$issueProperties
[
'confidential'
]
=
true
;
}
if
(
$isAdmin
)
{
$issueProperties
[
'sudo'
]
=
$authorId
;
}
...
...
This diff is collapsed.
Click to expand it.
src/Migration.php
+
6
−
2
View file @
2b79c1a3
...
...
@@ -108,12 +108,16 @@ class Migration
$labels
=
$ticket
[
3
][
'keywords'
];
$dateCreated
=
$ticket
[
3
][
'time'
][
'__jsonclass__'
][
1
];
$dateUpdated
=
$ticket
[
3
][
'_ts'
];
$confidential
=
$ticket
[
3
][
'sensitive'
];
$attachments
=
$this
->
trac
->
getAttachments
(
$originalTicketId
);
$issue
=
$this
->
gitLab
->
createIssue
(
$gitLabProject
,
$title
,
$description
,
$dateCreated
,
$assigneeId
,
$creatorId
,
$labels
);
$issue
=
$this
->
gitLab
->
createIssue
(
$gitLabProject
,
$title
,
$description
,
$dateCreated
,
$assigneeId
,
$creatorId
,
$labels
,
$confidential
);
echo
'Created a GitLab issue #'
.
$issue
[
'iid'
]
.
' for Trac ticket #'
.
$originalTicketId
.
' : '
.
$this
->
gitLab
->
getUrl
()
.
'/'
.
$gitLabProject
.
'/issues/'
.
$issue
[
'iid'
]
.
"
\n
"
;
echo
'Created a GitLab issue #'
.
$issue
[
'iid'
]
.
' for Trac ticket #'
.
$originalTicketId
.
' : '
.
$this
->
gitLab
->
getUrl
()
.
'/'
.
$gitLabProject
.
'/issues/'
.
$issue
[
'iid'
]
.
"
\n
"
;
$mapping
[
$originalTicketId
]
=
$issue
[
'iid'
];
...
...
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