aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/status.go
blob: b3d16e79bc4d6e53363caa82f02b3ffda5084c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
// Copyright 2017 Gitea. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package repo

import (
	"fmt"

	"code.gitea.io/gitea/models"
	"code.gitea.io/gitea/modules/context"
	"code.gitea.io/gitea/modules/repofiles"

	api "code.gitea.io/gitea/modules/structs"
)

// NewCommitStatus creates a new CommitStatus
func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
	// swagger:operation POST /repos/{owner}/{repo}/statuses/{sha} repository repoCreateStatus
	// ---
	// summary: Create a commit status
	// produces:
	// - application/json
	// parameters:
	// - name: owner
	//   in: path
	//   description: owner of the repo
	//   type: string
	//   required: true
	// - name: repo
	//   in: path
	//   description: name of the repo
	//   type: string
	//   required: true
	// - name: sha
	//   in: path
	//   description: sha of the commit
	//   type: string
	//   required: true
	// - name: body
	//   in: body
	//   schema:
	//     "$ref": "#/definitions/CreateStatusOption"
	// responses:
	//   "200":
	//     "$ref": "#/responses/StatusList"
	sha := ctx.Params("sha")
	if len(sha) == 0 {
		ctx.Error(400, "sha not given", nil)
		return
	}
	status := &models.CommitStatus{
		State:       models.CommitStatusState(form.State),
		TargetURL:   form.TargetURL,
		Description: form.Description,
		Context:     form.Context,
	}
	if err := repofiles.CreateCommitStatus(ctx.Repo.Repository, ctx.User, sha, status); err != nil {
		ctx.Error(500, "CreateCommitStatus", err)
		return
	}

	ctx.JSON(201, status.APIFormat())
}

// GetCommitStatuses returns all statuses for any given commit hash
func GetCommitStatuses(ctx *context.APIContext) {
	// swagger:operation GET /repos/{owner}/{repo}/statuses/{sha} repository repoListStatuses
	// ---
	// summary: Get a commit's statuses
	// produces:
	// - application/json
	// parameters:
	// - name: owner
	//   in: path
	//   description: owner of the repo
	//   type: string
	//   required: true
	// - name: repo
	//   in: path
	//   description: name of the repo
	//   type: string
	//   required: true
	// - name: sha
	//   in: path
	//   description: sha of the commit
	//   type: string
	//   required: true
	// - name: page
	//   in: query
	//   description: page number of results
	//   type: integer
	//   required: false
	// - name: sort
	//   in: query
	//   description: type of sort
	//   type: string
	//   enum: [oldest, recentupdate, leastupdate, leastindex, highestindex]
	//   required: false
	// - name: state
	//   in: query
	//   description: type of state
	//   type: string
	//   enum: [pending, success, error, failure, warning]
	//   required: false
	// responses:
	//   "200":
	//     "$ref": "#/responses/StatusList"
	getCommitStatuses(ctx, ctx.Params("sha"))
}

// GetCommitStatusesByRef returns all statuses for any given commit ref
func GetCommitStatusesByRef(ctx *context.APIContext) {
	// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoListStatusesByRef
	// ---
	// summary: Get a commit's statuses, by branch/tag/commit reference
	// produces:
	// - application/json
	// parameters:
	// - name: owner
	//   in: path
	//   description: owner of the repo
	//   type: string
	//   required: true
	// - name: repo
	//   in: path
	//   description: name of the repo
	//   type: string
	//   required: true
	// - name: ref
	//   in: path
	//   description: name of branch/tag/commit
	//   type: string
	//   required: true
	// - name: page
	//   in: query
	//   description: page number of results
	//   type: integer
	//   required: false
	// - name: sort
	//   in: query
	//   description: type of sort
	//   type: string
	//   enum: [oldest, recentupdate, leastupdate, leastindex, highestindex]
	//   required: false
	// - name: state
	//   in: query
	//   description: type of state
	//   type: string
	//   enum: [pending, success, error, failure, warning]
	//   required: false
	// responses:
	//   "200":
	//     "$ref": "#/responses/StatusList"

	filter := ctx.Params("ref")
	if len(filter) == 0 {
		ctx.Error(400, "ref not given", nil)
		return
	}

	for _, reftype := range []string{"heads", "tags"} { //Search branches and tags
		refSHA, lastMethodName, err := searchRefCommitByType(ctx, reftype, filter)
		if err != nil {
			ctx.Error(500, lastMethodName, err)
			return
		}
		if refSHA != "" {
			filter = refSHA
			break
		}

	}

	getCommitStatuses(ctx, filter) //By default filter is maybe the raw SHA
}

