Changeset - 381eea235ae7
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-10-15 22:49:59
marcin@python-works.com
fix unicode issues on cleanup-repos script
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/cleanup.py
Show inline comments
 
@@ -22,25 +22,25 @@
 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
from __future__ import with_statement
 

	
 
import os
 
import sys
 
import re
 
import shutil
 
import logging
 
import datetime
 

	
 
from os.path import dirname as dn, join as jn
 
from rhodecode.model import init_model
 
from rhodecode.lib.utils2 import engine_from_config
 
from rhodecode.lib.utils2 import engine_from_config, safe_str
 
from rhodecode.model.db import RhodeCodeUi
 

	
 

	
 
#to get the rhodecode import
 
sys.path.append(dn(dn(dn(os.path.realpath(__file__)))))
 

	
 
from rhodecode.lib.utils import BasePasterCommand, Command, ask_ok,\
 
    REMOVED_REPO_PAT, add_cache
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
@@ -105,26 +105,26 @@ class CleanupCommand(BasePasterCommand):
 

	
 
            to_remove = to_remove_filtered
 
            print >> sys.stdout, 'removing [%s] deleted repos older than %s[%s]' \
 
                % (len(to_remove), older_than, older_than_date)
 
        else:
 
            print >> sys.stdout, 'removing all [%s] deleted repos' \
 
                % len(to_remove)
 
        if self.options.dont_ask or not to_remove:
 
            # don't ask just remove !
 
            remove = True
 
        else:
 
            remove = ask_ok('are you sure to remove listed repos \n%s [y/n]?'
 
                            % ', \n'.join(['%s removed on %s' % (x[0], x[1])
 
                                           for x in to_remove]))
 
                            % ', \n'.join(['%s removed on %s'
 
                    % (safe_str(x[0]), safe_str(x[1])) for x in to_remove]))
 

	
 
        if remove:
 
            for name, date_ in to_remove:
 
                print >> sys.stdout, 'removing repository %s' % name
 
                shutil.rmtree(os.path.join(repos_location, name))
 
        else:
 
            print 'nothing done exiting...'
 
            sys.exit(0)
 

	
 
    def update_parser(self):
 
        self.parser.add_option('--older-than',
 
                          action='store',
0 comments (0 inline, 0 general)