def migrate(trac, gitlab_project_name, gitlab_version, gitlab_db_connector, output_wiki_path, output_uploads_path, gitlab_fallback_user, usermap=None): LOG.info('migrating project %s to GitLab ver. %s', gitlab_version, gitlab_project_name) LOG.info('uploads repository path is: %s', output_uploads_path) db_model = model.get_model(gitlab_version) LOG.info('retrieved database model for GitLab ver. %s: %s', gitlab_version, db_model.__file__) gitlab = direct.Connection(gitlab_project_name, output_uploads_path, db_model, gitlab_db_connector) LOG.info('estabilished connection to GitLab database') # 1. Wiki LOG.info('migrating %d wiki pages to: %s', len(trac['wiki']), output_wiki_path) migrate_wiki(trac['wiki'], gitlab, output_wiki_path) # 2. Milestones LOG.info('migrating %d milestones', len(trac['milestones'])) migrate_milestones(trac['milestones'], gitlab) # 3. Issues LOG.info('migrating %d tickets to issues', len(trac['tickets'])) migrate_tickets(trac['tickets'], gitlab, gitlab_fallback_user, usermap) # Farewell LOG.info('done migration of project %s to GitLab ver. %s', gitlab_version, gitlab_project_name)
def migrate(trac, gitlab_project_name, gitlab_version, gitlab_db_connector, output_wiki_path, output_uploads_path, gitlab_fallback_user, usermap=None, userattrs=None, svn2git_revisions={}): LOG.info('migrating project %r to GitLab ver. %s', gitlab_project_name, gitlab_version) LOG.info('uploads repository path is: %r', output_uploads_path) db_model = model.get_model(gitlab_version) LOG.info('retrieved database model for GitLab ver. %s: %r', gitlab_version, db_model.__file__) gitlab = direct.Connection(gitlab_project_name, db_model, gitlab_db_connector, output_uploads_path, create_missing=False) LOG.info('estabilished connection to GitLab database') # 0. Users create_users = False usermanager = UserManager(gitlab, usermap=usermap, userattrs=userattrs, fallback_user=gitlab_fallback_user, create_users=create_users) usermanager.load_users(trac['authors']) # XXX # if overwite and mode == direct # XXX: this clears also milestones # XXX: make configurable gitlab.clear_issues() # gitlab.clear_labels() # 1. Wiki LOG.info('migrating %d wiki pages to: %s', len(trac['wiki']), output_wiki_path) migrate_wiki(trac['wiki'], gitlab, output_wiki_path) # 2. Milestones migrate_milestones(trac['milestones'], gitlab) # create labels labelmanager = LabelManager(gitlab, LOG) labelmanager.create_labels(trac['tickets']) # 3. Issues migrate_tickets(trac['tickets'], gitlab, svn2git_revisions=svn2git_revisions, labelmanager=labelmanager, usermanager=usermanager) # - gitlab bug? close_milestones(trac['milestones'], gitlab) # Farewell LOG.info('done migration of project %r to GitLab ver. %s', gitlab_project_name, gitlab_version)
def migrate(trac, gitlab_project_name, gitlab_version, gitlab_db_connector, output_wiki_path, attachments_path, output_uploads_path, gitlab_fallback_user, usermap=None, userattrs=None): LOG.info('migrating project %r to GitLab ver. %s', gitlab_project_name, gitlab_version) LOG.info('uploads repository path is: %r', output_uploads_path) db_model = model.get_model(gitlab_version) LOG.info('retrieved database model for GitLab ver. %s: %r', gitlab_version, db_model.__file__) gitlab = direct.Connection(gitlab_project_name, db_model, gitlab_db_connector, output_uploads_path, create_missing=True) LOG.info('estabilished connection to GitLab database') # 0. Users for email in chain(six.itervalues(usermap), [gitlab_fallback_user]): attrs = { # set mandatory values to defaults 'email': email, 'username': email.split('@')[0], 'encrypted_password': generate_password(), } attrs.update(userattrs.get(email, {})) gitlab.create_user(**attrs) LOG.info('created GitLab user %r', email) LOG.debug('created GitLab user %r with attributes: %r', email, attrs) # 1. Wiki LOG.info('migrating %d wiki pages to: %s', len(trac['wiki']), output_wiki_path) migrate_wiki(trac['wiki'], gitlab, output_wiki_path) # 2. Milestones LOG.info('migrating %d milestones', len(trac['milestones'])) migrate_milestones(trac['milestones'], gitlab) # 3. Issues LOG.info('migrating %d tickets to issues', len(trac['tickets'])) migrate_tickets(trac['tickets'], gitlab, gitlab_fallback_user, usermap, attachments_path, gitlab_project_name) # Farewell LOG.info('done migration of project %r to GitLab ver. %s', gitlab_project_name, gitlab_version)