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

Pull request revisions. #12665

Closed
wants to merge 1 commit into from
Closed

Pull request revisions. #12665

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 31, 2020

Fixes #12604
Fixes #5254

@ghost ghost marked this pull request as draft August 31, 2020 15:43
@ghost ghost mentioned this pull request Aug 31, 2020
@ghost ghost force-pushed the revisions branch 2 times, most recently from 7d611b4 to 467435e Compare September 2, 2020 17:22
@zeripath
Copy link
Contributor

zeripath commented Sep 2, 2020

Lint is failing due to a spelling mistake.

I before E except after C or sounding as Ay as in Weigh... and all that jazz...

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 2, 2020
models/pull.go Outdated Show resolved Hide resolved
@ghost ghost force-pushed the revisions branch 2 times, most recently from ad6bf95 to 36f7d4f Compare September 2, 2020 22:21
@ghost
Copy link
Author

ghost commented Sep 2, 2020

2 things to note:

  1. The owner/repo/compare/commit1...commit2 doesn't work correctly when the two commit has the same content but themselves are different. Example: create a PR with two commits, squash and then force push. Now you have two revisions. Comparing the second to the first one should show no additional change. It actually works perfectly on the Files changed pane in the PR itself. However if you do a full revision compare by clicking on compare to previous on the Revisions page (which will take you to the /compare/headhashv1...headhashv2 url) that will show all the files as changed. Its like a git show instead of a git diff. I looked at the code and I think maybe the compareinfo.mergehead is bad?
  2. The revision creation is different for the creation of the PR and subsequent pushes. For subsequent pushes the revision is created in two steps. 1 is the git ref creation which is done at the post receive hook. And the database entry is created by the CreatePushPullComment later because only then is the pusher available.

@techknowlogick techknowlogick added type/feature Completely new functionality. Can only be merged if feature freeze is not active. pr/wip This PR is not ready for review labels Sep 5, 2020
@techknowlogick techknowlogick added this to the 1.14.0 milestone Sep 5, 2020
@ghost
Copy link
Author

ghost commented Sep 7, 2020

Note to self: a separate patchset/difftree comparison page is needed. (to implement use: git patch, git diff-tree, git merge-base, git cherry)

Currently I believe that our compare page doesn't do the kind of shit that github does when comparing branches and listing how many commits behind ahead is the branch. This is good. A simple compare is basically should be a diff without the noise of that kind of stuff and a separate more detailed tree/patches compare page should exists.

@ghost
Copy link
Author

ghost commented Sep 10, 2020

Alright I will leave the diff tree feature to an other day. I will open an issue for it.

@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2020

Codecov Report

Merging #12665 into master will increase coverage by 0.05%.
The diff coverage is 54.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12665      +/-   ##
==========================================
+ Coverage   43.07%   43.13%   +0.05%     
==========================================
  Files         658      661       +3     
  Lines       72451    72729     +278     
==========================================
+ Hits        31211    31373     +162     
- Misses      36183    36259      +76     
- Partials     5057     5097      +40     
Impacted Files Coverage Δ
models/migrations/migrations.go 2.46% <ø> (ø)
models/migrations/v153.go 0.00% <0.00%> (ø)
modules/git/repo_commit.go 51.63% <ø> (+1.09%) ⬆️
routers/repo/pull.go 33.86% <38.59%> (+0.32%) ⬆️
modules/git/repo_ref.go 70.27% <50.00%> (-7.51%) ⬇️
models/revision.go 56.09% <56.09%> (ø)
routers/repo/middlewares.go 58.13% <57.14%> (-0.20%) ⬇️
modules/git/repo_revision.go 66.66% <66.66%> (ø)
services/pull/pull.go 41.64% <66.66%> (+0.86%) ⬆️
models/models.go 56.15% <100.00%> (+0.21%) ⬆️
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dbca92...006103a. Read the comment docs.

@ghost
Copy link
Author

ghost commented Sep 10, 2020

Okay, I think it is good enough. I might create the more comprehensive tree comparsion page later.

@ghost ghost changed the title [WIP]: Pull request revisions. Pull request revisions. Sep 10, 2020
@ghost ghost marked this pull request as ready for review September 10, 2020 14:27
@ghost ghost requested a review from zeripath September 10, 2020 14:27
@ghost
Copy link
Author

ghost commented Sep 10, 2020

Screenshot from 2020-09-10 16-29-34
Screenshot from 2020-09-10 16-29-28
Screenshot from 2020-09-10 16-29-24
Screenshot from 2020-09-10 16-29-16
Screenshot from 2020-09-10 16-29-07

@ghost
Copy link
Author

ghost commented Sep 10, 2020

The tree compare issue: #12800

@ghost ghost force-pushed the revisions branch 3 times, most recently from 3647d39 to 2d95c3f Compare September 11, 2020 15:58
models/migrations/v151.go Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Sep 14, 2020

I am not exactly sure why the tests with my fixtures are not working. @a1012112796 any idea how to fix the current unit test failures?

@ghost ghost force-pushed the revisions branch 10 times, most recently from b98b4c2 to 674ed8f Compare September 18, 2020 12:52
@ghost ghost requested a review from lunny September 18, 2020 13:35
@ghost
Copy link
Author

ghost commented Sep 18, 2020

I added tests and fixed the issues.

@lunny @zeripath @a1012112796 Anything else?

models/migrations/v152.go Outdated Show resolved Hide resolved
Comment on lines +39 to +43
if has {
rev.ChangesetHeadRef = git.GetRevisionRef(pr.ID, index)
if index > 1 {
rev.PrevChangesetHeadRef = git.GetRevisionRef(pr.ID, index-1)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not suggest do it here.

Comment on lines +60 to +62
}
return err
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
return err
}
} else {
return err
}
}

@ghost
Copy link
Author

ghost commented Sep 23, 2020

I think I have run out of time to make this work

@ghost ghost closed this Sep 23, 2020
@lunny lunny removed this from the 1.14.0 milestone Sep 28, 2020
@ghost ghost mentioned this pull request Oct 26, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/feature Completely new functionality. Can only be merged if feature freeze is not active.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Versions in Pull requests. Implement Pull Requests history
7 participants