comparison rhodecode/model/repo.py @ 668:dff6d5cb8bba beta

fixed deletion of repository on filesystem, works based on scm type for git and hg. agged 'ago' into age function some css fixes
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 07 Nov 2010 15:07:53 +0100
parents 758f64f3fbda
children cb0d9ce6ac5c
comparison
equal deleted inserted replaced
667:56a8434a88cc 668:dff6d5cb8bba
162 run_task(tasks.create_repo_fork, form_data, cur_user) 162 run_task(tasks.create_repo_fork, form_data, cur_user)
163 163
164 def delete(self, repo): 164 def delete(self, repo):
165 try: 165 try:
166 self.sa.delete(repo) 166 self.sa.delete(repo)
167 self.sa.commit() 167 self.__delete_repo(repo)
168 self.__delete_repo(repo.repo_name) 168 self.sa.commit()
169 except: 169 except:
170 log.error(traceback.format_exc()) 170 log.error(traceback.format_exc())
171 self.sa.rollback() 171 self.sa.rollback()
172 raise 172 raise
173 173
198 if os.path.isdir(new_path): 198 if os.path.isdir(new_path):
199 raise Exception('Was trying to rename to already existing dir %s', 199 raise Exception('Was trying to rename to already existing dir %s',
200 new_path) 200 new_path)
201 shutil.move(old_path, new_path) 201 shutil.move(old_path, new_path)
202 202
203 def __delete_repo(self, name): 203 def __delete_repo(self, repo):
204 rm_path = os.path.join(g.base_path, name) 204 rm_path = os.path.join(g.base_path, repo.repo_name)
205 log.info("Removing %s", rm_path) 205 log.info("Removing %s", rm_path)
206 #disable hg 206 #disable hg/git
207 shutil.move(os.path.join(rm_path, '.hg'), os.path.join(rm_path, 'rm__.hg')) 207 alias = repo.repo_type
208 shutil.move(os.path.join(rm_path, '.%s' % alias),
209 os.path.join(rm_path, 'rm__.%s' % alias))
208 #disable repo 210 #disable repo
209 shutil.move(rm_path, os.path.join(g.base_path, 'rm__%s__%s' \ 211 shutil.move(rm_path, os.path.join(g.base_path, 'rm__%s__%s' \
210 % (datetime.today(), name))) 212 % (datetime.today(), repo.repo_name)))