44 class Queues(HgExtension): |
44 class Queues(HgExtension): |
45 """ |
45 """ |
46 Class implementing the queues extension interface. |
46 Class implementing the queues extension interface. |
47 """ |
47 """ |
48 |
48 |
49 def __init__(self, vcs): |
49 def __init__(self, vcs, ui=None): |
50 """ |
50 """ |
51 Constructor |
51 Constructor |
52 |
52 |
53 @param vcs reference to the Mercurial vcs object |
53 @param vcs reference to the Mercurial vcs object |
54 @type Hg |
54 @type Hg |
55 """ |
55 @param ui reference to a UI widget (defaults to None) |
56 super().__init__(vcs) |
56 @type QWidget |
|
57 """ |
|
58 super().__init__(vcs, ui=ui) |
57 |
59 |
58 self.qdiffDialog = None |
60 self.qdiffDialog = None |
59 self.qheaderDialog = None |
61 self.qheaderDialog = None |
60 self.queuesListDialog = None |
62 self.queuesListDialog = None |
61 self.queuesListGuardsDialog = None |
63 self.queuesListGuardsDialog = None |
194 from .HgQueuesNewPatchDialog import ( |
196 from .HgQueuesNewPatchDialog import ( |
195 HgQueuesNewPatchDialog, |
197 HgQueuesNewPatchDialog, |
196 HgQueuesNewPatchDialogMode, |
198 HgQueuesNewPatchDialogMode, |
197 ) |
199 ) |
198 |
200 |
199 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialogMode.NEW) |
201 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialogMode.NEW, parent=self.ui) |
200 if dlg.exec() == QDialog.DialogCode.Accepted: |
202 if dlg.exec() == QDialog.DialogCode.Accepted: |
201 ( |
203 ( |
202 name, |
204 name, |
203 message, |
205 message, |
204 (userData, currentUser, userName), |
206 (userData, currentUser, userName), |
245 args = self.vcs.initCommand("qrefresh") |
247 args = self.vcs.initCommand("qrefresh") |
246 |
248 |
247 if editMessage: |
249 if editMessage: |
248 currentMessage = self.__getCommitMessage() |
250 currentMessage = self.__getCommitMessage() |
249 dlg = HgQueuesNewPatchDialog( |
251 dlg = HgQueuesNewPatchDialog( |
250 HgQueuesNewPatchDialogMode.REFRESH, currentMessage |
252 HgQueuesNewPatchDialogMode.REFRESH, currentMessage, parent=self.ui |
251 ) |
253 ) |
252 if dlg.exec() == QDialog.DialogCode.Accepted: |
254 if dlg.exec() == QDialog.DialogCode.Accepted: |
253 ( |
255 ( |
254 name, |
256 name, |
255 message, |
257 message, |
369 self.tr("Select Patch"), |
371 self.tr("Select Patch"), |
370 self.tr("""No patches to select from."""), |
372 self.tr("""No patches to select from."""), |
371 ) |
373 ) |
372 return False |
374 return False |
373 |
375 |
374 dia = HgDialog(title, self.vcs) |
376 dia = HgDialog(title, hg=self.vcs, parent=self.ui) |
375 res = dia.startProcess(args) |
377 res = dia.startProcess(args) |
376 if res: |
378 if res: |
377 dia.exec() |
379 dia.exec() |
378 res = dia.hasAddOrDelete() |
380 res = dia.hasAddOrDelete() |
379 self.vcs.checkVCSStatus() |
381 self.vcs.checkVCSStatus() |
394 Public method to finish all applied patches. |
396 Public method to finish all applied patches. |
395 """ |
397 """ |
396 args = self.vcs.initCommand("qfinish") |
398 args = self.vcs.initCommand("qfinish") |
397 args.append("--applied") |
399 args.append("--applied") |
398 |
400 |
399 dia = HgDialog(self.tr("Finish Applied Patches"), self.vcs) |
401 dia = HgDialog(self.tr("Finish Applied Patches"), hg=self.vcs, parent=self.ui) |
400 res = dia.startProcess(args) |
402 res = dia.startProcess(args) |
401 if res: |
403 if res: |
402 dia.exec() |
404 dia.exec() |
403 self.vcs.checkVCSStatus() |
405 self.vcs.checkVCSStatus() |
404 |
406 |
411 args = self.vcs.initCommand("qrename") |
413 args = self.vcs.initCommand("qrename") |
412 patchnames = sorted(self.__getPatchesList(QueuePatchesListType.SERIES)) |
414 patchnames = sorted(self.__getPatchesList(QueuePatchesListType.SERIES)) |
413 if patchnames: |
415 if patchnames: |
414 currentPatch = self.__getCurrentPatch() |
416 currentPatch = self.__getCurrentPatch() |
415 if currentPatch: |
417 if currentPatch: |
416 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
418 dlg = HgQueuesRenamePatchDialog( |
|
419 currentPatch, patchnames, parent=self.ui |
|
420 ) |
417 if dlg.exec() == QDialog.DialogCode.Accepted: |
421 if dlg.exec() == QDialog.DialogCode.Accepted: |
418 newName, selectedPatch = dlg.getData() |
422 newName, selectedPatch = dlg.getData() |
419 if selectedPatch: |
423 if selectedPatch: |
420 args.append(selectedPatch) |
424 args.append(selectedPatch) |
421 args.append(newName) |
425 args.append(newName) |
422 |
426 |
423 dia = HgDialog(self.tr("Rename Patch"), self.vcs) |
427 dia = HgDialog(self.tr("Rename Patch"), hg=self.vcs, parent=self.ui) |
424 res = dia.startProcess(args) |
428 res = dia.startProcess(args) |
425 if res: |
429 if res: |
426 dia.exec() |
430 dia.exec() |
427 |
431 |
428 def hgQueueDeletePatch(self): |
432 def hgQueueDeletePatch(self): |
461 args = self.vcs.initCommand("qfold") |
465 args = self.vcs.initCommand("qfold") |
462 patchnames = sorted( |
466 patchnames = sorted( |
463 self.__getPatchesList(QueuePatchesListType.UNAPPLIED, withSummary=True) |
467 self.__getPatchesList(QueuePatchesListType.UNAPPLIED, withSummary=True) |
464 ) |
468 ) |
465 if patchnames: |
469 if patchnames: |
466 dlg = HgQueuesFoldDialog(patchnames) |
470 dlg = HgQueuesFoldDialog(patchnames, parent=self.ui) |
467 if dlg.exec() == QDialog.DialogCode.Accepted: |
471 if dlg.exec() == QDialog.DialogCode.Accepted: |
468 message, patchesList = dlg.getData() |
472 message, patchesList = dlg.getData() |
469 if message: |
473 if message: |
470 args.append("--message") |
474 args.append("--message") |
471 args.append(message) |
475 args.append(message) |
472 if patchesList: |
476 if patchesList: |
473 args.extend(patchesList) |
477 args.extend(patchesList) |
474 |
478 |
475 dia = HgDialog(self.tr("Fold Patches"), self.vcs) |
479 dia = HgDialog(self.tr("Fold Patches"), hg=self.vcs, parent=self.ui) |
476 res = dia.startProcess(args) |
480 res = dia.startProcess(args) |
477 if res: |
481 if res: |
478 dia.exec() |
482 dia.exec() |
479 else: |
483 else: |
480 EricMessageBox.information( |
484 EricMessageBox.information( |
577 |
581 |
578 guardsList = self.getGuardsList() |
582 guardsList = self.getGuardsList() |
579 if guardsList: |
583 if guardsList: |
580 activeGuardsList = self.getGuardsList(allGuards=False) |
584 activeGuardsList = self.getGuardsList(allGuards=False) |
581 dlg = HgQueuesGuardsSelectionDialog( |
585 dlg = HgQueuesGuardsSelectionDialog( |
582 guardsList, activeGuards=activeGuardsList, listOnly=False |
586 guardsList, |
|
587 activeGuards=activeGuardsList, |
|
588 listOnly=False, |
|
589 parent=self.ui, |
583 ) |
590 ) |
584 if dlg.exec() == QDialog.DialogCode.Accepted: |
591 if dlg.exec() == QDialog.DialogCode.Accepted: |
585 guards = dlg.getData() |
592 guards = dlg.getData() |
586 if guards: |
593 if guards: |
587 args = self.vcs.initCommand("qselect") |
594 args = self.vcs.initCommand("qselect") |
588 args.extend(guards) |
595 args.extend(guards) |
589 |
596 |
590 dia = HgDialog(self.tr("Set Active Guards"), self.vcs) |
597 dia = HgDialog( |
|
598 self.tr("Set Active Guards"), hg=self.vcs, parent=self.ui |
|
599 ) |
591 res = dia.startProcess(args) |
600 res = dia.startProcess(args) |
592 if res: |
601 if res: |
593 dia.exec() |
602 dia.exec() |
594 else: |
603 else: |
595 EricMessageBox.information( |
604 EricMessageBox.information( |
604 Public method to deactivate all active guards. |
613 Public method to deactivate all active guards. |
605 """ |
614 """ |
606 args = self.vcs.initCommand("qselect") |
615 args = self.vcs.initCommand("qselect") |
607 args.append("--none") |
616 args.append("--none") |
608 |
617 |
609 dia = HgDialog(self.tr("Deactivate Guards"), self.vcs) |
618 dia = HgDialog(self.tr("Deactivate Guards"), hg=self.vcs, parent=self.ui) |
610 res = dia.startProcess(args) |
619 res = dia.startProcess(args) |
611 if res: |
620 if res: |
612 dia.exec() |
621 dia.exec() |
613 |
622 |
614 def hgQueueGuardsIdentifyActive(self): |
623 def hgQueueGuardsIdentifyActive(self): |
617 """ |
626 """ |
618 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
627 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
619 |
628 |
620 guardsList = self.getGuardsList(allGuards=False) |
629 guardsList = self.getGuardsList(allGuards=False) |
621 if guardsList: |
630 if guardsList: |
622 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
631 dlg = HgQueuesGuardsSelectionDialog( |
|
632 guardsList, listOnly=True, parent=self.ui |
|
633 ) |
623 dlg.exec() |
634 dlg.exec() |
624 |
635 |
625 def hgQueueCreateRenameQueue(self, isCreate): |
636 def hgQueueCreateRenameQueue(self, isCreate): |
626 """ |
637 """ |
627 Public method to create a new queue or rename the active queue. |
638 Public method to create a new queue or rename the active queue. |
636 |
647 |
637 title = ( |
648 title = ( |
638 self.tr("Create New Queue") if isCreate else self.tr("Rename Active Queue") |
649 self.tr("Create New Queue") if isCreate else self.tr("Rename Active Queue") |
639 ) |
650 ) |
640 dlg = HgQueuesQueueManagementDialog( |
651 dlg = HgQueuesQueueManagementDialog( |
641 HgQueuesQueueManagementDialogMode.NAME_INPUT, title, False, self.vcs |
652 HgQueuesQueueManagementDialogMode.NAME_INPUT, |
|
653 title, |
|
654 False, |
|
655 self.vcs, |
|
656 parent=self.ui, |
642 ) |
657 ) |
643 if dlg.exec() == QDialog.DialogCode.Accepted: |
658 if dlg.exec() == QDialog.DialogCode.Accepted: |
644 queueName = dlg.getData() |
659 queueName = dlg.getData() |
645 if queueName: |
660 if queueName: |
646 args = self.vcs.initCommand("qqueue") |
661 args = self.vcs.initCommand("qqueue") |
695 title = self.tr("Delete Queue") |
710 title = self.tr("Delete Queue") |
696 else: |
711 else: |
697 title = self.tr("Activate Queue") |
712 title = self.tr("Activate Queue") |
698 |
713 |
699 dlg = HgQueuesQueueManagementDialog( |
714 dlg = HgQueuesQueueManagementDialog( |
700 HgQueuesQueueManagementDialogMode.QUEUE_INPUT, title, True, self.vcs |
715 HgQueuesQueueManagementDialogMode.QUEUE_INPUT, |
|
716 title, |
|
717 True, |
|
718 self.vcs, |
|
719 parent=self.ui, |
701 ) |
720 ) |
702 if dlg.exec() == QDialog.DialogCode.Accepted: |
721 if dlg.exec() == QDialog.DialogCode.Accepted: |
703 queueName = dlg.getData() |
722 queueName = dlg.getData() |
704 if queueName: |
723 if queueName: |
705 args = self.vcs.initCommand("qqueue") |
724 args = self.vcs.initCommand("qqueue") |
752 """ |
771 """ |
753 args = self.vcs.initCommand("init") |
772 args = self.vcs.initCommand("init") |
754 args.append("--mq") |
773 args.append("--mq") |
755 args.append(self.vcs.getClient().getRepository()) |
774 args.append(self.vcs.getClient().getRepository()) |
756 # init is not possible with the command server |
775 # init is not possible with the command server |
757 dia = HgDialog(self.tr("Initializing new queue repository"), self.vcs) |
776 dia = HgDialog( |
|
777 self.tr("Initializing new queue repository"), |
|
778 hg=self.vcs, |
|
779 parent=self.ui, |
|
780 ) |
758 res = dia.startProcess(args) |
781 res = dia.startProcess(args) |
759 if res: |
782 if res: |
760 dia.exec() |
783 dia.exec() |
761 |
784 |
762 def hgQueueStatus(self, name): |
785 def hgQueueStatus(self, name): |