eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8259
2bbec88047dd
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
35 """ 35 """
36 Constructor 36 Constructor
37 37
38 @param vcs reference to the Mercurial vcs object 38 @param vcs reference to the Mercurial vcs object
39 """ 39 """
40 super(Queues, self).__init__(vcs) 40 super().__init__(vcs)
41 41
42 self.qdiffDialog = None 42 self.qdiffDialog = None
43 self.qheaderDialog = None 43 self.qheaderDialog = None
44 self.queuesListDialog = None 44 self.queuesListDialog = None
45 self.queuesListGuardsDialog = None 45 self.queuesListGuardsDialog = None
79 @return list of patches (list of string) 79 @return list of patches (list of string)
80 @exception ValueError raised to indicate an invalid patch list type 80 @exception ValueError raised to indicate an invalid patch list type
81 """ 81 """
82 patchesList = [] 82 patchesList = []
83 83
84 if listType not in (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST,
85 Queues.SERIES_LIST):
86 raise ValueError("illegal value for listType")
87
84 if listType == Queues.APPLIED_LIST: 88 if listType == Queues.APPLIED_LIST:
85 args = self.vcs.initCommand("qapplied") 89 args = self.vcs.initCommand("qapplied")
86 elif listType == Queues.UNAPPLIED_LIST: 90 elif listType == Queues.UNAPPLIED_LIST:
87 args = self.vcs.initCommand("qunapplied") 91 args = self.vcs.initCommand("qunapplied")
88 elif listType == Queues.SERIES_LIST: 92 else:
89 args = self.vcs.initCommand("qseries") 93 args = self.vcs.initCommand("qseries")
90 else: 94
91 raise ValueError("illegal value for listType")
92 if withSummary: 95 if withSummary:
93 args.append("--summary") 96 args.append("--summary")
94 97
95 client = self.vcs.getClient() 98 client = self.vcs.getClient()
96 output = client.runcommand(args)[0] 99 output = client.runcommand(args)[0]
275 is at the top of the stack (boolean) 278 is at the top of the stack (boolean)
276 @param force flag indicating a forceful pop (boolean) 279 @param force flag indicating a forceful pop (boolean)
277 @return flag indicating that the project should be reread (boolean) 280 @return flag indicating that the project should be reread (boolean)
278 @exception ValueError raised to indicate an invalid operation 281 @exception ValueError raised to indicate an invalid operation
279 """ 282 """
283 if operation not in (Queues.POP, Queues.PUSH, Queues.GOTO):
284 raise ValueError("illegal value for operation")
285
280 if operation == Queues.POP: 286 if operation == Queues.POP:
281 args = self.vcs.initCommand("qpop") 287 args = self.vcs.initCommand("qpop")
282 title = self.tr("Pop Patches") 288 title = self.tr("Pop Patches")
283 listType = Queues.APPLIED_LIST 289 listType = Queues.APPLIED_LIST
284 elif operation == Queues.PUSH: 290 elif operation == Queues.PUSH:
285 args = self.vcs.initCommand("qpush") 291 args = self.vcs.initCommand("qpush")
286 title = self.tr("Push Patches") 292 title = self.tr("Push Patches")
287 listType = Queues.UNAPPLIED_LIST 293 listType = Queues.UNAPPLIED_LIST
288 elif operation == Queues.GOTO: 294 else:
289 args = self.vcs.initCommand("qgoto") 295 args = self.vcs.initCommand("qgoto")
290 title = self.tr("Go to Patch") 296 title = self.tr("Go to Patch")
291 listType = Queues.SERIES_LIST 297 listType = Queues.SERIES_LIST
292 else: 298
293 raise ValueError("illegal value for operation")
294 args.append("-v") 299 args.append("-v")
295 if force: 300 if force:
296 args.append("--force") 301 args.append("--force")
297 if doAll and operation in (Queues.POP, Queues.PUSH): 302 if doAll and operation in (Queues.POP, Queues.PUSH):
298 args.append("--all") 303 args.append("--all")
557 """ 562 """
558 Public method to create a new queue or rename the active queue. 563 Public method to create a new queue or rename the active queue.
559 564
560 @param isCreate flag indicating to create a new queue (boolean) 565 @param isCreate flag indicating to create a new queue (boolean)
561 """ 566 """
562 if isCreate:
563 title = self.tr("Create New Queue")
564 else:
565 title = self.tr("Rename Active Queue")
566 from .HgQueuesQueueManagementDialog import ( 567 from .HgQueuesQueueManagementDialog import (
567 HgQueuesQueueManagementDialog 568 HgQueuesQueueManagementDialog
569 )
570
571 title = (
572 self.tr("Create New Queue")
573 if isCreate else
574 self.tr("Rename Active Queue")
568 ) 575 )
569 dlg = HgQueuesQueueManagementDialog( 576 dlg = HgQueuesQueueManagementDialog(
570 HgQueuesQueueManagementDialog.NAME_INPUT, 577 HgQueuesQueueManagementDialog.NAME_INPUT,
571 title, False, self.vcs) 578 title, False, self.vcs)
572 if dlg.exec() == QDialog.DialogCode.Accepted: 579 if dlg.exec() == QDialog.DialogCode.Accepted:
607 614
608 @param operation operation to be performed (Queues.QUEUE_DELETE, 615 @param operation operation to be performed (Queues.QUEUE_DELETE,
609 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) 616 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE)
610 @exception ValueError raised to indicate an invalid operation 617 @exception ValueError raised to indicate an invalid operation
611 """ 618 """
619 if operation not in (Queues.QUEUE_PURGE, Queues.QUEUE_DELETE,
620 Queues.QUEUE_ACTIVATE):
621 raise ValueError("illegal value for operation")
622
612 if operation == Queues.QUEUE_PURGE: 623 if operation == Queues.QUEUE_PURGE:
613 title = self.tr("Purge Queue") 624 title = self.tr("Purge Queue")
614 elif operation == Queues.QUEUE_DELETE: 625 elif operation == Queues.QUEUE_DELETE:
615 title = self.tr("Delete Queue") 626 title = self.tr("Delete Queue")
616 elif operation == Queues.QUEUE_ACTIVATE: 627 else:
617 title = self.tr("Activate Queue") 628 title = self.tr("Activate Queue")
618 else:
619 raise ValueError("illegal value for operation")
620 629
621 from .HgQueuesQueueManagementDialog import ( 630 from .HgQueuesQueueManagementDialog import (
622 HgQueuesQueueManagementDialog 631 HgQueuesQueueManagementDialog
623 ) 632 )
624 dlg = HgQueuesQueueManagementDialog( 633 dlg = HgQueuesQueueManagementDialog(

eric ide

mercurial