Changeset - f282c81ff532
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2013-02-21 00:41:48
marcin@python-works.com
implemented #689 Deleting Repositories with Forks Should Be Easier
- optionally detach or delete forks associated to repo
2 files changed with 19 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/admin/repos.py
Show inline comments
 
@@ -286,6 +286,20 @@ class ReposController(BaseRepoController
 
            h.not_mapped_error(repo_name)
 
            return redirect(url('repos'))
 
        try:
 
            _forks = repo.forks.count()
 
            if _forks and request.POST.get('forks'):
 
                do = request.POST['forks']
 
                if do == 'detach_forks':
 
                    for r in repo.forks:
 
                        log.debug('Detaching fork %s from repo %s' % (r, repo))
 
                        r.fork = None
 
                        Session().add(r)
 
                    h.flash(_('detached %s forks') % _forks, category='success')
 
                elif do == 'delete_forks':
 
                    for r in repo.forks:
 
                        log.debug('Deleting fork %s of repo %s' % (r, repo))
 
                        repo_model.delete(r)
 
                    h.flash(_('deleted %s forks') % _forks, category='success')
 
            action_logger(self.rhodecode_user, 'admin_deleted_repo',
 
                              repo_name, self.ip_addr, self.sa)
 
            repo_model.delete(repo)
rhodecode/templates/admin/repos/repo_edit.html
Show inline comments
 
@@ -291,6 +291,11 @@
 
        <div class="form">
 
           <div class="fields">
 
               ${h.submit('remove_%s' % c.repo_info.repo_name,_('Remove this repository'),class_="ui-btn red",onclick="return confirm('"+_('Confirm to delete this repository')+"');")}
 
              %if c.repo_info.forks.count():
 
                    - ${ungettext('this repository has %s fork', 'this repository has %s forks', c.repo_info.forks.count()) % c.repo_info.forks.count()} 
 
                    <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
 
                    <input type="radio" name="forks" value="delete_forks" /> <label for="forks">${_('Delete forks')}</label>
 
              %endif               
 
           </div>
 
           <div class="field" style="border:none;color:#888">
 
           <ul>
0 comments (0 inline, 0 general)