summaryrefslogtreecommitdiffstats
path: root/modules/convert/pull.go
Commit message (Collapse)AuthorAgeFilesLines
* Add `context.Context` to more methods (#21546)KN4CK3R2022-11-191-3/+3
| | | | | | | This PR adds a context parameter to a bunch of methods. Some helper `xxxCtx()` methods got replaced with the normal name now. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move issues related files into models/issues (#19931)Lunny Xiao2022-06-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Move access and repo permission to models/perm/access * fix test * fix git test * Move functions sequence * Some improvements per @KN4CK3R and @delvh * Move issues related code to models/issues * Move some issues related sub package * Merge * Fix test * Fix test * Fix test * Fix test * Rename some files
* Move access and repo permission to models/perm/access (#19350)Lunny Xiao2022-05-111-2/+3
| | | | | * Move access and repo permission to models/perm/access * Remove unnecessary code
* Add "Allow edits from maintainer" feature (#18002)qwerty2872022-04-281-0/+2
| | | | | | | | | | | | | | | | | Adds a feature [like GitHub has](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) (step 7). If you create a new PR from a forked repo, you can select (and change later, but only if you are the PR creator/poster) the "Allow edits from maintainers" option. Then users with write access to the base branch get more permissions on this branch: * use the update pull request button * push directly from the command line (`git push`) * edit/delete/upload files via web UI * use related API endpoints You can't merge PRs to this branch with this enabled, you'll need "full" code write permissions. This feature has a pretty big impact on the permission system. I might forgot changing some things or didn't find security vulnerabilities. In this case, please leave a review or comment on this PR. Closes #17728 Co-authored-by: 6543 <6543@obermui.de>
* more context for models (#19511)65432022-04-281-4/+4
| | | | | make more usage of context, to have more db transaction in one session (make diff of #9307 smaller)
* Set correct PR status on 3way on conflict checking (#19457)Gusted2022-04-211-4/+1
| | | | | | | | | | | | | | | * Set correct PR status on 3way on conflict checking - When 3-way merge is enabled for conflict checking, it has a new interesting behavior that it doesn't return any error when it found a conflict, so we change the condition to not check for the error, but instead check if conflictedfiles is populated, this fixes a issue whereby PR status wasn't correctly on conflicted PR's. - Refactor the mergeable property(which was incorrectly set and lead me this bug) to be more maintainable. - Add a dedicated test for conflicting checking, so it should prevent future issues with this. * Fix linter
* Move milestone to models/issues/ (#19278)Lunny Xiao2022-04-081-1/+1
| | | | | | | | | | | * Move milestone to models/issues/ * Fix lint * Fix test * Fix lint * Fix lint
* Make git.OpenRepository accept Context (#19260)65432022-03-301-4/+4
| | | | | * OpenRepositoryCtx -> OpenRepository * OpenRepository -> openRepositoryWithDefaultContext, only for internal usage
* Propagate context and ensure git commands run in request context (#17868)zeripath2022-01-191-5/+6
| | | | | | | | | This PR continues the work in #17125 by progressively ensuring that git commands run within the request context. This now means that the if there is a git repo already open in the context it will be used instead of reopening it. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use fmt.Sprintf correctly (#17886)delvh2021-12-021-1/+1
|
* Refactor various strings (#17784)mscherer2021-12-021-1/+1
| | | | | | | | Fixes #16478 Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Gusted <williamzijl7@hotmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Move accessmode into models/perm (#17828)Lunny Xiao2021-11-281-6/+7
|
* Move user related model into models/user (#17781)Lunny Xiao2021-11-241-1/+2
| | | | | | | | | | | | | * Move user related model into models/user * Fix lint for windows * Fix windows lint * Fix windows lint * Move some tests in models * Merge
* Move repofiles from modules/repofiles to services/repository/files (#17774)Lunny Xiao2021-11-241-2/+8
| | | | | | | | | * Move repofiles from modules to services * rename services/repository/repofiles -> services/repository/files * Fix test Co-authored-by: 6543 <6543@obermui.de>
* API pull's head/base have correct permission (#17214)pricly-yellow2021-10-071-3/+15
| | | | | | | | | | close #17181 * for all pull requests API return permissions of caller * for all webhook return empty permissions Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: 6543 <6543@obermui.de>
* Add agit flow support in gitea (#14295)a10121127962021-07-281-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * feature: add agit flow support ref: https://git-repo.info/en/2020/03/agit-flow-and-git-repo/ example: ```Bash git checkout -b test echo "test" >> README.md git commit -m "test" git push origin HEAD:refs/for/master -o topic=test ``` Signed-off-by: a1012112796 <1012112796@qq.com> * fix lint * simplify code add fix some nits * update merge help message * Apply suggestions from code review. Thanks @jiangxin * add forced-update message * fix lint * splite writePktLine * add refs/for/<target-branch>/<topic-branch> support also * Add test code add fix api * fix lint * fix test * skip test if git version < 2.29 * try test with git 2.30.1 * fix permission check bug * fix some nit * logic implify and test code update * fix bug * apply suggestions from code review * prepare for merge Signed-off-by: Andrew Thornton <art27@cantab.net> * fix permission check bug - test code update - apply suggestions from code review @zeripath Signed-off-by: a1012112796 <1012112796@qq.com> * fix bug when target branch isn't exist * prevent some special push and fix some nits * fix lint * try splite * Apply suggestions from code review - fix permission check - handle user rename * fix version negotiation * remane * fix template * handle empty repo * ui: fix branch link under the title * fix nits Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* [refactor] Unify the export of user data via API (#15144)65432021-03-271-1/+1
| | | | | * [refactor] unify how user data is exported via API * test time via unix timestamp
* [API] get pull, return head branch sha, even if deleted (#14931)65432021-03-081-0/+18
| | | | | * API: return head branch sha, even if deleted * relax if ref not resolvable
* Move Repo APIFormat to convert package (#13787)65432020-12-021-2/+2
| | | | | * Move Repo APIFormat to convert package * tweek
* [Refactor] Move APIFormat functions into convert package (#12856)65432020-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * USER APIFormat -> ToUser * Migrate more and mark APIFormat deprecated * models.Comment APIFormat() -> convert.ToComment * models.Release APIFormat() -> convert.ToRelease * models.Attachments APIFormat() -> convert.ToReleaseAttachments * models.CommitStatus APIFormat() -> convert.ToCommitStatus * finish migration to convert.ToUser * Move Test * Imprufe Test * fix test Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Issue/Pull expose IsLocked Property on API (#11708)65432020-06-011-0/+1
| | | | Expose IsLocked Property
* Fix panic in API pulls when headbranch does not exist (#10676)zeripath2020-03-091-1/+1
| | | | | | * Fix panic in API pulls when headbranch does not exist * refix other reference to plumbing.ErrReferenceNotFound Signed-off-by: Andrew Thornton <art27@cantab.net>
* Display pull request head branch even the branch deleted or repository ↵Lunny Xiao2020-03-021-62/+59
| | | | | | | | | | | | | | | | deleted (#10413) * Display pull request head branch even the branch deleted or repository deleted * Merge getHeadRepo/loadHeadRepo and getBaseRepo/loadBaseRepo on pull and fill repo when pr.Issue.Repo is available * retrieve sha from pull head when pull request branch deleted and fix tests * Fix test * Ensure MustHeadRepoName returns empty string if no head repo Co-authored-by: zeripath <art27@cantab.net>
* [Refactor] move APIFormat() of Issue and Label to convert package (#10423)65432020-02-281-1/+1
| | | | | | | | | | | | | | | | | | | * Label: delete .APIFormat() and use convert.ToLabel() * move issue APIFormat too * add missing one * move TEST too * handle error -> return empty APIIssue * Apply suggestions from code review Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
* [BugFix] [API] Pull.API.Convert: Only try to get HeadBranch if HeadRepo ↵65432020-01-311-29/+37
| | | | | | | | | | | | | | exist (#10029) * only try to get HeadBranch if HeadRepo exist * impruve * no nil error * add TEST * correct error msg
* Move newbranch to standalone package (#9627)Lunny Xiao2020-01-141-2/+3
| | | | | | | | | | | | * Move newbranch to standalone package * move branch functions to modules to avoid dependencies cycles * fix tests * fix lint * fix lint
* Move pull request api convert to convert package (#9664)Lunny Xiao2020-01-101-0/+141
* Move pull request api convert to convert package * Rename ToPullRequest to ToAPIPullRequest