Project can be transfered to namespace and out now

This commit is contained in:
Dmitriy Zaporozhets 2012-11-24 12:37:30 +02:00
parent d405c8fc60
commit f997947664
3 changed files with 16 additions and 13 deletions

View file

@ -226,4 +226,18 @@ class Project < ActiveRecord::Base
def code
path
end
def transfer(new_namespace)
Project.transaction do
old_namespace = namespace
self.namespace = new_namespace
old_dir = old_namespace.try(:path) || ''
new_dir = new_namespace.try(:path) || ''
Gitlab::ProjectMover.new(self, old_dir, new_dir).execute
save!
end
end
end