Clara Daia
Clara Daia

Reputation: 159

Is it possible to specify an id when creating an issue on GitLab?

I intend to transfer issues from Redmine to GitLab using this script

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

It works, but I would like to keep the issues ids during the transition. By default GitLab just starts from #1 and increases. I tried adding "newissue['iid']=issue['id']" and variations to the parameters, but apparently GitLab simply does not permit assigning an id. Anyone knows if there's a way?

"issue" is the data acquired from 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)

and this is the "post" function

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

Upvotes: 0

Views: 95

Answers (1)

Drew Blessing
Drew Blessing

Reputation: 2705

The API does not allow you to specify an issue ID at creation time. The ID is intended to be sequential. The only way you could potentially accomplish this task is to interact with the database directly. If you choose this route I caution you to be extremely careful, and have backups.

Upvotes: 0

Related Questions