comparison rhodecode/lib/paster_commands/cleanup.py @ 3395:4b84f435594b beta

fixed cleanup command
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 21 Feb 2013 02:39:37 +0100
parents 95c38de476a7
children 381c1466141d
comparison
equal deleted inserted replaced
3394:fe2bb88bf7ac 3395:4b84f435594b
123 % (safe_str(x[0]), safe_str(x[1])) for x in to_remove])) 123 % (safe_str(x[0]), safe_str(x[1])) for x in to_remove]))
124 124
125 if remove: 125 if remove:
126 for path, date_ in to_remove: 126 for path, date_ in to_remove:
127 print >> sys.stdout, 'removing repository %s' % path 127 print >> sys.stdout, 'removing repository %s' % path
128 shutil.rmtree(path)) 128 shutil.rmtree(path)
129 else: 129 else:
130 print 'nothing done exiting...' 130 print 'nothing done exiting...'
131 sys.exit(0) 131 sys.exit(0)
132 132
133 def update_parser(self): 133 def update_parser(self):
134 self.parser.add_option('--older-than', 134 self.parser.add_option(
135 action='store', 135 '--older-than',
136 dest='older_than', 136 action='store',
137 help=( 137 dest='older_than',
138 "only remove repos that have been removed " 138 help=("only remove repos that have been removed "
139 "at least given time ago " 139 "at least given time ago "
140 "ex. --older-than=30d deletes repositores " 140 "ex. --older-than=30d deletes repositores "
141 "removed more than 30days ago. Possible options " 141 "removed more than 30days ago. Possible options "
142 "d[ays]/h[ours]/m[inutes]/s[seconds]. OPTIONAL"), 142 "d[ays]/h[ours]/m[inutes]/s[seconds]. OPTIONAL")
143 ) 143 )
144 self.parser.add_option('--dont-ask', 144
145 action='store_true', 145 self.parser.add_option(
146 dest='dont_ask', 146 '--dont-ask',
147 help=("Don't ask to remove repos")) 147 action="store_true",
148 dest="dont_ask",
149 help="Don't ask to remove repos"
150 )