87 @param repodir directory name of the repository (string) |
87 @param repodir directory name of the repository (string) |
88 @param listType type of patches list to get |
88 @param listType type of patches list to get |
89 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
89 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
90 @param withSummary flag indicating to get a summary as well (boolean) |
90 @param withSummary flag indicating to get a summary as well (boolean) |
91 @return list of patches (list of string) |
91 @return list of patches (list of string) |
|
92 @exception ValueError raised to indicate an invalid patch list type |
92 """ |
93 """ |
93 patchesList = [] |
94 patchesList = [] |
94 |
95 |
95 args = [] |
96 args = [] |
96 if listType == Queues.APPLIED_LIST: |
97 if listType == Queues.APPLIED_LIST: |
115 process.start('hg', args) |
116 process.start('hg', args) |
116 procStarted = process.waitForStarted(5000) |
117 procStarted = process.waitForStarted(5000) |
117 if procStarted: |
118 if procStarted: |
118 finished = process.waitForFinished(30000) |
119 finished = process.waitForFinished(30000) |
119 if finished and process.exitCode() == 0: |
120 if finished and process.exitCode() == 0: |
120 output = \ |
121 output = str( |
121 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
122 process.readAllStandardOutput(), ioEncoding, 'replace') |
122 |
123 |
123 for line in output.splitlines(): |
124 for line in output.splitlines(): |
124 if withSummary: |
125 if withSummary: |
125 l = line.strip().split(": ") |
126 l = line.strip().split(": ") |
126 if len(l) == 1: |
127 if len(l) == 1: |
219 process.start('hg', args) |
220 process.start('hg', args) |
220 procStarted = process.waitForStarted(5000) |
221 procStarted = process.waitForStarted(5000) |
221 if procStarted: |
222 if procStarted: |
222 finished = process.waitForFinished(30000) |
223 finished = process.waitForFinished(30000) |
223 if finished and process.exitCode() == 0: |
224 if finished and process.exitCode() == 0: |
224 output = \ |
225 output = str( |
225 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
226 process.readAllStandardOutput(), ioEncoding, 'replace') |
226 |
227 |
227 for guard in output.splitlines(): |
228 for guard in output.splitlines(): |
228 guard = guard.strip() |
229 guard = guard.strip() |
229 if all: |
230 if all: |
230 guard = guard[1:] |
231 guard = guard[1:] |
349 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
350 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
350 self.qheaderDialog.show() |
351 self.qheaderDialog.show() |
351 QApplication.processEvents() |
352 QApplication.processEvents() |
352 self.qheaderDialog.start(name) |
353 self.qheaderDialog.start(name) |
353 |
354 |
354 def hgQueuePushPopPatches(self, name, operation, all=False, named=False, force=False): |
355 def hgQueuePushPopPatches(self, name, operation, all=False, named=False, |
355 """ |
356 force=False): |
356 Public method to push patches onto the stack or pop patches off the stack. |
357 """ |
|
358 Public method to push patches onto the stack or pop patches off the |
|
359 stack. |
357 |
360 |
358 @param name file/directory name (string) |
361 @param name file/directory name (string) |
359 @param operation operation type to be performed (Queues.POP, |
362 @param operation operation type to be performed (Queues.POP, |
360 Queues.PUSH, Queues.GOTO) |
363 Queues.PUSH, Queues.GOTO) |
361 @keyparam all flag indicating to push/pop all (boolean) |
364 @keyparam all flag indicating to push/pop all (boolean) |
362 @keyparam named flag indicating to push/pop until a named patch |
365 @keyparam named flag indicating to push/pop until a named patch |
363 is at the top of the stack (boolean) |
366 is at the top of the stack (boolean) |
364 @keyparam force flag indicating a forceful pop (boolean) |
367 @keyparam force flag indicating a forceful pop (boolean) |
365 @return flag indicating that the project should be reread (boolean) |
368 @return flag indicating that the project should be reread (boolean) |
|
369 @exception ValueError raised to indicate an invalid operation |
366 """ |
370 """ |
367 # find the root of the repo |
371 # find the root of the repo |
368 repodir = self.vcs.splitPath(name)[0] |
372 repodir = self.vcs.splitPath(name)[0] |
369 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
373 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
370 repodir = os.path.dirname(repodir) |
374 repodir = os.path.dirname(repodir) |
469 args.append("qrename") |
473 args.append("qrename") |
470 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
474 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
471 if patchnames: |
475 if patchnames: |
472 currentPatch = self.__getCurrentPatch(repodir) |
476 currentPatch = self.__getCurrentPatch(repodir) |
473 if currentPatch: |
477 if currentPatch: |
474 from .HgQueuesRenamePatchDialog import HgQueuesRenamePatchDialog |
478 from .HgQueuesRenamePatchDialog import \ |
|
479 HgQueuesRenamePatchDialog |
475 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
480 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
476 if dlg.exec_() == QDialog.Accepted: |
481 if dlg.exec_() == QDialog.Accepted: |
477 newName, selectedPatch = dlg.getData() |
482 newName, selectedPatch = dlg.getData() |
478 if selectedPatch: |
483 if selectedPatch: |
479 args.append(selectedPatch) |
484 args.append(selectedPatch) |
497 if os.path.splitdrive(repodir)[1] == os.sep: |
502 if os.path.splitdrive(repodir)[1] == os.sep: |
498 return |
503 return |
499 |
504 |
500 args = [] |
505 args = [] |
501 args.append("qdelete") |
506 args.append("qdelete") |
502 patchnames = sorted(self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST)) |
507 patchnames = sorted(self.__getPatchesList(repodir, |
|
508 Queues.UNAPPLIED_LIST)) |
503 if patchnames: |
509 if patchnames: |
504 patch, ok = QInputDialog.getItem( |
510 patch, ok = QInputDialog.getItem( |
505 None, |
511 None, |
506 self.trUtf8("Select Patch"), |
512 self.trUtf8("Select Patch"), |
507 self.trUtf8("Select the patch to be deleted:"), |
513 self.trUtf8("Select the patch to be deleted:"), |
533 return |
539 return |
534 |
540 |
535 args = [] |
541 args = [] |
536 args.append("qfold") |
542 args.append("qfold") |
537 patchnames = sorted( |
543 patchnames = sorted( |
538 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST, withSummary=True)) |
544 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST, |
|
545 withSummary=True)) |
539 if patchnames: |
546 if patchnames: |
540 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
547 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
541 dlg = HgQueuesFoldDialog(patchnames) |
548 dlg = HgQueuesFoldDialog(patchnames) |
542 if dlg.exec_() == QDialog.Accepted: |
549 if dlg.exec_() == QDialog.Accepted: |
543 message, patchesList = dlg.getData() |
550 message, patchesList = dlg.getData() |
575 |
582 |
576 patchnames = sorted( |
583 patchnames = sorted( |
577 self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
584 self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
578 if patchnames: |
585 if patchnames: |
579 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
586 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
580 self.queuesListGuardsDialog = HgQueuesListGuardsDialog(self.vcs, patchnames) |
587 self.queuesListGuardsDialog = \ |
|
588 HgQueuesListGuardsDialog(self.vcs, patchnames) |
581 self.queuesListGuardsDialog.show() |
589 self.queuesListGuardsDialog.show() |
582 self.queuesListGuardsDialog.start(name) |
590 self.queuesListGuardsDialog.start(name) |
583 else: |
591 else: |
584 E5MessageBox.information(None, |
592 E5MessageBox.information(None, |
585 self.trUtf8("List Guards"), |
593 self.trUtf8("List Guards"), |
681 return |
689 return |
682 |
690 |
683 guardsList = self.getGuardsList(repodir) |
691 guardsList = self.getGuardsList(repodir) |
684 if guardsList: |
692 if guardsList: |
685 activeGuardsList = self.getGuardsList(repodir, all=False) |
693 activeGuardsList = self.getGuardsList(repodir, all=False) |
686 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
694 from .HgQueuesGuardsSelectionDialog import \ |
|
695 HgQueuesGuardsSelectionDialog |
687 dlg = HgQueuesGuardsSelectionDialog( |
696 dlg = HgQueuesGuardsSelectionDialog( |
688 guardsList, activeGuards=activeGuardsList, listOnly=False) |
697 guardsList, activeGuards=activeGuardsList, listOnly=False) |
689 if dlg.exec_() == QDialog.Accepted: |
698 if dlg.exec_() == QDialog.Accepted: |
690 guards = dlg.getData() |
699 guards = dlg.getData() |
691 if guards: |
700 if guards: |
738 if os.path.splitdrive(repodir)[1] == os.sep: |
747 if os.path.splitdrive(repodir)[1] == os.sep: |
739 return |
748 return |
740 |
749 |
741 guardsList = self.getGuardsList(repodir, all=False) |
750 guardsList = self.getGuardsList(repodir, all=False) |
742 if guardsList: |
751 if guardsList: |
743 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
752 from .HgQueuesGuardsSelectionDialog import \ |
|
753 HgQueuesGuardsSelectionDialog |
744 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
754 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
745 dlg.exec_() |
755 dlg.exec_() |
746 |
756 |
747 def hgQueueCreateRenameQueue(self, name, isCreate): |
757 def hgQueueCreateRenameQueue(self, name, isCreate): |
748 """ |
758 """ |
760 |
770 |
761 if isCreate: |
771 if isCreate: |
762 title = self.trUtf8("Create New Queue") |
772 title = self.trUtf8("Create New Queue") |
763 else: |
773 else: |
764 title = self.trUtf8("Rename Active Queue") |
774 title = self.trUtf8("Rename Active Queue") |
765 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
775 from .HgQueuesQueueManagementDialog import \ |
766 dlg = HgQueuesQueueManagementDialog(HgQueuesQueueManagementDialog.NAME_INPUT, |
776 HgQueuesQueueManagementDialog |
|
777 dlg = HgQueuesQueueManagementDialog( |
|
778 HgQueuesQueueManagementDialog.NAME_INPUT, |
767 title, False, repodir, self.vcs) |
779 title, False, repodir, self.vcs) |
768 if dlg.exec_() == QDialog.Accepted: |
780 if dlg.exec_() == QDialog.Accepted: |
769 queueName = dlg.getData() |
781 queueName = dlg.getData() |
770 if queueName: |
782 if queueName: |
771 args = [] |
783 args = [] |
815 remove the patch directory or set the active queue. |
827 remove the patch directory or set the active queue. |
816 |
828 |
817 @param name file/directory name (string) |
829 @param name file/directory name (string) |
818 @param operation operation to be performed (Queues.QUEUE_DELETE, |
830 @param operation operation to be performed (Queues.QUEUE_DELETE, |
819 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
831 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
|
832 @exception ValueError raised to indicate an invalid operation |
820 """ |
833 """ |
821 # find the root of the repo |
834 # find the root of the repo |
822 repodir = self.vcs.splitPath(name)[0] |
835 repodir = self.vcs.splitPath(name)[0] |
823 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
836 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
824 repodir = os.path.dirname(repodir) |
837 repodir = os.path.dirname(repodir) |
832 elif operation == Queues.QUEUE_ACTIVATE: |
845 elif operation == Queues.QUEUE_ACTIVATE: |
833 title = self.trUtf8("Activate Queue") |
846 title = self.trUtf8("Activate Queue") |
834 else: |
847 else: |
835 raise ValueError("illegal value for operation") |
848 raise ValueError("illegal value for operation") |
836 |
849 |
837 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
850 from .HgQueuesQueueManagementDialog import \ |
838 dlg = HgQueuesQueueManagementDialog(HgQueuesQueueManagementDialog.QUEUE_INPUT, |
851 HgQueuesQueueManagementDialog |
|
852 dlg = HgQueuesQueueManagementDialog( |
|
853 HgQueuesQueueManagementDialog.QUEUE_INPUT, |
839 title, True, repodir, self.vcs) |
854 title, True, repodir, self.vcs) |
840 if dlg.exec_() == QDialog.Accepted: |
855 if dlg.exec_() == QDialog.Accepted: |
841 queueName = dlg.getData() |
856 queueName = dlg.getData() |
842 if queueName: |
857 if queueName: |
843 args = [] |
858 args = [] |
893 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
908 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
894 repodir = os.path.dirname(repodir) |
909 repodir = os.path.dirname(repodir) |
895 if os.path.splitdrive(repodir)[1] == os.sep: |
910 if os.path.splitdrive(repodir)[1] == os.sep: |
896 return |
911 return |
897 |
912 |
898 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
913 from .HgQueuesQueueManagementDialog import \ |
|
914 HgQueuesQueueManagementDialog |
899 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
915 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
900 HgQueuesQueueManagementDialog.NO_INPUT, |
916 HgQueuesQueueManagementDialog.NO_INPUT, |
901 self.trUtf8("Available Queues"), |
917 self.trUtf8("Available Queues"), |
902 False, repodir, self.vcs) |
918 False, repodir, self.vcs) |
903 self.queuesListQueuesDialog.show() |
919 self.queuesListQueuesDialog.show() |
918 args = [] |
934 args = [] |
919 args.append('init') |
935 args.append('init') |
920 args.append('--mq') |
936 args.append('--mq') |
921 args.append(repodir) |
937 args.append(repodir) |
922 # init is not possible with the command server |
938 # init is not possible with the command server |
923 dia = HgDialog(self.trUtf8('Initializing new queue repository'), self.vcs) |
939 dia = HgDialog( |
|
940 self.trUtf8('Initializing new queue repository'), self.vcs) |
924 res = dia.startProcess(args) |
941 res = dia.startProcess(args) |
925 if res: |
942 if res: |
926 dia.exec_() |
943 dia.exec_() |
927 |
944 |
928 def hgQueueStatus(self, name): |
945 def hgQueueStatus(self, name): |