func searchRefCommitByType(ctx *context.APIContext, refType, filter string) (string, string, error) {
	refs, lastMethodName, err := getGitRefs(ctx, refType+"/"+filter) //Search by type
	if err != nil {
		return "", lastMethodName, err
	}
	if len(refs) > 0 {
		return refs[0].Object.String(), "", nil //Return found SHA
	}
	return "", "", nil
}

func getCommitStatuses(ctx *context.APIContext, sha string) {
	if len(sha) == 0 {
		ctx.Error(400, "ref/sha not given", nil)
		return
	}
	repo := ctx.Repo.Repository

	statuses, _, err := models.GetCommitStatuses(repo, sha, &models.CommitStatusOptions{
		Page:     ctx.QueryInt("page"),
		SortType: ctx.QueryTrim("sort"),
		State:    ctx.QueryTrim("state"),
	})
	if err != nil {
		ctx.Error(500, "GetCommitStatuses", fmt.Errorf("GetCommitStatuses[%s, %s, %d]: %v", repo.FullName(), sha, ctx.QueryInt("page"), err))
		return
	}

	apiStatuses := make([]*api.Status, 0, len(statuses))
	for _, status := range statuses {
		apiStatuses = append(apiStatuses, status.APIFormat())
	}

	ctx.JSON(200, apiStatuses)
}

type combinedCommitStatus struct {
	State      models.CommitStatusState `json:"state"`
	SHA        string                   `json:"sha"`
	TotalCount int                      `json:"total_count"`
	Statuses   []*api.Status            `json:"statuses"`
	Repo       *api.Repository          `json:"repository"`
	CommitURL  string                   `json:"commit_url"`
	URL        string                   `json:"url"`
}

// GetCombinedCommitStatusByRef returns the combined status for any given commit hash
func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
	// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoGetCombinedStatusByRef
	// ---
	// summary: Get a commit's combined status, by branch/tag/commit reference
	// produces:
	// - application/json
	// parameters:
	// - name: owner
	//   in: path
	//   description: owner of the repo
	//   type: string
	//   required: true
	// - name: repo
	//   in: path
	//   description: name of the repo
	//   type: string
	//   required: true
	// - name: ref
	//   in: path
	//   description: name of branch/tag/commit
	//   type: string
	//   required: true
	// - name: page
	//   in: query
	//   description: page number of results
	//   type: integer
	//   required: false
	// responses:
	//   "200":
	//     "$ref": "#/responses/Status"
	sha := ctx.Params("ref")
	if len(sha) == 0 {
		ctx.Error(400, "ref/sha not given", nil)
		return
	}
	repo := ctx.Repo.Repository

	page := ctx.QueryInt("page")

	statuses, err := models.GetLatestCommitStatus(repo, sha, page)
	if err != nil {
		ctx.Error(500, "GetLatestCommitStatus", fmt.Errorf("GetLatestCommitStatus[%s, %s, %d]: %v", repo.FullName(), sha, page, err))
		return
	}

	if len(statuses) == 0 {
		ctx.Status(200)
		return
	}

	retStatus := &combinedCommitStatus{
		SHA:        sha,
		TotalCount: len(statuses),
		Repo:       repo.APIFormat(ctx.Repo.AccessMode),
		URL:        "",
	}

	retStatus.Statuses = make([]*api.Status, 0, len(statuses))
	for _, status := range statuses {
		retStatus.Statuses = append(retStatus.Statuses, status.APIFormat())
		if status.State.IsWorseThan(retStatus.State) {
			retStatus.State = status.State
		}
	}

	ctx.JSON(200, retStatus)
}
ion value='backport/50025/stable30'>backport/50025/stable30 Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/l10n/sv/lib.po
blob: 061e3bb3895fbb5f4448926c266f99008a5ec8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# 
# Translators:
# medialabs, 2013
msgid ""
msgstr ""
"Project-Id-Version: ownCloud\n"
"Report-Msgid-Bugs-To: http://bugs.owncloud.org/\n"
"POT-Creation-Date: 2013-07-12 02:04+0200\n"
"PO-Revision-Date: 2013-07-11 23:15+0000\n"
"Last-Translator: I Robot <owncloud-bot@tmit.eu>\n"
"Language-Team: Swedish (http://www.transifex.com/projects/p/owncloud/language/sv/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: sv\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: app.php:360
msgid "Help"
msgstr "Hjälp"

