fix repo.go

This commit is contained in:
wonderful 2021-08-05 17:20:53 +08:00
parent 757a3816f7
commit 8033fc6a45
3 changed files with 212 additions and 67 deletions

View File

@ -2119,21 +2119,21 @@ func CopyLFS(ctx DBContext, newRepo, oldRepo *Repository) error {
return nil
}
<<<<<<< HEAD
//<<<<<<< HEAD
/////////////////////////////GetWiki
func (repo *Repository) GetWikis(listOptions ListOptions) ([]*Repository, error) {
if listOptions.Page == 0 {
wikis := make([]*Repository, 0, repo.NumWikis)
return wikis, x.Find(&wikis, &Repository{WikiID: repo.ID})
}
//func (repo *Repository) GetWikis(listOptions ListOptions) ([]*Repository, error) {
// if listOptions.Page == 0 {
// wikis := make([]*Repository, 0, repo.NumWikis)
// return wikis, x.Find(&wikis, &Repository{WikiID: repo.ID})
// }
//
// sess := listOptions.getPaginatedSession()
// wikis := make([]*Repository, 0, listOptions.PageSize)
// return wikis, sess.Find(&wikis, &Repository{WikiID: repo.ID})
//}
sess := listOptions.GetPaginatedSession()
wikis := make([]*Repository, 0, listOptions.PageSize)
return wikis, sess.Find(&wikis, &Repository{WikiID: repo.ID})
}
=======
>>>>>>> 3b5dff2e2323aa944690ad52574c3e3b389689ac
//>>>>>>> 3b5dff2e2323aa944690ad52574c3e3b389689ac
// GetForks returns all the forks of the repository
func (repo *Repository) GetForks(listOptions ListOptions) ([]*Repository, error) {
@ -2142,7 +2142,7 @@ func (repo *Repository) GetForks(listOptions ListOptions) ([]*Repository, error)
return forks, x.Find(&forks, &Repository{ForkID: repo.ID})
}
sess := listOptions.GetPaginatedSession()
sess := listOptions.getPaginatedSession()
forks := make([]*Repository, 0, listOptions.PageSize)
return forks, sess.Find(&forks, &Repository{ForkID: repo.ID})
}

View File

