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

nerge: use shelve tool to move working directory changes to a patch

When the merge wizard is launched from the Workbench, the shelve tool is opened
behind the merge wizard and I cannot figure out how to fix this. In general Qt
does not want to open a QMainWindow from a modal dialog. I'm having to do some
ugly hacks to get it to work this much. This needs to be re-thought.

Changeset 51c2cb07ac33

Parent 39794bda889a

by Steve Borho

Changes to one file · Browse files at 51c2cb07ac33 Showing diff from parent 39794bda889a Diff from another changeset...

 
288
289
290
291
292
293
294
295
 
 
 
296
297
298
 
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
422
423
 
288
289
290
 
 
 
 
 
291
292
293
294
295
296
 
398
399
400
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
@@ -288,11 +288,9 @@
  self.groups.add(wd_merged, 'merged')   box.addWidget(wd_merged)   - text = _('Before merging, you must ' - '<a href="commit"><b>commit</b></a>, ') - if 'mq' in repo.extensions(): - text = text + _('<a href="mq"><b>save</b></a> to MQ patch, ') - text = text + ('or <a href="discard"><b>discard</b></a> changes.') + text = _('Before merging, you must <a href="commit"><b>commit</b></a>,' + ' <a href="shelve"><b>shelve</b></a> to patch,' + ' or <a href="discard"><b>discard</b></a> changes.')   wd_text = QLabel(text)   wd_text.setContentsMargins(*MARGINS)   wd_text.linkActivated.connect(self.link_activated) @@ -400,24 +398,21 @@
  dlg.finished.connect(dlg.deleteLater)   dlg.exec_()   self.check_status() - elif cmd == 'mq': - # TODO: need to check existing patches - patch = 'patch1' - def finished(ret): - repo.decrementBusyCount() - if ret == 0: - def callback(): - text = _('Outstanding changes are saved to <b>' - '%(name)s</b> in the patch queue. <a href' - '="rename:%(name)s"><b>Rename</b></a> it?') - self.wd_text.setText(text % dict(name=patch)) - self.wd_text.setShown(True) - self.check_status(callback) - self.runner = cmdui.Runner(_('MQ - TortoiseHg'), True, self) - self.runner.commandFinished.connect(finished) - repo.incrementBusyCount() - self.runner.run(['qnew', '--repository', repo.root, patch], - ['qpop', '--repository', repo.root, '--all']) + elif cmd == 'shelve': + def finished(): + self.wizard().setWindowModality(Qt.ApplicationModal) + self.wizard().setEnabled(True) + self.shelvedlg.setWindowModality(Qt.NonModal) + self.shelvedlg.hide() + self.check_status() + self.wizard().setWindowModality(Qt.NonModal) + self.wizard().setEnabled(False) + from tortoisehg.hgqt import shelve + self.shelvedlg = dlg = shelve.ShelveDialog(repo) + dlg.finished.connect(finished) + dlg.show() + dlg.raise_() + dlg.setWindowModality(Qt.ApplicationModal)   elif cmd.startswith('discard'):   if cmd != 'discard:noconfirm':   labels = [(QMessageBox.Yes, _('&Discard')),