[Draft] Migrated Repository will show modifications when possible #17191

Open
99rgosse wants to merge 4 commits from 99rgosse/migration-history into main
99rgosse commented 2021-09-30 09:51:04 +00:00 (Migrated from github.com)

Edit : still in draft as I struggle with some tests

Edit : still looking at how to get the code coverage

This PR aims to recover Pull Request history for migrated repositories from Gitlab and Github :

Imported repositories with deleted branches will lose the base commit, thus imported repo won't show changes or commits:
image

See this repository : https://try.gitea.io/99rgosse/PR_dl_test2222/pulls/2

But, when importing PR, we can get the "pulls/{{pr.Index}}.patch file
Reading the first commit of this file and getting it's rev-list parent then allows to show the history.

It would be great if some of you could do some mentoring for a better integration, thanks in advance for your consideration.

  • Passes "make test"
  • Some PR from Gitlab migrated repository - Tested on some huge repo ok
  • Some PR from Github migrated repository - It seems not to impact existing PR, I don't know for broken imported I don't have any from Github, but tested on huge Repo as well
  • Some PR from other service migrated repository ?

This would help people migrating from other services without losing much history

Result with local patch :
image

Edit : still in draft as I struggle with some tests Edit : still looking at how to get the code coverage This PR aims to recover Pull Request history for migrated repositories from Gitlab and Github : Imported repositories with deleted branches will lose the base commit, thus imported repo won't show changes or commits: ![image](https://user-images.githubusercontent.com/61579380/135429131-1d433bc0-6dd0-4288-8a31-2dba117e491f.png) See this repository : https://try.gitea.io/99rgosse/PR_dl_test2222/pulls/2 But, when importing PR, we can get the "pulls/{{pr.Index}}.patch file Reading the first commit of this file and getting it's rev-list parent then allows to show the history. It would be great if some of you could do some mentoring for a better integration, thanks in advance for your consideration. - [X] Passes "make test" - [X] Some PR from Gitlab migrated repository - Tested on some huge repo ok - [X] Some PR from Github migrated repository - It seems not to impact existing PR, I don't know for broken imported I don't have any from Github, but tested on huge Repo as well - [ ] Some PR from other service migrated repository ? This would help people migrating from other services without losing much history Result with local patch : ![image](https://user-images.githubusercontent.com/61579380/135640488-81aab295-9477-4bd5-a265-5aac05ace154.png)
99rgosse (Migrated from github.com) reviewed 2021-09-30 09:56:28 +00:00
99rgosse (Migrated from github.com) commented 2021-09-30 09:56:28 +00:00

We could use this part to avoid the call in https://github.com/go-gitea/gitea/pull/17191/files#diff-9107a2d87c7913bc4fbdf735c0391d8e9ed5936ebac72a9bd23188616accc4a7R335
But otherwise I revert to a simple read patch file

We could use this part to avoid the call in https://github.com/go-gitea/gitea/pull/17191/files#diff-9107a2d87c7913bc4fbdf735c0391d8e9ed5936ebac72a9bd23188616accc4a7R335 But otherwise I revert to a simple read patch file
99rgosse (Migrated from github.com) reviewed 2021-09-30 09:58:03 +00:00
99rgosse (Migrated from github.com) commented 2021-09-30 09:58:03 +00:00

This function is still very in early stage and I was wondering if I should just grab the first commit of a patch file, or read also the git apply --stat

This function is still very in early stage and I was wondering if I should just grab the first commit of a patch file, or read also the git apply --stat
99rgosse (Migrated from github.com) reviewed 2021-09-30 14:33:50 +00:00
99rgosse (Migrated from github.com) commented 2021-09-30 14:33:50 +00:00

I let this trace just for manual checking, will remove it for merge

I let this trace just for manual checking, will remove it for merge
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: lunny/gitea#17191
No description provided.