@@ -50,6 +50,7 @@ func discardLocalRepoBranchChanges(localPath, branch string) error {
50
50
return nil
51
51
}
52
52
53
+ // DiscardLocalRepoBranchChanges discards the local repository branch changes
53
54
func (repo * Repository ) DiscardLocalRepoBranchChanges (branch string ) error {
54
55
return discardLocalRepoBranchChanges (repo .LocalCopyPath (), branch )
55
56
}
@@ -66,10 +67,12 @@ func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error {
66
67
return nil
67
68
}
68
69
70
+ // CheckoutNewBranch checks out a new branch
69
71
func (repo * Repository ) CheckoutNewBranch (oldBranch , newBranch string ) error {
70
72
return checkoutNewBranch (repo .RepoPath (), repo .LocalCopyPath (), oldBranch , newBranch )
71
73
}
72
74
75
+ // UpdateRepoFileOptions holds the repository file update options
73
76
type UpdateRepoFileOptions struct {
74
77
LastCommitID string
75
78
OldBranch string
@@ -223,6 +226,7 @@ func (repo *Repository) GetDiffPreview(branch, treePath, content string) (diff *
223
226
// \/ \/ \/ \/ \/ \/
224
227
//
225
228
229
+ // DeleteRepoFileOptions holds the repository delete file options
226
230
type DeleteRepoFileOptions struct {
227
231
LastCommitID string
228
232
OldBranch string
@@ -231,6 +235,7 @@ type DeleteRepoFileOptions struct {
231
235
Message string
232
236
}
233
237
238
+ // DeleteRepoFile deletes a repository file
234
239
func (repo * Repository ) DeleteRepoFile (doer * User , opts DeleteRepoFileOptions ) (err error ) {
235
240
repoWorkingPool .CheckIn (com .ToStr (repo .ID ))
236
241
defer repoWorkingPool .CheckOut (com .ToStr (repo .ID ))
@@ -351,6 +356,7 @@ func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err err
351
356
return upload , nil
352
357
}
353
358
359
+ // GetUploadByUUID returns the Upload by UUID
354
360
func GetUploadByUUID (uuid string ) (* Upload , error ) {
355
361
upload := & Upload {UUID : uuid }
356
362
has , err := x .Get (upload )
@@ -362,6 +368,7 @@ func GetUploadByUUID(uuid string) (*Upload, error) {
362
368
return upload , nil
363
369
}
364
370
371
+ // GetUploadsByUUIDs returns multiple uploads by UUIDS
365
372
func GetUploadsByUUIDs (uuids []string ) ([]* Upload , error ) {
366
373
if len (uuids ) == 0 {
367
374
return []* Upload {}, nil
@@ -372,6 +379,7 @@ func GetUploadsByUUIDs(uuids []string) ([]*Upload, error) {
372
379
return uploads , x .In ("uuid" , uuids ).Find (& uploads )
373
380
}
374
381
382
+ // DeleteUploads deletes multiple uploads
375
383
func DeleteUploads (uploads ... * Upload ) (err error ) {
376
384
if len (uploads ) == 0 {
377
385
return nil
@@ -407,10 +415,12 @@ func DeleteUploads(uploads ...*Upload) (err error) {
407
415
return sess .Commit ()
408
416
}
409
417
418
+ // DeleteUpload delete a upload
410
419
func DeleteUpload (u * Upload ) error {
411
420
return DeleteUploads (u )
412
421
}
413
422
423
+ // DeleteUploadByUUID deletes a upload by UUID
414
424
func DeleteUploadByUUID (uuid string ) error {
415
425
upload , err := GetUploadByUUID (uuid )
416
426
if err != nil {
@@ -427,6 +437,7 @@ func DeleteUploadByUUID(uuid string) error {
427
437
return nil
428
438
}
429
439
440
+ // UploadRepoFileOptions contains the uploaded repository file options
430
441
type UploadRepoFileOptions struct {
431
442
LastCommitID string
432
443
OldBranch string
@@ -436,6 +447,7 @@ type UploadRepoFileOptions struct {
436
447
Files []string // In UUID format.
437
448
}
438
449
450
+ // UploadRepoFiles uploads files to a repository
439
451
func (repo * Repository ) UploadRepoFiles (doer * User , opts UploadRepoFileOptions ) (err error ) {
440
452
if len (opts .Files ) == 0 {
441
453
return nil
0 commit comments