在GitLab上创建问题时是否可以指定ID?

时间:2015-10-07 13:59:18

标签: gitlab redmine

我打算使用此脚本将问题从Redmine转移到GitLab

https://github.com/sdslabs/redmine-to-gitlab/blob/master/issue-tranfer.py

它有效,但我想在过渡期间保留问题ID。默认情况下,GitLab只从#1开始并增加。我尝试添加“newissue ['iid'] = issue ['id']”和参数的变化,但显然GitLab根本不允许分配id。任何人都知道是否有办法?

“问题”是从redmine获得的数据:

newissue = {}
    newissue['id'] = pro['id']
    newissue['title'] = issue['subject']
    newissue['description'] = issue["description"]
    if 'assigned_to' in issue:
        auser = con.finduserbyname(issue['assigned_to']['name'])
        if(auser):
            newissue['assignee_id'] = auser['id']
    print newissue
    if ('fixed_version' in issue):
        newissue['milestone_id'] = issue['fixed_version']['id']

    newiss = post('/projects/' + str(pro['id']) + '/issues', newissue)

这是“帖子”功能

def post( url, load = {}):
    load['private_token'] = conf.token
    r = requests.post(conf.base_url + url, params = load, verify = conf.sslverify)
    return r.json()

1 个答案:

答案 0 :(得分:0)

API不允许您在创建时指定问题ID。该ID旨在是顺序的。您可能完成此任务的唯一方法是直接与数据库交互。如果你选择这条路线,我提醒你要非常小心,并备份。