# HG changeset patch # User Marcin Kuzminski # Date 1351203235 -7200 # Node ID 08f89c688592414566b4311da195a8953a767822 # Parent 91d5f720e88fcbfbd78ca0b31d26e382eb529a4f deleting a group now does same archive operation like deleting repositories. Improve prompt that show number of repos that will be archived together with a group. diff -r 91d5f720e88f -r 08f89c688592 rhodecode/model/repos_group.py --- a/rhodecode/model/repos_group.py Thu Oct 25 23:40:16 2012 +0200 +++ b/rhodecode/model/repos_group.py Fri Oct 26 00:13:55 2012 +0200 @@ -27,6 +27,7 @@ import logging import traceback import shutil +import datetime from rhodecode.lib.utils2 import LazyProperty @@ -126,12 +127,18 @@ paths = os.sep.join(paths) rm_path = os.path.join(self.repos_path, paths) + log.info("Removing group %s" % (rm_path)) + # delete only if that path really exists if os.path.isdir(rm_path): - # delete only if that path really exists if force_delete: shutil.rmtree(rm_path) else: - os.rmdir(rm_path) # this raises an exception when there are still objects inside + #archive that group` + _now = datetime.datetime.now() + _ms = str(_now.microsecond).rjust(6, '0') + _d = 'rm__%s_GROUP_%s' % (_now.strftime('%Y%m%d_%H%M%S_' + _ms), + group.name) + shutil.move(rm_path, os.path.join(self.repos_path, _d)) def create(self, group_name, group_description, parent=None, just_db=False): try: diff -r 91d5f720e88f -r 08f89c688592 rhodecode/templates/admin/repos_groups/repos_groups_show.html --- a/rhodecode/templates/admin/repos_groups/repos_groups_show.html Thu Oct 25 23:40:16 2012 +0200 +++ b/rhodecode/templates/admin/repos_groups/repos_groups_show.html Fri Oct 26 00:13:55 2012 +0200 @@ -40,6 +40,7 @@ ## REPO GROUPS % for gr in c.groups: + <% gr_cn = gr.repositories.count() %>
@@ -48,10 +49,10 @@
${gr.group_description} - ${gr.repositories.count()} + ${gr_cn} ${h.form(url('repos_group', id=gr.group_id),method='delete')} - ${h.submit('remove_%s' % gr.name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this group: %s') % gr.name+"');")} + ${h.submit('remove_%s' % gr.name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_cn) % (gr.name,gr_cn)+"');")} ${h.end_form()}