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

Add apply-patch, basic revert and cherry-pick functionality #17902

Merged
merged 56 commits into from
Feb 9, 2022

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Dec 3, 2021

This code adds a simple endpoint to apply patches to repositories and
branches on gitea. This is then used along with the conflicting checking
code in #18004 to provide a basic implementation of cherry-pick revert.

Now because the buttons necessary for cherry-pick and revert have
required us to create a dropdown next to the Browse Source button
I've also implemented Create Branch and Create Tag operations.

Fix #3880
Fix #17986

Signed-off-by: Andrew Thornton art27@cantab.net

Screenshots

Apply Patch

Screenshot from 2021-12-16 02-29-03
Screenshot from 2021-12-16 02-35-26
Screenshot from 2021-12-16 02-35-34

Cherry Pick/Revert

Screenshot from 2021-12-17 21-16-14
Screenshot from 2021-12-17 21-17-10
Screenshot from 2021-12-16 02-39-09
Screenshot from 2021-12-16 02-39-31

The commit message will be prefilled with the commit message being cherry-picked.

If the cherry-pick/revert fails then the results will pass back to the apply-patch screen to adjust the patch.

@zeripath zeripath added the type/feature Completely new functionality. Can only be merged if feature freeze is not active. label Dec 3, 2021
@zeripath
Copy link
Contributor Author

zeripath commented Dec 3, 2021

This PR is essentially a rebase of the very old WIP.

One thing that this PR isn't currently doing is ensuring that the protect file paths are checked but as far as I understand these will be checked in the post-receive of the ultimate push so I think this should be fine.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 3, 2021
This code adds a simple endpoint to apply patches to repositories and
branches on gitea.

Signed-off-by: Andrew Thornton <art27@cantab.net>
@lafriks
Copy link
Member

lafriks commented Dec 3, 2021

imho it's missing golang view tmpl file 😉

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor Author

zeripath commented Dec 4, 2021

imho it's missing golang view tmpl file wink

What do you mean?

@lafriks lafriks closed this Dec 4, 2021
@lafriks lafriks reopened this Dec 4, 2021
@lafriks
Copy link
Member

lafriks commented Dec 4, 2021

Sorry, GitHub wasn't showing templates/repo/editor/patch.tmpl file in diff previously somehow for me 😅

routers/api/v1/repo/patch.go Outdated Show resolved Hide resolved
routers/web/repo/patch.go Outdated Show resolved Hide resolved
@6543 6543 mentioned this pull request Dec 5, 2021
3 tasks
@zeripath zeripath changed the title Add apply-patch button Add apply-patch, basic revert and cherry-pick functionality Dec 12, 2021
Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor Author

This PR provides a very basic implementation of #3880

@lunny
Copy link
Member

lunny commented Dec 13, 2021

Could you post some screentshots?

Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
Copy link
Member

@6543 6543 left a comment

Choose a reason for hiding this comment

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

lgtm on backend side :)

@6543 6543 removed their assignment Feb 7, 2022
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 9, 2022
@6543
Copy link
Member

6543 commented Feb 9, 2022

🚀

@zeripath zeripath merged commit eb748f5 into go-gitea:main Feb 9, 2022
@zeripath zeripath deleted the apply-patch branch February 9, 2022 20:28
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 10, 2022
* giteaofficial/main:
  Fix issue with docker-rootless shimming script (go-gitea#18690)
  tests: remove redundant comparison in repo dump/restore (go-gitea#18660)
  [skip ci] Updated translations via Crowdin
  Disable unnecessary OpenID/OAuth2 elements (go-gitea#18491)
  Add apply-patch, basic revert and cherry-pick functionality (go-gitea#17902)
  C preprocessor colors improvement (go-gitea#18671)
  Update object repo with the migrated repository (go-gitea#18684)
Chianina pushed a commit to Chianina/gitea that referenced this pull request Mar 28, 2022
…#17902)

This code adds a simple endpoint to apply patches to repositories and
branches on gitea. This is then used along with the conflicting checking
code in go-gitea#18004 to provide a basic implementation of cherry-pick revert.

Now because the buttons necessary for cherry-pick and revert have 
required us to create a dropdown next to the Browse Source button
I've also implemented Create Branch and Create Tag operations.

Fix go-gitea#3880 
Fix go-gitea#17986 

Signed-off-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. 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.

Ability to create a tag on any commit from the web UI Allow to cherry-pick commit to other branch
9 participants