Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

repowidget: implement purge operation

Changeset 7da390e7c50e

Parent ad8b4d4cc96e

by Steve Borho

Changes to one file · Browse files at 7da390e7c50e Showing diff from parent ad8b4d4cc96e Diff from another changeset...

 
11
12
13
14
 
15
16
17
 
18
19
20
 
183
184
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
187
188
 
 
 
 
 
189
190
191
 
11
12
13
 
14
15
16
17
18
19
20
21
 
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
 
 
227
228
229
230
231
232
233
234
@@ -11,10 +11,11 @@
 import binascii  import os   -from tortoisehg.util import thgrepo, shlib, hglib +from tortoisehg.util import thgrepo, shlib, hglib, purge    from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt.qtlib import geticon, getfont, QuestionMsgBox, InfoMsgBox +from tortoisehg.hgqt.qtlib import CustomPrompt  from tortoisehg.hgqt.repomodel import HgRepoListModel  from tortoisehg.hgqt import cmdui, update, tag, backout, merge  from tortoisehg.hgqt import archive, thgstrip, run @@ -183,9 +184,51 @@
  self.reload()   QTimer.singleShot(500, lambda: shlib.shell_notify([self.repo.root]))   + def purge(self): + try: + wctx = self.repo[None] + wctx.status(ignored=True, unknown=True) + except Exception, e: + InfoMsgBox(_('Repository Error'), + _('Unable to query unrevisioned files\n') + + hglib.tounicode(e)) + return + U, I = wctx.unknown(), wctx.ignored() + if not U and not I: + InfoMsgBox(_('No unrevisioned files'), + _('There are no purgable unrevisioned files')) + return + elif not U: + if not QuestionMsgBox(_('Purge ignored files'), + _('Purge (delete) all %d ignored files?') % len(I)): + return + dels = I + else: + res = CustomPrompt(_('Purge unrevisioned files'), + _('%d unknown files\n' + '%d files ignored by .hgignore filter\n' + 'Purge unknown, ignored, or both?') % (len(U), len(I)), self, + (_('&Unknown'), _('&Ignored'), _('&Both'), _('&Cancel')), + 0, 3, U+I).run() + if res == 3: + return + elif res == 2: + dels = U+I + elif res == 1: + dels = I + else: + dels = U + res = CustomPrompt(_('Confirm file deletions'), + _('Are you sure you want to delete these %d files?') % + len(dels), self, (_('&Yes'), _('&No')), 1, 1, dels).run() + if res == 1: + return   - def purge(self): - pass + failures = purge.purge(self.repo, dels) + if failures: + CustomPrompt(_('Deletion failures'), + _('Unable to delete %d files or folders') % + len(failures), self, (_('&Ok'),), 0, 0, failures).run()     def setMode(self, mode):   self.revDetailsWidget.setMode(mode)