#: app.php:373
msgid "Personal"
msgstr "Personligt"

#: app.php:384
msgid "Settings"
msgstr "Inställningar"

#: app.php:396
msgid "Users"
msgstr "Användare"

#: app.php:409
msgid "Apps"
msgstr "Program"

#: app.php:417
msgid "Admin"
msgstr "Admin"

#: defaults.php:33
msgid "web services under your control"
msgstr "webbtjänster under din kontroll"

#: files.php:226
msgid "ZIP download is turned off."
msgstr "Nerladdning av ZIP är avstängd."

#: files.php:227
msgid "Files need to be downloaded one by one."
msgstr "Filer laddas ner en åt gången."

#: files.php:228 files.php:261
msgid "Back to Files"
msgstr "Tillbaka till Filer"

#: files.php:258
msgid "Selected files too large to generate zip file."
msgstr "Valda filer är för stora för att skapa zip-fil."

#: helper.php:236
msgid "couldn't be determined"
msgstr "kunde inte bestämmas"

#: json.php:28
msgid "Application is not enabled"
msgstr "Applikationen är inte aktiverad"

#: json.php:39 json.php:62 json.php:73
msgid "Authentication error"
msgstr "Fel vid autentisering"

#: json.php:51
msgid "Token expired. Please reload page."
msgstr "Ogiltig token. Ladda om sidan."

#: search/provider/file.php:17 search/provider/file.php:35
msgid "Files"
msgstr "Filer"

#: search/provider/file.php:26 search/provider/file.php:33
msgid "Text"
msgstr "Text"

#: search/provider/file.php:29
msgid "Images"
msgstr "Bilder"

#: setup/abstractdatabase.php:22
#, php-format
msgid "%s enter the database username."
msgstr "%s ange databasanvändare."

#: setup/abstractdatabase.php:25
#, php-format
msgid "%s enter the database name."
msgstr "%s ange databasnamn"

#: setup/abstractdatabase.php:28
#, php-format
msgid "%s you may not use dots in the database name"
msgstr "%s du får inte använda punkter i databasnamnet"

#: setup/mssql.php:20
#, php-format
msgid "MS SQL username and/or password not valid: %s"
msgstr "MS SQL-användaren och/eller lösenordet var inte giltigt: %s"

#: setup/mssql.php:21 setup/mysql.php:13 setup/oci.php:114
#: setup/postgresql.php:24 setup/postgresql.php:70
msgid "You need to enter either an existing account or the administrator."
msgstr "Du måste antingen ange ett befintligt konto eller administratör."

#: setup/mysql.php:12
msgid "MySQL username and/or password not valid"
msgstr "MySQL-användarnamnet och/eller lösenordet är felaktigt"

