From 751bbee53439ec2f6d6c05de8ee68060c97af129 Mon Sep 17 00:00:00 2001 From: Konrad Langenberg Date: Mon, 30 Oct 2017 21:26:38 +0100 Subject: [PATCH] Merge branch 'master' of https://github.com/go-gitea/gitea Signed-off-by: Konrad # Conflicts: # models/migrations/migrations.go # models/migrations/v46.go # models/repo.go # public/js/index.js --- models/migrations/v49.go | 33 +++++++++++++++++++++++++++++++++ models/repo.go | 34 ---------------------------------- 2 files changed, 33 insertions(+), 34 deletions(-) diff --git a/models/migrations/v49.go b/models/migrations/v49.go index a6ea3eef7..21ed4760b 100644 --- a/models/migrations/v49.go +++ b/models/migrations/v49.go @@ -1 +1,34 @@ +// Copyright 2017 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package migrations + +import ( + "fmt" + + "github.com/go-xorm/xorm" + "time" +) + +func addIssueDependencyTables(x *xorm.Engine) (err error) { + + type IssueDependency struct { + ID int64 `xorm:"pk autoincr"` + UserID int64 `xorm:"UNIQUE(watch) NOT NULL"` + IssueID int64 `xorm:"UNIQUE(watch) NOT NULL"` + DependencyID int64 `xorm:"UNIQUE(watch) NOT NULL"` + Created time.Time `xorm:"-"` + CreatedUnix int64 `xorm:"INDEX created"` + Updated time.Time `xorm:"-"` + UpdatedUnix int64 `xorm:"updated"` + } + + err = x.Sync(new(IssueDependency)) + + if err != nil { + return fmt.Errorf("Error creating issue_dependency_table column definition: %v", err) + } + + return err +} diff --git a/models/repo.go b/models/repo.go index b1477e874..3b43b7bc0 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2453,40 +2453,6 @@ func (repo *Repository) GetUserFork(userID int64) (*Repository, error) { return &forkedRepo, nil } -// __________ .__ -// \______ \____________ ____ ____ | |__ -// | | _/\_ __ \__ \ / \_/ ___\| | \ -// | | \ | | \// __ \| | \ \___| Y \ -// |______ / |__| (____ /___| /\___ >___| / -// \/ \/ \/ \/ \/ -// - -// CreateNewBranch creates a new repository branch -func (repo *Repository) CreateNewBranch(doer *User, oldBranchName, branchName string) (err error) { - repoWorkingPool.CheckIn(com.ToStr(repo.ID)) - defer repoWorkingPool.CheckOut(com.ToStr(repo.ID)) - - localPath := repo.LocalCopyPath() - - if err = discardLocalRepoBranchChanges(localPath, oldBranchName); err != nil { - return fmt.Errorf("discardLocalRepoChanges: %v", err) - } else if err = repo.UpdateLocalCopyBranch(oldBranchName); err != nil { - return fmt.Errorf("UpdateLocalCopyBranch: %v", err) - } - - if err = repo.CheckoutNewBranch(oldBranchName, branchName); err != nil { - return fmt.Errorf("CreateNewBranch: %v", err) - } - - if err = git.Push(localPath, git.PushOptions{ - Remote: "origin", - Branch: branchName, - }); err != nil { - return fmt.Errorf("Push: %v", err) - } - - return nil -} // Get Blocked By Dependencies, aka all issues this issue is blocked by. func (repo *Repository) getBlockedByDependencies(e Engine, issueID int64) (_ []*IssueDependencyIssue, err error) {