Lunny Xiao
1a9821f57a
Move issues related files into models/issues ( #19931 )
...
* 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
3 years ago
Lunny Xiao
fd7d83ace6
Move almost all functions' parameter db.Engine to context.Context ( #19748 )
...
* Move almost all functions' parameter db.Engine to context.Context
* remove some unnecessary wrap functions
3 years ago
Lunny Xiao
4344a64107
Allow custom default merge message with .gitea/default_merge_message/<merge_style>_TEMPLATE.md ( #18177 )
...
* Allow custom default merge message with .gitea/MERGE_MESSAGE_<merge_style>_TEMPLATE.md
* Some improvements
* Follow some advices
* Fix bug
* Fix bug
* Fix lint
* Fix close comment
* Fix test
* Fix and docs
* Improve codes
* Update docs and remove unnecessary variables
* return error for GetDefaultMergeMessage
* Fix test
* improve code
* ignore unknow unit type
* return error for GetDefaultMergeMessage
* Update services/pull/merge.go
* Some improvements
* Follow some advices
* Fix bug
* Fix lint
* Improve codes
* Update docs and remove unnecessary variables
* return error for GetDefaultMergeMessage
* improve code
* Handle deleted HeadRepo in GetDefaultMergeMessage
Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix test
* Fix test
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
6543
92f139d091
Use for a repo action one database transaction ( #19576 )
...
... more context
(part of #9307 )
3 years ago
6543
06e4687cec
more context for models ( #19511 )
...
make more usage of context, to have more db transaction in one session
(make diff of #9307 smaller)
3 years ago
6543
9c349a4277
Move checks for pulls before merge into own function ( #19271 )
...
This make checks in one single place so they dont differ and maintainer can not forget a check in one place while adding it to the other .... ( as it's atm )
Fix:
* The API does ignore issue dependencies where Web does not
* The API checks if "IsSignedIfRequired" where Web does not - UI probably do but nothing will some to craft custom requests
* Default merge message is crafted a bit different between API and Web if not set on specific cases ...
3 years ago
a1012112796
637c3ec5d8
Don't delete branch if other PRs with this branch are open ( #18164 )
...
fix #18149
Signed-off-by: a1012112796 <1012112796@qq.com>
3 years ago
Lunny Xiao
719bddcd76
Move repository model into models/repo ( #17933 )
...
* Some refactors related repository model
* Move more methods out of repository
* Move repository into models/repo
* Fix test
* Fix test
* some improvements
* Remove unnecessary function
3 years ago
Lunny Xiao
a666829a37
Move user related model into models/user ( #17781 )
...
* Move user related model into models/user
* Fix lint for windows
* Fix windows lint
* Fix windows lint
* Move some tests in models
* Merge
3 years ago
wxiaoguang
750a8465f5
A better go code formatter, and now `make fmt` can run in Windows ( #17684 )
...
* go build / format tools
* re-format imports
3 years ago
wxiaoguang
81926d61db
Decouple unit test, remove intermediate `unittestbridge` package ( #17662 )
...
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
3 years ago
wxiaoguang
df64fa4865
Decouple unit test code from business code ( #17623 )
3 years ago
Lunny Xiao
99b2858e62
Move unit into models/unit/ ( #17576 )
...
* Move unit into models/unit/
* Rename unit.UnitType as unit.Type
3 years ago
pricly-yellow
20eaca6d05
Fix stange behavior of DownloadPullDiffOrPatch in incorect index ( #17223 )
...
Fix GetPullRequestByIndex by validate index > 1
Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de>
Co-authored-by: a1012112796 <1012112796@qq.com>
3 years ago
Lunny Xiao
5842a55b31
Move login related structs and functions to models/login ( #17093 )
...
* Move login related structs and functions to models/login
* Fix test
* Fix lint
* Fix lint
* Fix lint of windows
* Fix lint
* Fix test
* Fix test
* Only load necessary fixtures when preparing unit tests envs
* Fix lint
* Fix test
* Fix test
* Fix error log
* Fix error log
* Fix error log
* remove unnecessary change
* fix error log
* merge main branch
3 years ago
Lunny Xiao
a4bfef265d
Move db related basic functions to models/db ( #17075 )
...
* Move db related basic functions to models/db
* Fix lint
* Fix lint
* Fix test
* Fix lint
* Fix lint
* revert unnecessary change
* Fix test
* Fix wrong replace string
* Use *Context
* Correct committer spelling and fix wrong replaced words
Co-authored-by: zeripath <art27@cantab.net>
3 years ago
a1012112796
3705168837
Add agit flow support in gitea ( #14295 )
...
* 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>
3 years ago
Steven
864e656d81
Display conflict-free merge messages for pull requests ( #15773 )
...
Repositories using external issue tracker tend to use numeric issues in
commits. To prevent conflicts during issue reference parsing or inside
commit hooks, this change respects these configuration and uses the !
character to refer to pull requests in merge commit messages.
For repositories using squash merges, this was already handled.
Signed-off-by: JustusBunsi <61625851+justusbunsi@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
4 years ago
Lunny Xiao
5abe1c52de
Display pull request head branch even the branch deleted or repository 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>
5 years ago
SpaWn2KiLl
1f01f53c53
API add/generalize pagination ( #9452 )
...
* paginate results
* fixed deadlock
* prevented breaking change
* updated swagger
* go fmt
* fixed find topic
* go mod tidy
* go mod vendor with go1.13.5
* fixed repo find topics
* fixed unit test
* added Limit method to Engine struct; use engine variable when provided; fixed gitignore
* use ItemsPerPage for default pagesize; fix GetWatchers, getOrgUsersByOrgID and GetStargazers; fix GetAllCommits headers; reverted some changed behaviors
* set Page value on Home route
* improved memory allocations
* fixed response headers
* removed logfiles
* fixed import order
* import order
* improved swagger
* added function to get models.ListOptions from context
* removed pagesize diff on unit test
* fixed imports
* removed unnecessary struct field
* fixed go fmt
* scoped PR
* code improvements
* code improvements
* go mod tidy
* fixed import order
* fixed commit statuses session
* fixed files headers
* fixed headers; added pagination for notifications
* go mod tidy
* go fmt
* removed Private from user search options; added setting.UI.IssuePagingNum as default valeu on repo's issues list
* Apply suggestions from code review
Co-Authored-By: 6543 <6543@obermui.de>
Co-Authored-By: zeripath <art27@cantab.net>
* fixed build error
* CI.restart()
* fixed merge conflicts resolve
* fixed conflicts resolve
* improved FindTrackedTimesOptions.ToOptions() method
* added backwards compatibility on ListReleases request; fixed issue tracked time ToSession
* fixed build error; fixed swagger template
* fixed swagger template
* fixed ListReleases backwards compatibility
* added page to user search route
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
5 years ago
6543
36943e56d6
Add "Update Branch" button to Pull Requests ( #9784 )
...
* add Divergence
* add Update Button
* first working version
* re-use code
* split raw merge commands and db-change functions (notify, cache, ...)
* use rawMerge (remove redundant code)
* own function to get Diverging of PRs
* use FlashError
* correct Error Msg
* hook is triggerd ... so remove comment
* add "branch2" to "user2/repo1" because it unit-test "TestPullView_ReviewerMissed" use it but dont exist jet :/
* move GetPerm to IsUserAllowedToUpdate
* add Flash Success MSG
* imprufe code
- remove useless js chage
* fix-lint
* TEST: add PullRequest ID:5
Repo: user2/repo1
Base: branch1
Head: pr-to-update
* correct comments
* make PR5 outdated
* fix Tests
* WIP: add pull update test
* update revs
* update locales
* working TEST
* update UI
* misspell
* change style
* add 1s delay so rev exist
* move row up (before merge row)
* fix lint nit
* UI remove divider
* Update style
* nits
* do it right
* introduce IsSameRepo
* remove useless check
Co-authored-by: Lauris BH <lauris@nix.lv>
5 years ago
Lunny Xiao
384c2b342e
Move pull request api convert to convert package ( #9664 )
...
* Move pull request api convert to convert package
* Rename ToPullRequest to ToAPIPullRequest
5 years ago
Lunny Xiao
8878cfa4a1
Fix lint ( #9688 )
5 years ago
Lunny Xiao
ce2d488c94
Move PushToBaseRepo from models to services/pull ( #9352 )
5 years ago
zeripath
74179d1b5e
Remove SavePatch and generate patches on the fly ( #9302 )
...
* Save patches to temporary files
* Remove SavePatch and generate patches on the fly
* Use ioutil.TempDir
* fixup! Use ioutil.TempDir
* fixup! fixup! Use ioutil.TempDir
* RemoveAll LocalCopyPath() in initIntergrationTest
* Default to status checking on PR creation
* Remove unnecessary set to StatusChecking
* Protect against unable to load repo
* Handle conflicts
* Restore original conflict setting
* In TestPullRequests update status to StatusChecking before running TestPatch
5 years ago
Lunny Xiao
82e0383d21
Move some pull request functions from models to services ( #9266 )
...
* Move some pull request functions from models to services
* Fix test
5 years ago
Lunny Xiao
945f121262
Fix bug on pull requests when transfer head repository ( #8564 )
...
* fix bug on pull requests when transfer head repository
* add migration and fix lint
* fix tests and add a cache check on LoadBaseRepo
5 years ago
quantonganh
ff85a6331e
only return head: null if source branch was deleted ( #6705 )
...
* only return head: null if source branch was deleted
* add URL into GetPullRequest
* TestPullRequest_APIFormat
* log error if it is not Err(Branch)NotExist
6 years ago
kolaente
f9ec2f89f2
Add golangci ( #6418 )
6 years ago
Julien Tant
7781e8cef2
Disable merging a WIP Pull request ( #4529 )
...
* prevent pull request to be merged when PR is a WIP
* add tests
* add helper to prepend WIP: in PR title
* move default wip prefixes into settings
* use configurable WIP prefixes in javascript and default to first one in templates
* add documentation
* add unit test on pull model
Signed-off-by: Julien Tant <julien@craftyx.fr>
6 years ago
Ethan Koenig
b496e3e1cc
Fix unit test race condition ( #2516 )
7 years ago
Morlinest
8e61823ec4
Fix tests code to prevent some runtime errors ( #2381 )
...
* Fix tests code to prevent some runtime errors
* Reduce nesting
7 years ago
Ethan Koenig
ceae143e78
Consistency checks for unit tests ( #853 )
8 years ago
Lunny Xiao
bb5a6b7a07
fix xorm NewSession uncorrected usages ( #774 )
8 years ago
Ethan Koenig
8093b3372e
Less boilerplate in models/ unit tests ( #725 )
8 years ago
Ethan Koenig
973282dae2
Better coverage in pull_test ( #615 )
8 years ago
Ethan Koenig
72bfabfada
Unit tests for models/pull.go
8 years ago