#: setup/mysql.php:67 setup/oci.php:54 setup/oci.php:121 setup/oci.php:147
#: setup/oci.php:154 setup/oci.php:165 setup/oci.php:172 setup/oci.php:181
#: setup/oci.php:189 setup/oci.php:198 setup/oci.php:204
#: setup/postgresql.php:89 setup/postgresql.php:98 setup/postgresql.php:115
#: setup/postgresql.php:125 setup/postgresql.php:134
#, php-format
msgid "DB Error: \"%s\""
msgstr "DB error: \"%s\""

#: setup/mysql.php:68 setup/oci.php:55 setup/oci.php:122 setup/oci.php:148
#: setup/oci.php:155 setup/oci.php:166 setup/oci.php:182 setup/oci.php:190
#: setup/oci.php:199 setup/postgresql.php:90 setup/postgresql.php:99
#: setup/postgresql.php:116 setup/postgresql.php:126 setup/postgresql.php:135
#, php-format
msgid "Offending command was: \"%s\""
msgstr "Det felaktiga kommandot var: \"%s\""

#: setup/mysql.php:85
#, php-format
msgid "MySQL user '%s'@'localhost' exists already."
msgstr "MySQL-användaren '%s'@'localhost' existerar redan."

#: setup/mysql.php:86
msgid "Drop this user from MySQL"
msgstr "Radera denna användare från MySQL"

#: setup/mysql.php:91
#, php-format
msgid "MySQL user '%s'@'%%' already exists"
msgstr "MySQl-användare '%s'@'%%' existerar redan"

#: setup/mysql.php:92
msgid "Drop this user from MySQL."
msgstr "Radera denna användare från MySQL."

#: setup/oci.php:34
msgid "Oracle connection could not be established"
msgstr "Oracle-anslutning kunde inte etableras"

#: setup/oci.php:41 setup/oci.php:113
msgid "Oracle username and/or password not valid"
msgstr "Oracle-användarnamnet och/eller lösenordet är felaktigt"

#: setup/oci.php:173 setup/oci.php:205
#, php-format
msgid "Offending command was: \"%s\", name: %s, password: %s"
msgstr "Det felande kommandot var: \"%s\", name: %s, password: %s"

#: setup/postgresql.php:23 setup/postgresql.php:69
msgid "PostgreSQL username and/or password not valid"
msgstr "PostgreSQL-användarnamnet och/eller lösenordet är felaktigt"

#: setup.php:42
msgid "Set an admin username."
msgstr "Ange ett användarnamn för administratören."

#: setup.php:45
msgid "Set an admin password."
msgstr "Ange ett administratörslösenord."

#: setup.php:198
msgid ""
"Your web server is not yet properly setup to allow files synchronization "
"because the WebDAV interface seems to be broken."
msgstr "Din webbserver är inte korrekt konfigurerad för att tillåta filsynkronisering eftersom WebDAV inte verkar fungera."

#: setup.php:199
#, php-format
msgid "Please double check the <a href='%s'>installation guides</a>."
msgstr "Var god kontrollera <a href='%s'>installationsguiden</a>."

#: template.php:113
msgid "seconds ago"
msgstr "sekunder sedan"

#: template.php:114
msgid "1 minute ago"
msgstr "1 minut sedan"

#: template.php:115
#, php-format
msgid "%d minutes ago"
msgstr "%d minuter sedan"

#: template.php:116
msgid "1 hour ago"
msgstr "1 timme sedan"

#: template.php:117
#, php-format
msgid "%d hours ago"
msgstr "%d timmar sedan"

#: template.php:118
msgid "today"
msgstr "i dag"

#: template.php:119
msgid "yesterday"
msgstr "i går"

#: template.php:120
#, php-format
msgid "%d days ago"
msgstr "%d dagar sedan"

#: template.php:121
msgid "last month"
msgstr "förra månaden"

#: template.php:122
#, php-format
msgid "%d months ago"
msgstr "%d månader sedan"

#: template.php:123
msgid "last year"
msgstr "förra året"

#: template.php:124
msgid "years ago"
msgstr "år sedan"

#: vcategories.php:188 vcategories.php:249
#, php-format
msgid "Could not find category \"%s\""
msgstr "Kunde inte hitta kategorin \"%s\""