Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py

changeset 3008
7848489bcb92
parent 2962
d6c9d1ca2da4
child 3020
542e97d4ecb3
child 3057
10516539f238
equal deleted inserted replaced
3007:bad2e89047e7 3008:7848489bcb92
110 process.start('hg', args) 110 process.start('hg', args)
111 procStarted = process.waitForStarted(5000) 111 procStarted = process.waitForStarted(5000)
112 if procStarted: 112 if procStarted:
113 finished = process.waitForFinished(30000) 113 finished = process.waitForFinished(30000)
114 if finished and process.exitCode() == 0: 114 if finished and process.exitCode() == 0:
115 output = \ 115 output = str(
116 str(process.readAllStandardOutput(), ioEncoding, 'replace') 116 process.readAllStandardOutput(), ioEncoding, 'replace')
117 117
118 for line in output.splitlines(): 118 for line in output.splitlines():
119 if withSummary: 119 if withSummary:
120 l = line.strip().split(": ") 120 l = line.strip().split(": ")
121 if len(l) == 1: 121 if len(l) == 1:
214 process.start('hg', args) 214 process.start('hg', args)
215 procStarted = process.waitForStarted(5000) 215 procStarted = process.waitForStarted(5000)
216 if procStarted: 216 if procStarted:
217 finished = process.waitForFinished(30000) 217 finished = process.waitForFinished(30000)
218 if finished and process.exitCode() == 0: 218 if finished and process.exitCode() == 0:
219 output = \ 219 output = str(
220 str(process.readAllStandardOutput(), ioEncoding, 'replace') 220 process.readAllStandardOutput(), ioEncoding, 'replace')
221 221
222 for guard in output.splitlines(): 222 for guard in output.splitlines():
223 guard = guard.strip() 223 guard = guard.strip()
224 if all: 224 if all:
225 guard = guard[1:] 225 guard = guard[1:]
344 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) 344 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs)
345 self.qheaderDialog.show() 345 self.qheaderDialog.show()
346 QApplication.processEvents() 346 QApplication.processEvents()
347 self.qheaderDialog.start(name) 347 self.qheaderDialog.start(name)
348 348
349 def hgQueuePushPopPatches(self, name, operation, all=False, named=False, force=False): 349 def hgQueuePushPopPatches(self, name, operation, all=False, named=False,
350 """ 350 force=False):
351 Public method to push patches onto the stack or pop patches off the stack. 351 """
352 Public method to push patches onto the stack or pop patches off the
353 stack.
352 354
353 @param name file/directory name (string) 355 @param name file/directory name (string)
354 @param operation operation type to be performed (Queues.POP, 356 @param operation operation type to be performed (Queues.POP,
355 Queues.PUSH, Queues.GOTO) 357 Queues.PUSH, Queues.GOTO)
356 @keyparam all flag indicating to push/pop all (boolean) 358 @keyparam all flag indicating to push/pop all (boolean)
465 args.append("qrename") 467 args.append("qrename")
466 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST)) 468 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST))
467 if patchnames: 469 if patchnames:
468 currentPatch = self.__getCurrentPatch(repodir) 470 currentPatch = self.__getCurrentPatch(repodir)
469 if currentPatch: 471 if currentPatch:
470 from .HgQueuesRenamePatchDialog import HgQueuesRenamePatchDialog 472 from .HgQueuesRenamePatchDialog import \
473 HgQueuesRenamePatchDialog
471 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) 474 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames)
472 if dlg.exec_() == QDialog.Accepted: 475 if dlg.exec_() == QDialog.Accepted:
473 newName, selectedPatch = dlg.getData() 476 newName, selectedPatch = dlg.getData()
474 if selectedPatch: 477 if selectedPatch:
475 args.append(selectedPatch) 478 args.append(selectedPatch)
493 if os.path.splitdrive(repodir)[1] == os.sep: 496 if os.path.splitdrive(repodir)[1] == os.sep:
494 return 497 return
495 498
496 args = [] 499 args = []
497 args.append("qdelete") 500 args.append("qdelete")
498 patchnames = sorted(self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST)) 501 patchnames = sorted(self.__getPatchesList(repodir,
502 Queues.UNAPPLIED_LIST))
499 if patchnames: 503 if patchnames:
500 patch, ok = QInputDialog.getItem( 504 patch, ok = QInputDialog.getItem(
501 None, 505 None,
502 self.trUtf8("Select Patch"), 506 self.trUtf8("Select Patch"),
503 self.trUtf8("Select the patch to be deleted:"), 507 self.trUtf8("Select the patch to be deleted:"),
529 return 533 return
530 534
531 args = [] 535 args = []
532 args.append("qfold") 536 args.append("qfold")
533 patchnames = sorted( 537 patchnames = sorted(
534 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST, withSummary=True)) 538 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST,
539 withSummary=True))
535 if patchnames: 540 if patchnames:
536 from .HgQueuesFoldDialog import HgQueuesFoldDialog 541 from .HgQueuesFoldDialog import HgQueuesFoldDialog
537 dlg = HgQueuesFoldDialog(patchnames) 542 dlg = HgQueuesFoldDialog(patchnames)
538 if dlg.exec_() == QDialog.Accepted: 543 if dlg.exec_() == QDialog.Accepted:
539 message, patchesList = dlg.getData() 544 message, patchesList = dlg.getData()
571 576
572 patchnames = sorted( 577 patchnames = sorted(
573 self.__getPatchesList(repodir, Queues.SERIES_LIST)) 578 self.__getPatchesList(repodir, Queues.SERIES_LIST))
574 if patchnames: 579 if patchnames:
575 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog 580 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog
576 self.queuesListGuardsDialog = HgQueuesListGuardsDialog(self.vcs, patchnames) 581 self.queuesListGuardsDialog = \
582 HgQueuesListGuardsDialog(self.vcs, patchnames)
577 self.queuesListGuardsDialog.show() 583 self.queuesListGuardsDialog.show()
578 self.queuesListGuardsDialog.start(name) 584 self.queuesListGuardsDialog.start(name)
579 else: 585 else:
580 E5MessageBox.information(None, 586 E5MessageBox.information(None,
581 self.trUtf8("List Guards"), 587 self.trUtf8("List Guards"),
677 return 683 return
678 684
679 guardsList = self.getGuardsList(repodir) 685 guardsList = self.getGuardsList(repodir)
680 if guardsList: 686 if guardsList:
681 activeGuardsList = self.getGuardsList(repodir, all=False) 687 activeGuardsList = self.getGuardsList(repodir, all=False)
682 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog 688 from .HgQueuesGuardsSelectionDialog import \
689 HgQueuesGuardsSelectionDialog
683 dlg = HgQueuesGuardsSelectionDialog( 690 dlg = HgQueuesGuardsSelectionDialog(
684 guardsList, activeGuards=activeGuardsList, listOnly=False) 691 guardsList, activeGuards=activeGuardsList, listOnly=False)
685 if dlg.exec_() == QDialog.Accepted: 692 if dlg.exec_() == QDialog.Accepted:
686 guards = dlg.getData() 693 guards = dlg.getData()
687 if guards: 694 if guards:
734 if os.path.splitdrive(repodir)[1] == os.sep: 741 if os.path.splitdrive(repodir)[1] == os.sep:
735 return 742 return
736 743
737 guardsList = self.getGuardsList(repodir, all=False) 744 guardsList = self.getGuardsList(repodir, all=False)
738 if guardsList: 745 if guardsList:
739 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog 746 from .HgQueuesGuardsSelectionDialog import \
747 HgQueuesGuardsSelectionDialog
740 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) 748 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True)
741 dlg.exec_() 749 dlg.exec_()
742 750
743 def hgQueueCreateRenameQueue(self, name, isCreate): 751 def hgQueueCreateRenameQueue(self, name, isCreate):
744 """ 752 """
756 764
757 if isCreate: 765 if isCreate:
758 title = self.trUtf8("Create New Queue") 766 title = self.trUtf8("Create New Queue")
759 else: 767 else:
760 title = self.trUtf8("Rename Active Queue") 768 title = self.trUtf8("Rename Active Queue")
761 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog 769 from .HgQueuesQueueManagementDialog import \
762 dlg = HgQueuesQueueManagementDialog(HgQueuesQueueManagementDialog.NAME_INPUT, 770 HgQueuesQueueManagementDialog
771 dlg = HgQueuesQueueManagementDialog(
772 HgQueuesQueueManagementDialog.NAME_INPUT,
763 title, False, repodir, self.vcs) 773 title, False, repodir, self.vcs)
764 if dlg.exec_() == QDialog.Accepted: 774 if dlg.exec_() == QDialog.Accepted:
765 queueName = dlg.getData() 775 queueName = dlg.getData()
766 if queueName: 776 if queueName:
767 args = [] 777 args = []
829 elif operation == Queues.QUEUE_ACTIVATE: 839 elif operation == Queues.QUEUE_ACTIVATE:
830 title = self.trUtf8("Activate Queue") 840 title = self.trUtf8("Activate Queue")
831 else: 841 else:
832 raise ValueError("illegal value for operation") 842 raise ValueError("illegal value for operation")
833 843
834 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog 844 from .HgQueuesQueueManagementDialog import \
835 dlg = HgQueuesQueueManagementDialog(HgQueuesQueueManagementDialog.QUEUE_INPUT, 845 HgQueuesQueueManagementDialog
846 dlg = HgQueuesQueueManagementDialog(
847 HgQueuesQueueManagementDialog.QUEUE_INPUT,
836 title, True, repodir, self.vcs) 848 title, True, repodir, self.vcs)
837 if dlg.exec_() == QDialog.Accepted: 849 if dlg.exec_() == QDialog.Accepted:
838 queueName = dlg.getData() 850 queueName = dlg.getData()
839 if queueName: 851 if queueName:
840 args = [] 852 args = []
890 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): 902 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
891 repodir = os.path.dirname(repodir) 903 repodir = os.path.dirname(repodir)
892 if os.path.splitdrive(repodir)[1] == os.sep: 904 if os.path.splitdrive(repodir)[1] == os.sep:
893 return 905 return
894 906
895 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog 907 from .HgQueuesQueueManagementDialog import \
908 HgQueuesQueueManagementDialog
896 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( 909 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog(
897 HgQueuesQueueManagementDialog.NO_INPUT, 910 HgQueuesQueueManagementDialog.NO_INPUT,
898 self.trUtf8("Available Queues"), 911 self.trUtf8("Available Queues"),
899 False, repodir, self.vcs) 912 False, repodir, self.vcs)
900 self.queuesListQueuesDialog.show() 913 self.queuesListQueuesDialog.show()
915 args = [] 928 args = []
916 args.append('init') 929 args.append('init')
917 args.append('--mq') 930 args.append('--mq')
918 args.append(repodir) 931 args.append(repodir)
919 # init is not possible with the command server 932 # init is not possible with the command server
920 dia = HgDialog(self.trUtf8('Initializing new queue repository'), self.vcs) 933 dia = HgDialog(
934 self.trUtf8('Initializing new queue repository'), self.vcs)
921 res = dia.startProcess(args) 935 res = dia.startProcess(args)
922 if res: 936 if res:
923 dia.exec_() 937 dia.exec_()
924 938
925 def hgQueueStatus(self, name): 939 def hgQueueStatus(self, name):

eric ide

mercurial