Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
redmine-sync
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
redmine-sync
Commits
b5060ec9
Commit
b5060ec9
authored
8 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
retrieve mapped names like projects, trackers
parent
889bee0a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Redmine/Wrapper.pm
+50
-8
50 additions, 8 deletions
lib/Redmine/Wrapper.pm
with
50 additions
and
8 deletions
lib/Redmine/Wrapper.pm
+
50
−
8
View file @
b5060ec9
...
...
@@ -39,20 +39,62 @@ sub attach
return
$self
->
{
_rm
}
if
(
exists
(
$self
->
{
_rm
}));
my
$rm
=
new
WebService::
Redmine
(
%
{
$self
->
{'
cfg
'}
->
{'
redmine
'}
});
my
$rm
=
new
WebService::
Redmine
(
%
{
$self
->
{'
cfg
'}});
# print "rm: ", Dumper ($rm);
$self
->
{
_rm
}
=
$rm
;
}
sub
get_mapped_id
{
my
$self
=
shift
;
my
$map_name
=
shift
;
my
$name
=
shift
;
my
$c
=
$self
->
{'
cfg
'};
# print "cfg: ", main::Dumper ($c);
my
$m
=
$c
->
{
$map_name
.
'
_ids
'};
# print "map_name=[$map_name] name=[$name] m=", main::Dumper ($m);
my
$id
;
if
(
exists
(
$m
->
{
$name
}))
{
$id
=
$m
->
{
$name
};
}
else
{
print
"
ATTN: no id known for
$map_name
=[
$name
]
\n
";
# TODO: add a lookup ...
}
$id
;
}
sub
get_tracker_id
{
my
$self
=
shift
;
my
$tracker_name
=
shift
;
$self
->
get_mapped_id
('
tracker_ids
',
$tracker_name
);
}
sub
get_project_id
{
my
$self
=
shift
;
my
$project_name
=
shift
;
$self
->
get_mapped_id
('
project_ids
',
$project_name
);
}
sub
fixup_issue
{
my
$self
=
shift
;
my
$issue
=
shift
;
my
$par
=
shift
;
foreach
my
$
key
(
keys
%$par
)
foreach
my
$
cf_name
(
keys
%$par
)
{
if
(
$
key
eq
'
custom_fields
')
if
(
$
cf_name
eq
'
custom_fields
')
{
transcribe_custom_fields
(
$self
->
{'
cfg
'}
->
{'
custom_field_ids
'},
$issue
,
$par
->
{'
custom_fields
'});
}
...
...
@@ -76,7 +118,7 @@ sub transcribe_custom_fields
my
$issue
=
shift
;
my
$kv
=
shift
;
print
"
ids:
",
main::
Dumper
(
$ids
);
#
print "ids: ", main::Dumper($ids);
$issue
->
{
custom_fields
}
=
[]
unless
(
defined
(
$issue
->
{
custom_fields
}));
my
$cf
=
$issue
->
{
custom_fields
};
...
...
@@ -86,7 +128,7 @@ sub transcribe_custom_fields
my
$cf_i
=
$cf
->
[
$i
];
$idx
{
$cf_i
->
{'
name
'}}
=
$i
;
}
print
"
cf:
",
main::
Dumper
(
$cf
);
#
print "cf: ", main::Dumper($cf);
# update incoming custom fields
AN:
foreach
my
$an
(
keys
%$kv
)
...
...
@@ -100,8 +142,8 @@ sub transcribe_custom_fields
my
$new_val
=
{
'
value
'
=>
$kv
->
{
$an
},
'
id
'
=>
$ids
->
{
$an
},
'
name
'
=>
$an
,
'
id
'
=>
$ids
->
{
$an
},
'
name
'
=>
$an
,
};
if
(
exists
(
$idx
{
$an
}))
...
...
@@ -114,7 +156,7 @@ sub transcribe_custom_fields
}
}
print
"
issue:
",
main::
Dumper
(
$issue
);
#
print "issue: ", main::Dumper($issue);
}
1
;
...
...
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