__________ .__ \______ \____________ ____ ____ | |__ | | _/\_ __ \__ \ / \_/ ___\| | \ | | \ | | \// __ \| | \ \___| Y \ |______ / |__| (____ /___| /\___ >___| / \/ \/ \/ \/ \/
(oldBranch, newBranch string)
| 2631 | // |
| 2632 | |
| 2633 | func (r *Repository) CreateNewBranch(oldBranch, newBranch string) (err error) { |
| 2634 | repoWorkingPool.CheckIn(com.ToStr(r.ID)) |
| 2635 | defer repoWorkingPool.CheckOut(com.ToStr(r.ID)) |
| 2636 | |
| 2637 | localPath := r.LocalCopyPath() |
| 2638 | |
| 2639 | if err = discardLocalRepoBranchChanges(localPath, oldBranch); err != nil { |
| 2640 | return errors.Newf("discard changes in local copy [path: %s, branch: %s]: %v", localPath, oldBranch, err) |
| 2641 | } else if err = r.UpdateLocalCopyBranch(oldBranch); err != nil { |
| 2642 | return errors.Newf("update branch for local copy [path: %s, branch: %s]: %v", localPath, oldBranch, err) |
| 2643 | } |
| 2644 | |
| 2645 | if err = r.CheckoutNewBranch(oldBranch, newBranch); err != nil { |
| 2646 | return errors.Newf("create new branch [base: %s, new: %s]: %v", oldBranch, newBranch, err) |
| 2647 | } |
| 2648 | |
| 2649 | if err = git.Push(localPath, "origin", newBranch); err != nil { |
| 2650 | return errors.Newf("push [branch: %s]: %v", newBranch, err) |
| 2651 | } |
| 2652 | |
| 2653 | return nil |
| 2654 | } |
| 2655 | |
| 2656 | // Deprecated: Use Perms.SetRepoPerms instead. |
| 2657 | func (r *Repository) refreshAccesses(e Engine, accessMap map[int64]AccessMode) (err error) { |
nothing calls this directly
no test coverage detected