@ -3856,6 +3856,42 @@
}
}
},
"/repos/{owner}/{repo}/hooks/hooktasks": {
"get": {
"produces": [
"application/json"
],
"tags": [
"repository"
],
"summary": "Get a hooktasks",
"operationId": "repoGetHookTasks",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Hook"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/{repo}/hooks/{id}": {
"get": {
"produces": [
@ -8847,6 +8883,167 @@
}
}
},
"/repos/{owner}/{repo}/wiki/_pages": {
"get": {
"produces": [
"application/json"
],
"summary": "Get ListWikiPages",
"operationId": "wikipages",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Wiki/_page"
}
}
}
},
"/repos/{owner}/{repo}/wiki/content/{pagename}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"wikiName"
],
"summary": "Get NameWiki Content",
"operationId": "Content",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the wikipage",
"name": "pagename",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Wiki/content/wikipage"
}
}
}
},
"/repos/{owner}/{repo}/wiki/{pagename}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Create",
"a",
"new"
],
"summary": "wiki Content",
"operationId": "Wikipage",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "path of the dir, file, symlink or submodule in the repo",
"name": "pagename",
"in": "path",
"required": true
},
{
"type": "string",
"description": "The name of the commit/branch/tag. Default the repositorys default branch (usually master)",
"name": "ref",
"in": "query"
}
],
"responses": {
"200": {
"$ref": "#/responses/ContentsResponse"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/repos/{owner}/{repo}/wiki/{pagename}/_edit": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Edit"
],
"summary": "new wiki",
"operationId": "wikipage",
"parameters": [
{
"type": "string",
"description": "owner of the repo",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the wiki",
"name": "pagename",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"$ref": "#/responses/Wiki/pagename/_edit"
}
}
}
},
"/repositories/{id}": {
"get": {
"produces": [
@ -13371,10 +13568,6 @@
},
"x-go-name": "Events"
},
"http_method": {
"type": "string",
"x-go-name": "HTTPMethod"
},
"id": {
"type": "integer",
"format": "int64",

52
vendor/modules.txt vendored
View File

@ -58,7 +58,6 @@ github.com/PuerkitoBio/goquery
# github.com/PuerkitoBio/purell v1.1.1
github.com/PuerkitoBio/purell
# github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
## explicit
github.com/PuerkitoBio/urlesc
# github.com/RoaringBitmap/roaring v0.4.23
## explicit
@ -101,15 +100,12 @@ github.com/andybalholm/brotli
# github.com/andybalholm/cascadia v1.1.0
github.com/andybalholm/cascadia
# github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239
## explicit
github.com/anmitsu/go-shlex
# github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
github.com/asaskevich/govalidator
# github.com/aymerick/douceur v0.2.0
## explicit
github.com/aymerick/douceur/css
# github.com/beorn7/perks v1.0.1
## explicit
github.com/beorn7/perks/quantile
# github.com/bgentry/speakeasy v0.1.0
## explicit
@ -180,7 +176,6 @@ github.com/chris-ramon/douceur/parser
github.com/couchbase/gomemcached
github.com/couchbase/gomemcached/client
# github.com/couchbase/goutils v0.0.0-20191018232750-b49639060d85
## explicit
github.com/couchbase/goutils/logging
github.com/couchbase/goutils/scramsha
# github.com/couchbase/vellum v1.0.1
@ -199,7 +194,6 @@ github.com/couchbaselabs/go-couchbase
# github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
github.com/danwakefield/fnmatch
# github.com/davecgh/go-spew v1.1.1
## explicit
github.com/davecgh/go-spew/spew
# github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc
## explicit
@ -211,7 +205,6 @@ github.com/denisenkom/go-mssqldb/internal/querytext
## explicit
github.com/dgrijalva/jwt-go
# github.com/dlclark/regexp2 v1.2.0
## explicit
github.com/dlclark/regexp2
github.com/dlclark/regexp2/syntax
# github.com/dsnet/compress v0.0.1
@ -245,10 +238,8 @@ github.com/ethantkoenig/rupture
# github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870
## explicit
# github.com/fatih/color v1.9.0
## explicit
github.com/fatih/color
# github.com/fatih/structtag v1.2.0
## explicit
github.com/fatih/structtag
# github.com/fsnotify/fsnotify v1.4.7
github.com/fsnotify/fsnotify
@ -269,7 +260,6 @@ github.com/go-enry/go-enry/v2/regex
# github.com/go-enry/go-oniguruma v1.2.1
github.com/go-enry/go-oniguruma
# github.com/go-git/gcfg v1.5.0
## explicit
github.com/go-git/gcfg
github.com/go-git/gcfg/scanner
github.com/go-git/gcfg/token
@ -327,19 +317,12 @@ github.com/go-git/go-git/v5/utils/merkletrie/filesystem
github.com/go-git/go-git/v5/utils/merkletrie/index
github.com/go-git/go-git/v5/utils/merkletrie/internal/frame
github.com/go-git/go-git/v5/utils/merkletrie/noder
# github.com/go-macaron/gzip v0.0.0-20200329073552-98214d7a897e
## explicit
# github.com/go-macaron/toolbox v0.0.0-20200329073429-4401f4ce0f55
## explicit
# github.com/go-openapi/analysis v0.19.5
## explicit
github.com/go-openapi/analysis
github.com/go-openapi/analysis/internal
# github.com/go-openapi/errors v0.19.2
## explicit
github.com/go-openapi/errors
# github.com/go-openapi/inflect v0.19.0
## explicit
github.com/go-openapi/inflect
# github.com/go-openapi/jsonpointer v0.19.3
github.com/go-openapi/jsonpointer
@ -347,11 +330,9 @@ github.com/go-openapi/jsonpointer
## explicit
github.com/go-openapi/jsonreference
# github.com/go-openapi/loads v0.19.3
## explicit
github.com/go-openapi/loads
github.com/go-openapi/loads/fmts
# github.com/go-openapi/runtime v0.19.5
## explicit
github.com/go-openapi/runtime
github.com/go-openapi/runtime/logger
github.com/go-openapi/runtime/middleware
@ -360,16 +341,12 @@ github.com/go-openapi/runtime/middleware/header
github.com/go-openapi/runtime/middleware/untyped
github.com/go-openapi/runtime/security
# github.com/go-openapi/spec v0.19.3
## explicit
github.com/go-openapi/spec
# github.com/go-openapi/strfmt v0.19.3
## explicit
github.com/go-openapi/strfmt
# github.com/go-openapi/swag v0.19.5
## explicit
github.com/go-openapi/swag
# github.com/go-openapi/validate v0.19.3
## explicit
github.com/go-openapi/validate
# github.com/go-redis/redis v6.15.2+incompatible
## explicit
@ -384,7 +361,6 @@ github.com/go-redis/redis/internal/util
## explicit
github.com/go-sql-driver/mysql
# github.com/go-stack/stack v1.8.0
## explicit
github.com/go-stack/stack
# github.com/go-swagger/go-swagger v0.21.0
## explicit
@ -418,20 +394,17 @@ github.com/gogs/cron
# github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe
github.com/golang-sql/civil
# github.com/golang/gddo v0.0.0-20190419222130-af0f2af80721
## explicit
github.com/golang/gddo/httputil
github.com/golang/gddo/httputil/header
# github.com/golang/protobuf v1.4.1
## explicit
github.com/golang/protobuf/proto
# github.com/golang/snappy v0.0.1
## explicit
github.com/golang/snappy
# github.com/google/go-github/v32 v32.1.0
## explicit
github.com/google/go-github/v32/github
# github.com/google/go-querystring v1.0.0
## explicit
github.com/google/go-querystring/query
# github.com/google/uuid v1.1.1
## explicit
@ -440,10 +413,8 @@ github.com/google/uuid
## explicit
github.com/gorilla/context
# github.com/gorilla/css v1.0.0
## explicit
github.com/gorilla/css/scanner
# github.com/gorilla/handlers v1.4.2
## explicit
github.com/gorilla/handlers
# github.com/gorilla/mux v1.7.3
github.com/gorilla/mux
@ -483,7 +454,6 @@ github.com/jaytaylor/html2text
# github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
github.com/jbenet/go-context/io
# github.com/jessevdk/go-flags v1.4.0
## explicit
github.com/jessevdk/go-flags
# github.com/jmhodges/levigo v1.0.0
## explicit
@ -519,7 +489,6 @@ github.com/klauspost/compress/zstd/internal/xxhash
# github.com/klauspost/pgzip v1.2.1
github.com/klauspost/pgzip
# github.com/kr/pretty v0.1.0
## explicit
github.com/kr/pretty
# github.com/kr/text v0.2.0
github.com/kr/text
@ -536,10 +505,8 @@ github.com/lib/pq/scram
## explicit
github.com/lunny/dingtalk_webhook
# github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de
## explicit
github.com/lunny/log
# github.com/lunny/nodb v0.0.0-20160621015157-fc1ef06ad4af
## explicit
github.com/lunny/nodb
github.com/lunny/nodb/config
github.com/lunny/nodb/store
@ -580,7 +547,6 @@ github.com/mattn/go-runewidth
## explicit
github.com/mattn/go-sqlite3
# github.com/matttproud/golang_protobuf_extensions v1.0.1
## explicit
github.com/matttproud/golang_protobuf_extensions/pbutil
# github.com/mcuadros/go-version v0.0.0-20190308113854-92cdf37c5b75
## explicit
@ -620,7 +586,6 @@ github.com/niklasfasching/go-org/org
# github.com/nwaples/rardecode v1.0.0
github.com/nwaples/rardecode
# github.com/olekukonko/tablewriter v0.0.4
## explicit
github.com/olekukonko/tablewriter
# github.com/oliamb/cutter v0.2.2
## explicit
@ -633,17 +598,14 @@ github.com/olivere/elastic/v7/uritemplates
# github.com/pelletier/go-toml v1.4.0
github.com/pelletier/go-toml
# github.com/philhofer/fwd v1.0.0
## explicit
github.com/philhofer/fwd
# github.com/pierrec/lz4 v2.0.5+incompatible
## explicit
github.com/pierrec/lz4
github.com/pierrec/lz4/internal/xxh32
# github.com/pkg/errors v0.9.1
## explicit
github.com/pkg/errors
# github.com/pmezard/go-difflib v1.0.0
## explicit
github.com/pmezard/go-difflib/difflib
# github.com/pquerna/otp v1.2.0
## explicit
@ -659,7 +621,6 @@ github.com/prometheus/client_golang/prometheus/promhttp
## explicit
github.com/prometheus/client_model/go
# github.com/prometheus/common v0.6.0
## explicit
github.com/prometheus/common/expfmt
github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg
github.com/prometheus/common/model
@ -684,8 +645,9 @@ github.com/shurcooL/httpfs/vfsutil
## explicit
github.com/shurcooL/vfsgen
# github.com/siddontang/go-snappy v0.0.0-20140704025258-d8f7bb82a96d
## explicit
github.com/siddontang/go-snappy/snappy
# github.com/smartystreets/goconvey v1.6.4
## explicit
# github.com/spf13/afero v1.2.2
github.com/spf13/afero
github.com/spf13/afero/mem
@ -696,7 +658,6 @@ github.com/spf13/jwalterweatherman
# github.com/spf13/pflag v1.0.5
github.com/spf13/pflag
# github.com/spf13/viper v1.4.0
## explicit
github.com/spf13/viper
# github.com/steveyen/gtreap v0.1.0
github.com/steveyen/gtreap
@ -705,7 +666,6 @@ github.com/steveyen/gtreap
github.com/stretchr/testify/assert
github.com/stretchr/testify/require
# github.com/syndtr/goleveldb v1.0.0
## explicit
github.com/syndtr/goleveldb/leveldb
github.com/syndtr/goleveldb/leveldb/cache
github.com/syndtr/goleveldb/leveldb/comparer
@ -724,7 +684,6 @@ github.com/syndtr/goleveldb/leveldb/util
## explicit
github.com/tinylib/msgp/msgp
# github.com/toqueteos/webbrowser v1.2.0
## explicit
github.com/toqueteos/webbrowser
# github.com/tstranex/u2f v1.0.0
## explicit
@ -778,7 +737,6 @@ github.com/yuin/goldmark-meta
# go.etcd.io/bbolt v1.3.4
go.etcd.io/bbolt
# go.mongodb.org/mongo-driver v1.1.1
## explicit
go.mongodb.org/mongo-driver/bson
go.mongodb.org/mongo-driver/bson/bsoncodec
go.mongodb.org/mongo-driver/bson/bsonrw
@ -814,7 +772,6 @@ golang.org/x/crypto/ssh/agent
golang.org/x/crypto/ssh/internal/bcrypt_pbkdf
golang.org/x/crypto/ssh/knownhosts
# golang.org/x/mod v0.2.0
## explicit
golang.org/x/mod/module
golang.org/x/mod/semver
# golang.org/x/net v0.0.0-20200602114024-627f9648deb9
@ -891,7 +848,6 @@ golang.org/x/tools/internal/gopathwalk
golang.org/x/tools/internal/imports
golang.org/x/tools/internal/packagesinternal
# golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
## explicit
golang.org/x/xerrors
golang.org/x/xerrors/internal
# google.golang.org/appengine v1.6.5
@ -907,7 +863,6 @@ google.golang.org/appengine/internal/remote_api
google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/urlfetch
# google.golang.org/protobuf v1.22.0
## explicit
google.golang.org/protobuf/encoding/prototext
google.golang.org/protobuf/encoding/protowire
google.golang.org/protobuf/internal/descfmt
@ -950,10 +905,7 @@ gopkg.in/ini.v1
# gopkg.in/ldap.v3 v3.0.2
## explicit
gopkg.in/ldap.v3
# gopkg.in/macaron.v1 v1.4.0
## explicit
# gopkg.in/warnings.v0 v0.1.2
## explicit
gopkg.in/warnings.v0
# gopkg.in/yaml.v2 v2.3.0
## explicit