1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Steve Borho  committed f86033a

mq: check for rejection messages after qpush operations

We're going to have to suggest that MQ users stick to English messages if they
use the MQ widget, or somehow force English for these commands.

  • Participants
  • Parent commits b669652
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/mq.py

View file
  • Ignore whitespace
         self.qtbar.setEnabled(True)
         self.repo.decrementBusyCount()
         if self.finishfunc:
-            self.finishfunc(ret, self.cmd.core.rawoutput())
+            self.finishfunc(ret)
             self.finishfunc = None
 
+    def checkForRejects(self, ret):
+        if ret is 0:
+            self.refreshFileListWidget()
+            return
+        rejre = re.compile('saving rejects to file (.*).rej')
+        for m in rejre.finditer(self.cmd.core.rawoutput()):
+            wfile = m.groups()[0]
+            if not os.path.exists(self.repo.wjoin(wfile)):
+                continue
+            ufile = hglib.tounicode(wfile)
+            if qtlib.QuestionMsgBox(_('Manually resolve rejected chunks?'),
+                                    _('%s had rejected chunks, edit patched '
+                                      'file together with rejects?') % ufile,
+                                    parent=self):
+                dlg = rejects.RejectsDialog(self.repo.wjoin(wfile), self)
+                dlg.exec_()
+        self.refreshFileListWidget()
+
     @pyqtSlot()
     def onPushAll(self):
         if self.cmd.running():
         cmdline = ['qpush', '-R', self.repo.root, '--all']
         cmdline += self.getUserOptions('force', 'exact')
         self.qtbar.setEnabled(False)
+        self.finishfunc = self.checkForRejects
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         cmdline = ['qpush', '-R', self.repo.root]
         cmdline += self.getUserOptions('force', 'exact')
         self.qtbar.setEnabled(False)
+        self.finishfunc = self.checkForRejects
         self.cmd.run(cmdline)
 
     @pyqtSlot()
         cmdline += ['--move', '--', patch]
         self.repo.incrementBusyCount()
         self.qtbar.setEnabled(False)
+        self.finishfunc = self.checkForRejects
         self.cmd.run(cmdline)
 
     @pyqtSlot()
 
     @pyqtSlot()
     def onQNewOrQRefresh(self):
-        def finished(ret, output):
+        def finished(ret):
             self.newCheckBox.setChecked(False)
         if self.newCheckBox.isChecked():
             name = hglib.fromunicode(self.patchNameLE.text())