Commits

Steve Borho  committed 8fac583

quickop: add ability to delete unversioned files (fixes #269)

  • Participants
  • Parent commits 9153ea5
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/quickop.py

 import os
 import sys
 
+from mercurial import util
+
+from tortoisehg.util import hglib, shlib
+from tortoisehg.hgqt.i18n import _
+from tortoisehg.hgqt import qtlib, status, cmdui
+
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
 
-from tortoisehg.hgqt.i18n import _
-from tortoisehg.util import hglib, shlib
-
-from tortoisehg.hgqt import qtlib, status, cmdui
-
 LABELS = { 'add': (_('Checkmark files to add'), _('Add')),
            'forget': (_('Checkmark files to forget'), _('Forget')),
            'revert': (_('Checkmark files to revert'), _('Revert')),
         if hasattr(self, 'chk') and self.chk.isChecked():
             cmdline.append('--no-backup')
         files = self.stwidget.getChecked()
-        if files:
-            cmdline.extend(files)
-        else:
+        if not files:
             qtlib.WarningMsgBox(_('No files selected'),
                                 _('No operation to perform'),
                                 parent=self)
             return
-        self.files = files
-        self.cmd.run(cmdline)
+        if self.command == 'remove':
+            wctx = self.repo[None]
+            for wfile in files:
+                if wfile not in wctx:
+                    try:
+                        util.unlink(wfile)
+                    except EnvironmentError:
+                        pass
+                    files.remove(wfile)
+        if files:
+            cmdline.extend(files)
+            self.files = files
+            self.cmd.run(cmdline)
+        else:
+            self.reject()
 
     def reject(self):
         if self.cmd.core.running():