66 self.queuesDefineGuardsDialog.close() |
67 self.queuesDefineGuardsDialog.close() |
67 if self.queuesListQueuesDialog is not None: |
68 if self.queuesListQueuesDialog is not None: |
68 self.queuesListQueuesDialog.close() |
69 self.queuesListQueuesDialog.close() |
69 if self.queueStatusDialog is not None: |
70 if self.queueStatusDialog is not None: |
70 self.queueStatusDialog.close() |
71 self.queueStatusDialog.close() |
71 |
72 |
72 def __getPatchesList(self, listType, withSummary=False): |
73 def __getPatchesList(self, listType, withSummary=False): |
73 """ |
74 """ |
74 Private method to get a list of patches of a given type. |
75 Private method to get a list of patches of a given type. |
75 |
76 |
76 @param listType type of patches list to get |
77 @param listType type of patches list to get |
77 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
78 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
78 @param withSummary flag indicating to get a summary as well (boolean) |
79 @param withSummary flag indicating to get a summary as well (boolean) |
79 @return list of patches (list of string) |
80 @return list of patches (list of string) |
80 @exception ValueError raised to indicate an invalid patch list type |
81 @exception ValueError raised to indicate an invalid patch list type |
81 """ |
82 """ |
82 patchesList = [] |
83 patchesList = [] |
83 |
84 |
84 if listType not in (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, |
85 if listType not in ( |
85 Queues.SERIES_LIST): |
86 Queues.APPLIED_LIST, |
|
87 Queues.UNAPPLIED_LIST, |
|
88 Queues.SERIES_LIST, |
|
89 ): |
86 raise ValueError("illegal value for listType") |
90 raise ValueError("illegal value for listType") |
87 |
91 |
88 if listType == Queues.APPLIED_LIST: |
92 if listType == Queues.APPLIED_LIST: |
89 args = self.vcs.initCommand("qapplied") |
93 args = self.vcs.initCommand("qapplied") |
90 elif listType == Queues.UNAPPLIED_LIST: |
94 elif listType == Queues.UNAPPLIED_LIST: |
91 args = self.vcs.initCommand("qunapplied") |
95 args = self.vcs.initCommand("qunapplied") |
92 else: |
96 else: |
93 args = self.vcs.initCommand("qseries") |
97 args = self.vcs.initCommand("qseries") |
94 |
98 |
95 if withSummary: |
99 if withSummary: |
96 args.append("--summary") |
100 args.append("--summary") |
97 |
101 |
98 client = self.vcs.getClient() |
102 client = self.vcs.getClient() |
99 output = client.runcommand(args)[0] |
103 output = client.runcommand(args)[0] |
100 |
104 |
101 for line in output.splitlines(): |
105 for line in output.splitlines(): |
102 if withSummary: |
106 if withSummary: |
103 li = line.strip().split(": ") |
107 li = line.strip().split(": ") |
104 if len(li) == 1: |
108 if len(li) == 1: |
105 patch, summary = li[0][:-1], "" |
109 patch, summary = li[0][:-1], "" |
106 else: |
110 else: |
107 patch, summary = li[0], li[1] |
111 patch, summary = li[0], li[1] |
108 patchesList.append("{0}@@{1}".format(patch, summary)) |
112 patchesList.append("{0}@@{1}".format(patch, summary)) |
109 else: |
113 else: |
110 patchesList.append(line.strip()) |
114 patchesList.append(line.strip()) |
111 |
115 |
112 return patchesList |
116 return patchesList |
113 |
117 |
114 def __getCurrentPatch(self): |
118 def __getCurrentPatch(self): |
115 """ |
119 """ |
116 Private method to get the name of the current patch. |
120 Private method to get the name of the current patch. |
117 |
121 |
118 @return name of the current patch (string) |
122 @return name of the current patch (string) |
119 """ |
123 """ |
120 currentPatch = "" |
124 currentPatch = "" |
121 |
125 |
122 args = self.vcs.initCommand("qtop") |
126 args = self.vcs.initCommand("qtop") |
123 |
127 |
124 client = self.vcs.getClient() |
128 client = self.vcs.getClient() |
125 currentPatch = client.runcommand(args)[0].strip() |
129 currentPatch = client.runcommand(args)[0].strip() |
126 |
130 |
127 return currentPatch |
131 return currentPatch |
128 |
132 |
129 def __getCommitMessage(self): |
133 def __getCommitMessage(self): |
130 """ |
134 """ |
131 Private method to get the commit message of the current patch. |
135 Private method to get the commit message of the current patch. |
132 |
136 |
133 @return name of the current patch (string) |
137 @return name of the current patch (string) |
134 """ |
138 """ |
135 message = "" |
139 message = "" |
136 |
140 |
137 args = self.vcs.initCommand("qheader") |
141 args = self.vcs.initCommand("qheader") |
138 |
142 |
139 client = self.vcs.getClient() |
143 client = self.vcs.getClient() |
140 message = client.runcommand(args)[0] |
144 message = client.runcommand(args)[0] |
141 |
145 |
142 return message |
146 return message |
143 |
147 |
144 def getGuardsList(self, allGuards=True): |
148 def getGuardsList(self, allGuards=True): |
145 """ |
149 """ |
146 Public method to get a list of all guards defined. |
150 Public method to get a list of all guards defined. |
147 |
151 |
148 @param allGuards flag indicating to get all guards (boolean) |
152 @param allGuards flag indicating to get all guards (boolean) |
149 @return sorted list of guards (list of strings) |
153 @return sorted list of guards (list of strings) |
150 """ |
154 """ |
151 guardsList = [] |
155 guardsList = [] |
152 |
156 |
153 args = self.vcs.initCommand("qselect") |
157 args = self.vcs.initCommand("qselect") |
154 if allGuards: |
158 if allGuards: |
155 args.append("--series") |
159 args.append("--series") |
156 |
160 |
157 client = self.vcs.getClient() |
161 client = self.vcs.getClient() |
158 output = client.runcommand(args)[0] |
162 output = client.runcommand(args)[0] |
159 |
163 |
160 for guard in output.splitlines(): |
164 for guard in output.splitlines(): |
161 guard = guard.strip() |
165 guard = guard.strip() |
162 if allGuards: |
166 if allGuards: |
163 guard = guard[1:] |
167 guard = guard[1:] |
164 if guard not in guardsList: |
168 if guard not in guardsList: |
165 guardsList.append(guard) |
169 guardsList.append(guard) |
166 |
170 |
167 return sorted(guardsList) |
171 return sorted(guardsList) |
168 |
172 |
169 def hgQueueNewPatch(self): |
173 def hgQueueNewPatch(self): |
170 """ |
174 """ |
171 Public method to create a new named patch. |
175 Public method to create a new named patch. |
172 """ |
176 """ |
173 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
177 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
|
178 |
174 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE) |
179 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE) |
175 if dlg.exec() == QDialog.DialogCode.Accepted: |
180 if dlg.exec() == QDialog.DialogCode.Accepted: |
176 (name, message, |
181 ( |
177 (userData, currentUser, userName), |
182 name, |
178 (dateData, currentDate, dateStr)) = dlg.getData() |
183 message, |
179 |
184 (userData, currentUser, userName), |
|
185 (dateData, currentDate, dateStr), |
|
186 ) = dlg.getData() |
|
187 |
180 args = self.vcs.initCommand("qnew") |
188 args = self.vcs.initCommand("qnew") |
181 if message != "": |
189 if message != "": |
182 args.append("--message") |
190 args.append("--message") |
183 args.append(message) |
191 args.append(message) |
184 if userData: |
192 if userData: |
307 patch, ok = QInputDialog.getItem( |
321 patch, ok = QInputDialog.getItem( |
308 None, |
322 None, |
309 self.tr("Select Patch"), |
323 self.tr("Select Patch"), |
310 self.tr("Select the target patch name:"), |
324 self.tr("Select the target patch name:"), |
311 patchnames, |
325 patchnames, |
312 0, False) |
326 0, |
|
327 False, |
|
328 ) |
313 if ok and patch: |
329 if ok and patch: |
314 args.append(patch) |
330 args.append(patch) |
315 else: |
331 else: |
316 return False |
332 return False |
317 else: |
333 else: |
318 EricMessageBox.information( |
334 EricMessageBox.information( |
319 None, |
335 None, |
320 self.tr("Select Patch"), |
336 self.tr("Select Patch"), |
321 self.tr("""No patches to select from.""")) |
337 self.tr("""No patches to select from."""), |
|
338 ) |
322 return False |
339 return False |
323 |
340 |
324 dia = HgDialog(title, self.vcs) |
341 dia = HgDialog(title, self.vcs) |
325 res = dia.startProcess(args) |
342 res = dia.startProcess(args) |
326 if res: |
343 if res: |
327 dia.exec() |
344 dia.exec() |
328 res = dia.hasAddOrDelete() |
345 res = dia.hasAddOrDelete() |
329 self.vcs.checkVCSStatus() |
346 self.vcs.checkVCSStatus() |
330 return res |
347 return res |
331 |
348 |
332 def hgQueueListPatches(self): |
349 def hgQueueListPatches(self): |
333 """ |
350 """ |
334 Public method to show a list of all patches. |
351 Public method to show a list of all patches. |
335 """ |
352 """ |
336 from .HgQueuesListDialog import HgQueuesListDialog |
353 from .HgQueuesListDialog import HgQueuesListDialog |
|
354 |
337 self.queuesListDialog = HgQueuesListDialog(self.vcs) |
355 self.queuesListDialog = HgQueuesListDialog(self.vcs) |
338 self.queuesListDialog.show() |
356 self.queuesListDialog.show() |
339 self.queuesListDialog.start() |
357 self.queuesListDialog.start() |
340 |
358 |
341 def hgQueueFinishAppliedPatches(self): |
359 def hgQueueFinishAppliedPatches(self): |
342 """ |
360 """ |
343 Public method to finish all applied patches. |
361 Public method to finish all applied patches. |
344 """ |
362 """ |
345 args = self.vcs.initCommand("qfinish") |
363 args = self.vcs.initCommand("qfinish") |
346 args.append("--applied") |
364 args.append("--applied") |
347 |
365 |
348 dia = HgDialog(self.tr('Finish Applied Patches'), self.vcs) |
366 dia = HgDialog(self.tr("Finish Applied Patches"), self.vcs) |
349 res = dia.startProcess(args) |
367 res = dia.startProcess(args) |
350 if res: |
368 if res: |
351 dia.exec() |
369 dia.exec() |
352 self.vcs.checkVCSStatus() |
370 self.vcs.checkVCSStatus() |
353 |
371 |
354 def hgQueueRenamePatch(self): |
372 def hgQueueRenamePatch(self): |
355 """ |
373 """ |
356 Public method to rename the current or a selected patch. |
374 Public method to rename the current or a selected patch. |
357 """ |
375 """ |
358 args = self.vcs.initCommand("qrename") |
376 args = self.vcs.initCommand("qrename") |
359 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
377 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
360 if patchnames: |
378 if patchnames: |
361 currentPatch = self.__getCurrentPatch() |
379 currentPatch = self.__getCurrentPatch() |
362 if currentPatch: |
380 if currentPatch: |
363 from .HgQueuesRenamePatchDialog import ( |
381 from .HgQueuesRenamePatchDialog import HgQueuesRenamePatchDialog |
364 HgQueuesRenamePatchDialog |
382 |
365 ) |
|
366 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
383 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
367 if dlg.exec() == QDialog.DialogCode.Accepted: |
384 if dlg.exec() == QDialog.DialogCode.Accepted: |
368 newName, selectedPatch = dlg.getData() |
385 newName, selectedPatch = dlg.getData() |
369 if selectedPatch: |
386 if selectedPatch: |
370 args.append(selectedPatch) |
387 args.append(selectedPatch) |
371 args.append(newName) |
388 args.append(newName) |
372 |
389 |
373 dia = HgDialog(self.tr("Rename Patch"), self.vcs) |
390 dia = HgDialog(self.tr("Rename Patch"), self.vcs) |
374 res = dia.startProcess(args) |
391 res = dia.startProcess(args) |
375 if res: |
392 if res: |
376 dia.exec() |
393 dia.exec() |
377 |
394 |
378 def hgQueueDeletePatch(self): |
395 def hgQueueDeletePatch(self): |
379 """ |
396 """ |
380 Public method to delete a selected unapplied patch. |
397 Public method to delete a selected unapplied patch. |
381 """ |
398 """ |
382 args = self.vcs.initCommand("qdelete") |
399 args = self.vcs.initCommand("qdelete") |
385 patch, ok = QInputDialog.getItem( |
402 patch, ok = QInputDialog.getItem( |
386 None, |
403 None, |
387 self.tr("Select Patch"), |
404 self.tr("Select Patch"), |
388 self.tr("Select the patch to be deleted:"), |
405 self.tr("Select the patch to be deleted:"), |
389 patchnames, |
406 patchnames, |
390 0, False) |
407 0, |
|
408 False, |
|
409 ) |
391 if ok and patch: |
410 if ok and patch: |
392 args.append(patch) |
411 args.append(patch) |
393 |
412 |
394 dia = HgDialog(self.tr("Delete Patch"), self.vcs) |
413 dia = HgDialog(self.tr("Delete Patch"), self.vcs) |
395 res = dia.startProcess(args) |
414 res = dia.startProcess(args) |
396 if res: |
415 if res: |
397 dia.exec() |
416 dia.exec() |
398 else: |
417 else: |
399 EricMessageBox.information( |
418 EricMessageBox.information( |
400 None, |
419 None, self.tr("Select Patch"), self.tr("""No patches to select from.""") |
401 self.tr("Select Patch"), |
420 ) |
402 self.tr("""No patches to select from.""")) |
421 |
403 |
|
404 def hgQueueFoldUnappliedPatches(self): |
422 def hgQueueFoldUnappliedPatches(self): |
405 """ |
423 """ |
406 Public method to fold patches into the current patch. |
424 Public method to fold patches into the current patch. |
407 """ |
425 """ |
408 args = self.vcs.initCommand("qfold") |
426 args = self.vcs.initCommand("qfold") |
409 patchnames = sorted( |
427 patchnames = sorted( |
410 self.__getPatchesList(Queues.UNAPPLIED_LIST, withSummary=True)) |
428 self.__getPatchesList(Queues.UNAPPLIED_LIST, withSummary=True) |
|
429 ) |
411 if patchnames: |
430 if patchnames: |
412 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
431 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
|
432 |
413 dlg = HgQueuesFoldDialog(patchnames) |
433 dlg = HgQueuesFoldDialog(patchnames) |
414 if dlg.exec() == QDialog.DialogCode.Accepted: |
434 if dlg.exec() == QDialog.DialogCode.Accepted: |
415 message, patchesList = dlg.getData() |
435 message, patchesList = dlg.getData() |
416 if message: |
436 if message: |
417 args.append("--message") |
437 args.append("--message") |
418 args.append(message) |
438 args.append(message) |
419 if patchesList: |
439 if patchesList: |
420 args.extend(patchesList) |
440 args.extend(patchesList) |
421 |
441 |
422 dia = HgDialog(self.tr("Fold Patches"), self.vcs) |
442 dia = HgDialog(self.tr("Fold Patches"), self.vcs) |
423 res = dia.startProcess(args) |
443 res = dia.startProcess(args) |
424 if res: |
444 if res: |
425 dia.exec() |
445 dia.exec() |
426 else: |
446 else: |
427 EricMessageBox.information( |
447 EricMessageBox.information( |
428 None, |
448 None, |
429 self.tr("Fold Patches"), |
449 self.tr("Fold Patches"), |
430 self.tr("""No patches selected.""")) |
450 self.tr("""No patches selected."""), |
|
451 ) |
431 else: |
452 else: |
432 EricMessageBox.information( |
453 EricMessageBox.information( |
433 None, |
454 None, |
434 self.tr("Fold Patches"), |
455 self.tr("Fold Patches"), |
435 self.tr("""No patches available to be folded.""")) |
456 self.tr("""No patches available to be folded."""), |
436 |
457 ) |
|
458 |
437 def hgQueueGuardsList(self): |
459 def hgQueueGuardsList(self): |
438 """ |
460 """ |
439 Public method to list the guards for the current or a named patch. |
461 Public method to list the guards for the current or a named patch. |
440 """ |
462 """ |
441 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
463 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
442 if patchnames: |
464 if patchnames: |
443 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
465 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
444 self.queuesListGuardsDialog = HgQueuesListGuardsDialog( |
466 |
445 self.vcs, patchnames) |
467 self.queuesListGuardsDialog = HgQueuesListGuardsDialog(self.vcs, patchnames) |
446 self.queuesListGuardsDialog.show() |
468 self.queuesListGuardsDialog.show() |
447 self.queuesListGuardsDialog.start() |
469 self.queuesListGuardsDialog.start() |
448 else: |
470 else: |
449 EricMessageBox.information( |
471 EricMessageBox.information( |
450 None, |
472 None, |
451 self.tr("List Guards"), |
473 self.tr("List Guards"), |
452 self.tr("""No patches available to list guards for.""")) |
474 self.tr("""No patches available to list guards for."""), |
453 |
475 ) |
|
476 |
454 def hgQueueGuardsListAll(self): |
477 def hgQueueGuardsListAll(self): |
455 """ |
478 """ |
456 Public method to list all guards of all patches. |
479 Public method to list all guards of all patches. |
457 """ |
480 """ |
458 from .HgQueuesListAllGuardsDialog import HgQueuesListAllGuardsDialog |
481 from .HgQueuesListAllGuardsDialog import HgQueuesListAllGuardsDialog |
|
482 |
459 self.queuesListAllGuardsDialog = HgQueuesListAllGuardsDialog(self.vcs) |
483 self.queuesListAllGuardsDialog = HgQueuesListAllGuardsDialog(self.vcs) |
460 self.queuesListAllGuardsDialog.show() |
484 self.queuesListAllGuardsDialog.show() |
461 self.queuesListAllGuardsDialog.start() |
485 self.queuesListAllGuardsDialog.start() |
462 |
486 |
463 def hgQueueGuardsDefine(self): |
487 def hgQueueGuardsDefine(self): |
464 """ |
488 """ |
465 Public method to define guards for the current or a named patch. |
489 Public method to define guards for the current or a named patch. |
466 """ |
490 """ |
467 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
491 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
468 if patchnames: |
492 if patchnames: |
469 from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog |
493 from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog |
|
494 |
470 self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog( |
495 self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog( |
471 self.vcs, self, patchnames) |
496 self.vcs, self, patchnames |
|
497 ) |
472 self.queuesDefineGuardsDialog.show() |
498 self.queuesDefineGuardsDialog.show() |
473 self.queuesDefineGuardsDialog.start() |
499 self.queuesDefineGuardsDialog.start() |
474 else: |
500 else: |
475 EricMessageBox.information( |
501 EricMessageBox.information( |
476 None, |
502 None, |
477 self.tr("Define Guards"), |
503 self.tr("Define Guards"), |
478 self.tr("""No patches available to define guards for.""")) |
504 self.tr("""No patches available to define guards for."""), |
479 |
505 ) |
|
506 |
480 def hgQueueGuardsDropAll(self): |
507 def hgQueueGuardsDropAll(self): |
481 """ |
508 """ |
482 Public method to drop all guards of the current or a named patch. |
509 Public method to drop all guards of the current or a named patch. |
483 """ |
510 """ |
484 patchnames = sorted( |
511 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
485 self.__getPatchesList(Queues.SERIES_LIST)) |
|
486 if patchnames: |
512 if patchnames: |
487 patch, ok = QInputDialog.getItem( |
513 patch, ok = QInputDialog.getItem( |
488 None, |
514 None, |
489 self.tr("Drop All Guards"), |
515 self.tr("Drop All Guards"), |
490 self.tr("Select the patch to drop guards for" |
516 self.tr( |
491 " (leave empty for the current patch):"), |
517 "Select the patch to drop guards for" |
|
518 " (leave empty for the current patch):" |
|
519 ), |
492 [""] + patchnames, |
520 [""] + patchnames, |
493 0, False) |
521 0, |
|
522 False, |
|
523 ) |
494 if ok: |
524 if ok: |
495 args = self.vcs.initCommand("qguard") |
525 args = self.vcs.initCommand("qguard") |
496 if patch: |
526 if patch: |
497 args.append(patch) |
527 args.append(patch) |
498 args.append("--none") |
528 args.append("--none") |
499 |
529 |
500 client = self.vcs.getClient() |
530 client = self.vcs.getClient() |
501 client.runcommand(args) |
531 client.runcommand(args) |
502 else: |
532 else: |
503 EricMessageBox.information( |
533 EricMessageBox.information( |
504 None, |
534 None, |
505 self.tr("Drop All Guards"), |
535 self.tr("Drop All Guards"), |
506 self.tr("""No patches available to define guards for.""")) |
536 self.tr("""No patches available to define guards for."""), |
507 |
537 ) |
|
538 |
508 def hgQueueGuardsSetActive(self): |
539 def hgQueueGuardsSetActive(self): |
509 """ |
540 """ |
510 Public method to set the active guards. |
541 Public method to set the active guards. |
511 """ |
542 """ |
512 guardsList = self.getGuardsList() |
543 guardsList = self.getGuardsList() |
513 if guardsList: |
544 if guardsList: |
514 activeGuardsList = self.getGuardsList(allGuards=False) |
545 activeGuardsList = self.getGuardsList(allGuards=False) |
515 from .HgQueuesGuardsSelectionDialog import ( |
546 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
516 HgQueuesGuardsSelectionDialog |
547 |
517 ) |
|
518 dlg = HgQueuesGuardsSelectionDialog( |
548 dlg = HgQueuesGuardsSelectionDialog( |
519 guardsList, activeGuards=activeGuardsList, listOnly=False) |
549 guardsList, activeGuards=activeGuardsList, listOnly=False |
|
550 ) |
520 if dlg.exec() == QDialog.DialogCode.Accepted: |
551 if dlg.exec() == QDialog.DialogCode.Accepted: |
521 guards = dlg.getData() |
552 guards = dlg.getData() |
522 if guards: |
553 if guards: |
523 args = self.vcs.initCommand("qselect") |
554 args = self.vcs.initCommand("qselect") |
524 args.extend(guards) |
555 args.extend(guards) |
525 |
556 |
526 dia = HgDialog(self.tr('Set Active Guards'), self.vcs) |
557 dia = HgDialog(self.tr("Set Active Guards"), self.vcs) |
527 res = dia.startProcess(args) |
558 res = dia.startProcess(args) |
528 if res: |
559 if res: |
529 dia.exec() |
560 dia.exec() |
530 else: |
561 else: |
531 EricMessageBox.information( |
562 EricMessageBox.information( |
532 None, |
563 None, |
533 self.tr("Set Active Guards"), |
564 self.tr("Set Active Guards"), |
534 self.tr("""No guards available to select from.""")) |
565 self.tr("""No guards available to select from."""), |
|
566 ) |
535 return |
567 return |
536 |
568 |
537 def hgQueueGuardsDeactivate(self): |
569 def hgQueueGuardsDeactivate(self): |
538 """ |
570 """ |
539 Public method to deactivate all active guards. |
571 Public method to deactivate all active guards. |
540 """ |
572 """ |
541 args = self.vcs.initCommand("qselect") |
573 args = self.vcs.initCommand("qselect") |
542 args.append("--none") |
574 args.append("--none") |
543 |
575 |
544 dia = HgDialog(self.tr('Deactivate Guards'), self.vcs) |
576 dia = HgDialog(self.tr("Deactivate Guards"), self.vcs) |
545 res = dia.startProcess(args) |
577 res = dia.startProcess(args) |
546 if res: |
578 if res: |
547 dia.exec() |
579 dia.exec() |
548 |
580 |
549 def hgQueueGuardsIdentifyActive(self): |
581 def hgQueueGuardsIdentifyActive(self): |
550 """ |
582 """ |
551 Public method to list all active guards. |
583 Public method to list all active guards. |
552 """ |
584 """ |
553 guardsList = self.getGuardsList(allGuards=False) |
585 guardsList = self.getGuardsList(allGuards=False) |
554 if guardsList: |
586 if guardsList: |
555 from .HgQueuesGuardsSelectionDialog import ( |
587 from .HgQueuesGuardsSelectionDialog import HgQueuesGuardsSelectionDialog |
556 HgQueuesGuardsSelectionDialog |
588 |
557 ) |
|
558 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
589 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
559 dlg.exec() |
590 dlg.exec() |
560 |
591 |
561 def hgQueueCreateRenameQueue(self, isCreate): |
592 def hgQueueCreateRenameQueue(self, isCreate): |
562 """ |
593 """ |
563 Public method to create a new queue or rename the active queue. |
594 Public method to create a new queue or rename the active queue. |
564 |
595 |
565 @param isCreate flag indicating to create a new queue (boolean) |
596 @param isCreate flag indicating to create a new queue (boolean) |
566 """ |
597 """ |
567 from .HgQueuesQueueManagementDialog import ( |
598 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
568 HgQueuesQueueManagementDialog |
599 |
569 ) |
|
570 |
|
571 title = ( |
600 title = ( |
572 self.tr("Create New Queue") |
601 self.tr("Create New Queue") if isCreate else self.tr("Rename Active Queue") |
573 if isCreate else |
|
574 self.tr("Rename Active Queue") |
|
575 ) |
602 ) |
576 dlg = HgQueuesQueueManagementDialog( |
603 dlg = HgQueuesQueueManagementDialog( |
577 HgQueuesQueueManagementDialog.NAME_INPUT, |
604 HgQueuesQueueManagementDialog.NAME_INPUT, title, False, self.vcs |
578 title, False, self.vcs) |
605 ) |
579 if dlg.exec() == QDialog.DialogCode.Accepted: |
606 if dlg.exec() == QDialog.DialogCode.Accepted: |
580 queueName = dlg.getData() |
607 queueName = dlg.getData() |
581 if queueName: |
608 if queueName: |
582 args = self.vcs.initCommand("qqueue") |
609 args = self.vcs.initCommand("qqueue") |
583 if isCreate: |
610 if isCreate: |
584 args.append("--create") |
611 args.append("--create") |
585 else: |
612 else: |
586 args.append("--rename") |
613 args.append("--rename") |
587 args.append(queueName) |
614 args.append(queueName) |
588 |
615 |
589 client = self.vcs.getClient() |
616 client = self.vcs.getClient() |
590 error = client.runcommand(args)[1] |
617 error = client.runcommand(args)[1] |
591 |
618 |
592 if error: |
619 if error: |
593 if isCreate: |
620 if isCreate: |
594 errMsg = self.tr( |
621 errMsg = self.tr("Error while creating a new queue.") |
595 "Error while creating a new queue.") |
|
596 else: |
622 else: |
597 errMsg = self.tr( |
623 errMsg = self.tr("Error while renaming the active queue.") |
598 "Error while renaming the active queue.") |
|
599 EricMessageBox.warning( |
624 EricMessageBox.warning( |
600 None, |
625 None, title, """<p>{0}</p><p>{1}</p>""".format(errMsg, error) |
601 title, |
626 ) |
602 """<p>{0}</p><p>{1}</p>""".format(errMsg, error)) |
|
603 else: |
627 else: |
604 if ( |
628 if ( |
605 self.queuesListQueuesDialog is not None and |
629 self.queuesListQueuesDialog is not None |
606 self.queuesListQueuesDialog.isVisible() |
630 and self.queuesListQueuesDialog.isVisible() |
607 ): |
631 ): |
608 self.queuesListQueuesDialog.refresh() |
632 self.queuesListQueuesDialog.refresh() |
609 |
633 |
610 def hgQueueDeletePurgeActivateQueue(self, operation): |
634 def hgQueueDeletePurgeActivateQueue(self, operation): |
611 """ |
635 """ |
612 Public method to delete the reference to a queue and optionally |
636 Public method to delete the reference to a queue and optionally |
613 remove the patch directory or set the active queue. |
637 remove the patch directory or set the active queue. |
614 |
638 |
615 @param operation operation to be performed (Queues.QUEUE_DELETE, |
639 @param operation operation to be performed (Queues.QUEUE_DELETE, |
616 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
640 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
617 @exception ValueError raised to indicate an invalid operation |
641 @exception ValueError raised to indicate an invalid operation |
618 """ |
642 """ |
619 if operation not in (Queues.QUEUE_PURGE, Queues.QUEUE_DELETE, |
643 if operation not in ( |
620 Queues.QUEUE_ACTIVATE): |
644 Queues.QUEUE_PURGE, |
|
645 Queues.QUEUE_DELETE, |
|
646 Queues.QUEUE_ACTIVATE, |
|
647 ): |
621 raise ValueError("illegal value for operation") |
648 raise ValueError("illegal value for operation") |
622 |
649 |
623 if operation == Queues.QUEUE_PURGE: |
650 if operation == Queues.QUEUE_PURGE: |
624 title = self.tr("Purge Queue") |
651 title = self.tr("Purge Queue") |
625 elif operation == Queues.QUEUE_DELETE: |
652 elif operation == Queues.QUEUE_DELETE: |
626 title = self.tr("Delete Queue") |
653 title = self.tr("Delete Queue") |
627 else: |
654 else: |
628 title = self.tr("Activate Queue") |
655 title = self.tr("Activate Queue") |
629 |
656 |
630 from .HgQueuesQueueManagementDialog import ( |
657 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
631 HgQueuesQueueManagementDialog |
658 |
|
659 dlg = HgQueuesQueueManagementDialog( |
|
660 HgQueuesQueueManagementDialog.QUEUE_INPUT, title, True, self.vcs |
632 ) |
661 ) |
633 dlg = HgQueuesQueueManagementDialog( |
|
634 HgQueuesQueueManagementDialog.QUEUE_INPUT, |
|
635 title, True, self.vcs) |
|
636 if dlg.exec() == QDialog.DialogCode.Accepted: |
662 if dlg.exec() == QDialog.DialogCode.Accepted: |
637 queueName = dlg.getData() |
663 queueName = dlg.getData() |
638 if queueName: |
664 if queueName: |
639 args = self.vcs.initCommand("qqueue") |
665 args = self.vcs.initCommand("qqueue") |
640 if operation == Queues.QUEUE_PURGE: |
666 if operation == Queues.QUEUE_PURGE: |
641 args.append("--purge") |
667 args.append("--purge") |
642 elif operation == Queues.QUEUE_DELETE: |
668 elif operation == Queues.QUEUE_DELETE: |
643 args.append("--delete") |
669 args.append("--delete") |
644 args.append(queueName) |
670 args.append(queueName) |
645 |
671 |
646 client = self.vcs.getClient() |
672 client = self.vcs.getClient() |
647 error = client.runcommand(args)[1] |
673 error = client.runcommand(args)[1] |
648 |
674 |
649 if error: |
675 if error: |
650 if operation == Queues.QUEUE_PURGE: |
676 if operation == Queues.QUEUE_PURGE: |
651 errMsg = self.tr("Error while purging the queue.") |
677 errMsg = self.tr("Error while purging the queue.") |
652 elif operation == Queues.QUEUE_DELETE: |
678 elif operation == Queues.QUEUE_DELETE: |
653 errMsg = self.tr("Error while deleting the queue.") |
679 errMsg = self.tr("Error while deleting the queue.") |
654 elif operation == Queues.QUEUE_ACTIVATE: |
680 elif operation == Queues.QUEUE_ACTIVATE: |
655 errMsg = self.tr( |
681 errMsg = self.tr("Error while setting the active queue.") |
656 "Error while setting the active queue.") |
|
657 EricMessageBox.warning( |
682 EricMessageBox.warning( |
658 None, |
683 None, title, """<p>{0}</p><p>{1}</p>""".format(errMsg, error) |
659 title, |
684 ) |
660 """<p>{0}</p><p>{1}</p>""".format(errMsg, error)) |
|
661 else: |
685 else: |
662 if ( |
686 if ( |
663 self.queuesListQueuesDialog is not None and |
687 self.queuesListQueuesDialog is not None |
664 self.queuesListQueuesDialog.isVisible() |
688 and self.queuesListQueuesDialog.isVisible() |
665 ): |
689 ): |
666 self.queuesListQueuesDialog.refresh() |
690 self.queuesListQueuesDialog.refresh() |
667 |
691 |
668 def hgQueueListQueues(self): |
692 def hgQueueListQueues(self): |
669 """ |
693 """ |
670 Public method to list available queues. |
694 Public method to list available queues. |
671 """ |
695 """ |
672 from .HgQueuesQueueManagementDialog import ( |
696 from .HgQueuesQueueManagementDialog import HgQueuesQueueManagementDialog |
673 HgQueuesQueueManagementDialog |
697 |
674 ) |
|
675 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
698 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
676 HgQueuesQueueManagementDialog.NO_INPUT, |
699 HgQueuesQueueManagementDialog.NO_INPUT, |
677 self.tr("Available Queues"), |
700 self.tr("Available Queues"), |
678 False, self.vcs) |
701 False, |
|
702 self.vcs, |
|
703 ) |
679 self.queuesListQueuesDialog.show() |
704 self.queuesListQueuesDialog.show() |
680 |
705 |
681 def hgQueueInit(self, name): |
706 def hgQueueInit(self, name): |
682 """ |
707 """ |
683 Public method to initialize a new queue repository. |
708 Public method to initialize a new queue repository. |
684 |
709 |
685 @param name directory name (string) |
710 @param name directory name (string) |
686 """ |
711 """ |
687 args = self.vcs.initCommand("init") |
712 args = self.vcs.initCommand("init") |
688 args.append('--mq') |
713 args.append("--mq") |
689 args.append(self.vcs.getClient().getRepository()) |
714 args.append(self.vcs.getClient().getRepository()) |
690 # init is not possible with the command server |
715 # init is not possible with the command server |
691 dia = HgDialog( |
716 dia = HgDialog(self.tr("Initializing new queue repository"), self.vcs) |
692 self.tr('Initializing new queue repository'), self.vcs) |
|
693 res = dia.startProcess(args) |
717 res = dia.startProcess(args) |
694 if res: |
718 if res: |
695 dia.exec() |
719 dia.exec() |
696 |
720 |
697 def hgQueueStatus(self, name): |
721 def hgQueueStatus(self, name): |
698 """ |
722 """ |
699 Public method used to view the status of a queue repository. |
723 Public method used to view the status of a queue repository. |
700 |
724 |
701 @param name directory name (string) |
725 @param name directory name (string) |
702 """ |
726 """ |
703 from ..HgStatusDialog import HgStatusDialog |
727 from ..HgStatusDialog import HgStatusDialog |
|
728 |
704 self.queueStatusDialog = HgStatusDialog(self.vcs, mq=True) |
729 self.queueStatusDialog = HgStatusDialog(self.vcs, mq=True) |
705 self.queueStatusDialog.show() |
730 self.queueStatusDialog.show() |
706 self.queueStatusDialog.start(name) |
731 self.queueStatusDialog.start(name) |