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
47fb6dd3
Commit
47fb6dd3
authored
11 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
updated POD sections
parent
0d61a777
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
README.md
+13
-7
13 additions, 7 deletions
README.md
t_sync.pl
+24
-9
24 additions, 9 deletions
t_sync.pl
with
38 additions
and
16 deletions
.gitignore
+
1
−
0
View file @
47fb6dd3
@*
ts.*
typescript
tmp/
This diff is collapsed.
Click to expand it.
README.md
+
13
−
7
View file @
47fb6dd3
...
...
@@ -3,17 +3,17 @@ Perl script to sync individual projects to another Redmine instance.
Status
My current goal is to synchronize one isolated project, which only
has
Wiki pages and attachments, from one instance to another.
In the end,
this project shall only be used on the destination instance.
This is
more complicated tha
t
initially assumed but still leaves out
the rather
hairy problem of migrating issues or even issue numbers and
whatever
embedded in Wiki text.
My current goal is to synchronize one isolated project, which only
has
Wiki pages and attachments, from one
Redmine
instance to another.
In the end,
this project shall only be used on the destination instance.
This is
more complicated tha
n
initially assumed
,
but still leaves out
the rather
hairy problem of migrating issues or even issue numbers and
whatever
embedded in Wiki text.
Right now, synchronizing stuff that are related to users work.
Wiki migration seems to work now too.
The next step
is are
Wiki-Attachments
.
The next step
:
Wiki-Attachments
Why Perl? I'm not fluent enough in Ruby to even consider it as the
tool of choice for this problem. The script directly talks with
...
...
@@ -26,3 +26,9 @@ NOTES
The project's entry in 'wikis' whould be added to syncs by hand
since Redmine creates the Wiki but the script currently doesn't
check for that, it only looks at the syncs table.
TODOS
*
watchers: point to various content types, so only stuff
that is actually handled should be migrated here
This diff is collapsed.
Click to expand it.
t_sync.pl
+
24
−
9
View file @
47fb6dd3
...
...
@@ -9,7 +9,10 @@ use warnings;
=head1 DESCRIPTION
do stuff on a Redmine database
Do stuff on a Redmine database. Used as an experimental sync-tool to
migrate individual projects to another server.
See https://github.com/gonter/redmine-sync
=head1 OPERATION MODES
...
...
@@ -31,10 +34,23 @@ use Redmine::DB::MySQL;
use
Redmine::DB::
CTX
;
# use Redmine::DB::Project; nothing here yet ...
# yeah, this should be in a config file, but
my
$setup_file
;
# --- BEGIN ------------------------------------------------------------
=begin comment
Yeah, this should be in a config file, but this will do for now.
This structure ($setup) resembles something like a "synchronisation
context". A "synchronisation context" needs to describe:
* src: source Redmine instance
* dst: destination Redmine instance
* projects to be synced
# this structure ($setup) resembles something like a "context"
=end comment
=cut
my
$setup_file
;
my
$setup
=
{
'
src
'
=>
...
...
@@ -48,10 +64,10 @@ my $setup=
'
db
'
=>
'
production
',
},
'
sync_context_id
'
=>
1
,
'
syncs
'
=>
'
syncs
'
=>
# not used, instead, this is written directly into the database
[
# { 'table' => 'projects', 'src_id' => 170, 'dst_id' => 1 }
{
'
table
'
=>
'
auth_sources
',
'
src_id
'
=>
1
,
'
dst_id
'
=>
1
,
}
{
'
table
'
=>
'
auth_sources
',
'
src_id
'
=>
1
,
'
dst_id
'
=>
1
}
],
'
sync_projects
'
=>
[
...
...
@@ -61,6 +77,7 @@ my $setup=
}
]
};
# --- END --------------------------------------------------------------
my
@parameters
=
();
my
$op_mode
=
'
usage
';
...
...
@@ -139,7 +156,6 @@ elsif ($op_mode eq 'user')
my
$user
=
$cfg
->
get_user
(
$an
,
$av
);
print
"
user:
",
Dumper
(
$user
);
}
}
elsif
(
$op_mode
eq
'
syncuser
')
{
...
...
@@ -176,7 +192,7 @@ elsif ($op_mode eq 'sync')
print
"
\n
"
x3
,
'
=
'
x72
,
"
\n
",
"
Statistics:
",
Dumper
(
$ctx
->
{'
stats
'});
}
elsif
(
$op_mode
eq
'
diag
')
elsif
(
$op_mode
eq
'
xxx
diag
')
{
my
$src
=
read_configs
(
$setup
,
'
src
');
my
$dst
=
read_configs
(
$setup
,
'
dst
');
...
...
@@ -192,7 +208,6 @@ elsif ($op_mode eq 'diag')
# my $src_members= $src->get_project_members (... some project id ...);
# print "src_members: ", Dumper ($src_members);
# print "src: ", Dumper ($src);
}
else
...
...
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