Skip to content

Commit

Permalink
Improve id copying with field name, fix requires
Browse files Browse the repository at this point in the history
  • Loading branch information
14mRh4X0r committed Jan 8, 2017
1 parent d3181e3 commit 785e194
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
HOST = 'https://host/redmine/'
API_KEY = 'someapikey'

COPY_ISSUE_IDS = false

# User conversion from Redmine => Gitlab, e.g. {15 => 1, 19 => 2}
USER_CONVERSION = {}
DEFAULT_ACCOUNT = 1

PROJECT_CONVERSION = {'example' => 'my_namespace/my_project'}
COPY_ISSUE_ID_FIELD = nil # e.g. :project_issue_id

# Custom features in Redmine (id)
CUSTOM_FEATURES = []

Expand Down
6 changes: 2 additions & 4 deletions migrate.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env ruby

require 'fileutils'
require 'faraday'
require 'json'
require 'gitlab'
require_relative 'config'
require_relative 'redmine'
require_relative 'config'

NilClass.class_eval <<EOC
def name
Expand Down Expand Up @@ -140,7 +138,7 @@ def create_event(record, user_id, status, date, attributes = {})
issue.inspect
new_issue = Issue.new
new_issue.title = issue.subject
new_issue.iid = issue.id if COPY_ISSUE_IDS
new_issue.iid = issue.send(COPY_ISSUE_ID_FIELD) unless COPY_ISSUE_ID_FIELD.nil?
new_issue.state = state

new_issue.author_id = gl_user_id
Expand Down
3 changes: 3 additions & 0 deletions redmine.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require 'faraday'
require 'json'

module Redmine
def self.connection
raise 'must define a Host' if HOST.nil?
Expand Down

0 comments on commit 785e194

Please sign in to comment.