Mercurial > kallithea
comparison rhodecode/lib/paster_commands/cleanup.py @ 3594:381c1466141d beta
paster cleanup: improve texts
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 25 Mar 2013 16:30:38 +0100 |
parents | 4b84f435594b |
children | 3563bb7b4b82 4839bc1d89fa |
comparison
equal
deleted
inserted
replaced
3593:716ac7659b90 | 3594:381c1466141d |
---|---|
107 repo_age = now - date_ | 107 repo_age = now - date_ |
108 if repo_age > older_than_date: | 108 if repo_age > older_than_date: |
109 to_remove_filtered.append([name, date_]) | 109 to_remove_filtered.append([name, date_]) |
110 | 110 |
111 to_remove = to_remove_filtered | 111 to_remove = to_remove_filtered |
112 print >> sys.stdout, 'removing [%s] deleted repos older than %s[%s]' \ | 112 print >> sys.stdout, 'removing %s deleted repos older than %s (%s)' \ |
113 % (len(to_remove), older_than, older_than_date) | 113 % (len(to_remove), older_than, older_than_date) |
114 else: | 114 else: |
115 print >> sys.stdout, 'removing all [%s] deleted repos' \ | 115 print >> sys.stdout, 'removing all [%s] deleted repos' \ |
116 % len(to_remove) | 116 % len(to_remove) |
117 if self.options.dont_ask or not to_remove: | 117 if self.options.dont_ask or not to_remove: |
118 # don't ask just remove ! | 118 # don't ask just remove ! |
119 remove = True | 119 remove = True |
120 else: | 120 else: |
121 remove = ask_ok('are you sure to remove listed repos \n%s [y/n]?' | 121 remove = ask_ok('the following repositories will be deleted completely:\n%s\n' |
122 'are you sure you want to remove them [y/n]?' | |
122 % ', \n'.join(['%s removed on %s' | 123 % ', \n'.join(['%s removed on %s' |
123 % (safe_str(x[0]), safe_str(x[1])) for x in to_remove])) | 124 % (safe_str(x[0]), safe_str(x[1])) for x in to_remove])) |
124 | 125 |
125 if remove: | 126 if remove: |
126 for path, date_ in to_remove: | 127 for path, date_ in to_remove: |
134 self.parser.add_option( | 135 self.parser.add_option( |
135 '--older-than', | 136 '--older-than', |
136 action='store', | 137 action='store', |
137 dest='older_than', | 138 dest='older_than', |
138 help=("only remove repos that have been removed " | 139 help=("only remove repos that have been removed " |
139 "at least given time ago " | 140 "at least given time ago. " |
140 "ex. --older-than=30d deletes repositores " | 141 "The default is to remove all removed repositories. " |
141 "removed more than 30days ago. Possible options " | 142 "Possible suffixes: " |
142 "d[ays]/h[ours]/m[inutes]/s[seconds]. OPTIONAL") | 143 "d (days), h (hours), m (minutes), s (seconds). " |
144 "For example --older-than=30d deletes repositories " | |
145 "removed more than 30 days ago.") | |
143 ) | 146 ) |
144 | 147 |
145 self.parser.add_option( | 148 self.parser.add_option( |
146 '--dont-ask', | 149 '--dont-ask', |
147 action="store_true", | 150 action="store_true", |
148 dest="dont_ask", | 151 dest="dont_ask", |
149 help="Don't ask to remove repos" | 152 help="remove repositories without asking for confirmation." |
150 ) | 153 ) |