summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2014-07-05 10:37:29 +0800
committerLunny Xiao <xiaolunwen@gmail.com>2014-07-05 10:37:29 +0800
commitbaa255e8991edaa69c29794553dcb37ecbc6b78d (patch)
tree56070301f92a8af6c30e06d2a7b63983e962107a /models
parent3c6da63216ab509cdd2ce6cf75be4f63825c4c62 (diff)
downloadgitea-baa255e8991edaa69c29794553dcb37ecbc6b78d.tar.gz
gitea-baa255e8991edaa69c29794553dcb37ecbc6b78d.zip
remove debug info
Diffstat (limited to 'models')
-rw-r--r--models/repo.go15
1 files changed, 3 insertions, 12 deletions
diff --git a/models/repo.go b/models/repo.go
index b08711aa31..f2df050577 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -632,7 +632,6 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) (err error) {
return err
}*/
- //fmt.Println("0")
sess := x.NewSession()
defer sess.Close()
if err = sess.Begin(); err != nil {
@@ -641,16 +640,15 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) (err error) {
access := &Access{
RepoName: newUser.LowerName + "/" + repo.LowerName,
- UserName: newUser.LowerName,
}
- //fmt.Println("1")
+
sess.Where("repo_name = ?", u.LowerName+"/"+repo.LowerName)
_, err = sess.And("user_name = ?", u.LowerName).Update(&Access{UserName: newUser.LowerName})
if err != nil {
sess.Rollback()
return err
}
- //fmt.Println("2")
+
_, err = sess.Where("repo_name = ?", u.LowerName+"/"+repo.LowerName).Update(access)
if err != nil {
sess.Rollback()
@@ -668,7 +666,6 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) (err error) {
}
}*/
- //fmt.Println("3")
// Update repository.
repo.OwnerId = newUser.Id
if _, err := sess.Id(repo.Id).Update(repo); err != nil {
@@ -676,22 +673,19 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) (err error) {
return err
}
- //fmt.Println("4")
// Update user repository number.
rawSql := "UPDATE `user` SET num_repos = num_repos + 1 WHERE id = ?"
if _, err = sess.Exec(rawSql, newUser.Id); err != nil {
sess.Rollback()
return err
}
- //fmt.Println("5")
+
rawSql = "UPDATE `user` SET num_repos = num_repos - 1 WHERE id = ?"
if _, err = sess.Exec(rawSql, u.Id); err != nil {
sess.Rollback()
return err
}
- //fmt.Println("6")
-
// Add watch of new owner to repository.
if !IsWatching(newUser.Id, repo.Id) {
if err = WatchRepo(newUser.Id, repo.Id, true); err != nil {
@@ -700,20 +694,17 @@ func TransferOwnership(u *User, newOwner string, repo *Repository) (err error) {
}
}
- //fmt.Println("7")
if err = TransferRepoAction(u, newUser, repo); err != nil {
sess.Rollback()
return err
}
- //fmt.Println("8")
// Change repository directory name.
if err = os.Rename(RepoPath(u.Name, repo.Name), RepoPath(newUser.Name, repo.Name)); err != nil {
sess.Rollback()
return err
}
- //fmt.Println("9")
return sess.Commit()
}