summaryrefslogtreecommitdiffstats
path: root/services/forms
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2022-02-09 20:28:55 +0000
committerGitHub <noreply@github.com>2022-02-09 20:28:55 +0000
commiteb748f5f3c93e8e347309fc75ea8273c06a5489b (patch)
treefceec474a21fa35437bcf3e90bd549c11976b72e /services/forms
parent439ad34c71b8777a9dac369c643560b18bc41bab (diff)
downloadgitea-eb748f5f3c93e8e347309fc75ea8273c06a5489b.tar.gz
gitea-eb748f5f3c93e8e347309fc75ea8273c06a5489b.zip
Add apply-patch, basic revert and cherry-pick functionality (#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 #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>
Diffstat (limited to 'services/forms')
-rw-r--r--services/forms/repo_form.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/services/forms/repo_form.go b/services/forms/repo_form.go
index b32bd3cafd..da709ef800 100644
--- a/services/forms/repo_form.go
+++ b/services/forms/repo_form.go
@@ -754,6 +754,30 @@ func (f *EditPreviewDiffForm) Validate(req *http.Request, errs binding.Errors) b
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}
+// _________ .__ __________.__ __
+// \_ ___ \| |__ __________________ ___.__. \______ \__| ____ | | __
+// / \ \/| | \_/ __ \_ __ \_ __ < | | | ___/ |/ ___\| |/ /
+// \ \___| Y \ ___/| | \/| | \/\___ | | | | \ \___| <
+// \______ /___| /\___ >__| |__| / ____| |____| |__|\___ >__|_ \
+// \/ \/ \/ \/ \/ \/
+
+// CherryPickForm form for changing repository file
+type CherryPickForm struct {
+ CommitSummary string `binding:"MaxSize(100)"`
+ CommitMessage string
+ CommitChoice string `binding:"Required;MaxSize(50)"`
+ NewBranchName string `binding:"GitRefName;MaxSize(100)"`
+ LastCommit string
+ Revert bool
+ Signoff bool
+}
+
+// Validate validates the fields
+func (f *CherryPickForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
+ ctx := context.GetContext(req)
+ return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
+}
+
// ____ ___ .__ .___
// | | \______ | | _________ __| _/
// | | /\____ \| | / _ \__ \ / __ |