Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gitlab migrate mergerequests+issues fail #13884

Closed
6543 opened this issue Dec 7, 2020 · 17 comments · Fixed by #28616
Closed

gitlab migrate mergerequests+issues fail #13884

6543 opened this issue Dec 7, 2020 · 17 comments · Fixed by #28616
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Milestone

Comments

@6543
Copy link
Member

6543 commented Dec 7, 2020

gitea version: v1.13.0 - master

error message: Migrate repository from https://gitlab.com/troyengel/archbuild failed: Error 1062: Duplicate entry '284-2' for key 'UQE_issue_repo_index'

to reporduce:

if you only migrate one of them it works. so the problem is related to the workaround for new pull indexes

@6543 6543 added type/bug topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them labels Dec 7, 2020
@6543 6543 changed the title gitlab migrate mergerequests fail gitlab migrate mergerequests+issues fail Dec 7, 2020
@techknowlogick
Copy link
Member

techknowlogick commented Dec 9, 2020

This is rather unusual, does that mean Gitlab doesn't maintain that issues and PRs must have unique numbers?

Edit: How would comments that reference an issue that has a a PR with the same ID index?

@rsnyman
Copy link

rsnyman commented Dec 20, 2020

@techknowlogick as far as I can tell, in GitLab issues and merge requests are completely separate, so they can easily have "clashing" IDs because they never share data (different tables in the DB I'm guessing). This is in contrast with GitHub which seems to make PRs and Issues the same thing.

@lunny
Copy link
Member

lunny commented Dec 21, 2020

So we may have to change the id

@techknowlogick
Copy link
Member

So we may have to change the id

We would need ensure that we modify comments/issues that link to PR use updated ID

@togetherwithasteria
Copy link

togetherwithasteria commented Dec 15, 2021

Reproduced this. Slightly different log but same meaning. Running on Docker with version v1.15.7 with Postgres.

gitea       | 2021/12/15 15:56:58 modules/task/task.go:54:handle() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"

Repository used for this: https://gitlab.com/EchidnaHQ/Echidna

@togetherwithasteria
Copy link

togetherwithasteria commented Dec 15, 2021

So we may have to change the id

We would need ensure that we modify comments/issues that link to PR use updated ID

Don't forget about MR and issue references in Git commits. Of course we can't change them, because it will cause the commit to lose its original hash and and thus making commit references in other commits problematic and it will unsign the signed commits, which is not nice because that's the only way to verify that a commit actually came from its author and not people spoofing the git author email and username.

We will have to somehow keep references to the original GitLab issue or MR's ID and make a link for any references to them in Git commits. Perhaps display the original ID as well in the MR/issue page so that noone get confused.

@togetherwithasteria
Copy link

togetherwithasteria commented Dec 15, 2021

Reproduced on Docker running version v1.16.0+dev-692-gf58e687a8 with Postgres.

Repository: https://gitlab.com/troyengel/archbuild

gitea     | 2021/12/15 21:11:22 ...ervices/task/task.go:56:handle() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"

@togetherwithasteria

This comment has been minimized.

@douglasparker
Copy link

This is still a major issue when migrating from GitLab. I had to drop all merge requests to avoid this error and successfully import my repositories.

@wetneb
Copy link

wetneb commented Dec 8, 2023

This issue is fixed in Forgejo 1.21.2+0.

@delvh
Copy link
Member

delvh commented Dec 8, 2023

I mean, this isn't forgejo, but yes, if it is fixed there, it most likely will be here too.

@delvh delvh closed this as completed Dec 8, 2023
@wetneb
Copy link

wetneb commented Dec 8, 2023

@delvh as far as I am aware, this is not fixed in Gitea yet: I submitted the corresponding pull requests to Forgejo, and I don't think they got cherry-picked by Gitea. So I would keep this issue open.

@delvh delvh reopened this Dec 8, 2023
@hramrach
Copy link

Can you link to the fix in forgejo?

Anyway, I suppose if this is to be fixed then

  • An arbitrary prefix needs to be configured for # or ! references for the project (eg. 1000000).
  • Manage branches in UI #666 would map to Manage branches in UI #666, and !666 to #1000666 with 1000000 prefix configured for !
  • All issues and PRs can be converted, and references in commit messages resolved as well.

This could be hardcoded but making it per-project configuration sounds more reasonable.

@wetneb
Copy link

wetneb commented Dec 26, 2023

The fix is here: https://codeberg.org/forgejo/forgejo/pulls/1790

@lunny
Copy link
Member

lunny commented Dec 26, 2023

The fix is here: https://codeberg.org/forgejo/forgejo/pulls/1790

Can you send a PR to Gitea too?

@wxiaoguang
Copy link
Contributor

The fix is here: https://codeberg.org/forgejo/forgejo/pulls/1790

That change doesn't seem ideal. For example, the ? in filename breaks all Windows developers' workspace.

@lunny lunny added this to the 1.21.4 milestone Dec 27, 2023
lunny pushed a commit that referenced this issue Dec 27, 2023
…om GitLab (#28616) (#28618)

Backport #28616 by wxiaoguang

Fix #13884

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@hramrach
Copy link

hramrach commented Jan 2, 2024

It's not ideal indeed. It's very explicit about inability to migrate more issues once any PRs are migrated.

In particular mirroring a repository cannot work this way.

Also it is not clear to me how the !1 reference to a PR in the commit message would be resolved with this solution.

fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2024
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/repo-migration Migrate repos from other platforms to Gitea, or from Gitea to them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants