69 if self.queuesListQueuesDialog is not None: |
67 if self.queuesListQueuesDialog is not None: |
70 self.queuesListQueuesDialog.close() |
68 self.queuesListQueuesDialog.close() |
71 if self.queueStatusDialog is not None: |
69 if self.queueStatusDialog is not None: |
72 self.queueStatusDialog.close() |
70 self.queueStatusDialog.close() |
73 |
71 |
74 def __getPatchesList(self, repodir, listType, withSummary=False): |
72 def __getPatchesList(self, listType, withSummary=False): |
75 """ |
73 """ |
76 Private method to get a list of patches of a given type. |
74 Private method to get a list of patches of a given type. |
77 |
75 |
78 @param repodir directory name of the repository (string) |
|
79 @param listType type of patches list to get |
76 @param listType type of patches list to get |
80 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
77 (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, Queues.SERIES_LIST) |
81 @param withSummary flag indicating to get a summary as well (boolean) |
78 @param withSummary flag indicating to get a summary as well (boolean) |
82 @return list of patches (list of string) |
79 @return list of patches (list of string) |
83 @exception ValueError raised to indicate an invalid patch list type |
80 @exception ValueError raised to indicate an invalid patch list type |
167 if guard not in guardsList: |
161 if guard not in guardsList: |
168 guardsList.append(guard) |
162 guardsList.append(guard) |
169 |
163 |
170 return sorted(guardsList) |
164 return sorted(guardsList) |
171 |
165 |
172 def hgQueueNewPatch(self, name): |
166 def hgQueueNewPatch(self): |
173 """ |
167 """ |
174 Public method to create a new named patch. |
168 Public method to create a new named patch. |
175 |
169 """ |
176 @param name file/directory name (string) |
|
177 """ |
|
178 # find the root of the repo |
|
179 repodir = self.vcs.splitPath(name)[0] |
|
180 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
181 repodir = os.path.dirname(repodir) |
|
182 if os.path.splitdrive(repodir)[1] == os.sep: |
|
183 return |
|
184 |
|
185 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
170 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
186 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE) |
171 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.NEW_MODE) |
187 if dlg.exec() == QDialog.Accepted: |
172 if dlg.exec() == QDialog.Accepted: |
188 (name, message, |
173 (name, message, |
189 (userData, currentUser, userName), |
174 (userData, currentUser, userName), |
206 args.append("--date") |
191 args.append("--date") |
207 args.append(dateStr) |
192 args.append(dateStr) |
208 args.append(name) |
193 args.append(name) |
209 |
194 |
210 dia = HgDialog(self.tr('New Patch'), self.vcs) |
195 dia = HgDialog(self.tr('New Patch'), self.vcs) |
211 res = dia.startProcess(args, repodir) |
196 res = dia.startProcess(args) |
212 if res: |
197 if res: |
213 dia.exec() |
198 dia.exec() |
214 self.vcs.checkVCSStatus() |
199 self.vcs.checkVCSStatus() |
215 |
200 |
216 def hgQueueRefreshPatch(self, name, editMessage=False): |
201 def hgQueueRefreshPatch(self, editMessage=False): |
217 """ |
202 """ |
218 Public method to refresh the current patch. |
203 Public method to refresh the current patch. |
219 |
204 |
220 @param name file/directory name (string) |
|
221 @param editMessage flag indicating to edit the current |
205 @param editMessage flag indicating to edit the current |
222 commit message (boolean) |
206 commit message (boolean) |
223 """ |
207 """ |
224 # find the root of the repo |
|
225 repodir = self.vcs.splitPath(name)[0] |
|
226 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
227 repodir = os.path.dirname(repodir) |
|
228 if os.path.splitdrive(repodir)[1] == os.sep: |
|
229 return |
|
230 |
|
231 args = self.vcs.initCommand("qrefresh") |
208 args = self.vcs.initCommand("qrefresh") |
232 |
209 |
233 if editMessage: |
210 if editMessage: |
234 currentMessage = self.__getCommitMessage(repodir) |
211 currentMessage = self.__getCommitMessage() |
235 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
212 from .HgQueuesNewPatchDialog import HgQueuesNewPatchDialog |
236 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.REFRESH_MODE, |
213 dlg = HgQueuesNewPatchDialog(HgQueuesNewPatchDialog.REFRESH_MODE, |
237 currentMessage) |
214 currentMessage) |
238 if dlg.exec() == QDialog.Accepted: |
215 if dlg.exec() == QDialog.Accepted: |
239 (name, message, |
216 (name, message, |
273 self.qdiffDialog = HgDiffDialog(self.vcs) |
250 self.qdiffDialog = HgDiffDialog(self.vcs) |
274 self.qdiffDialog.show() |
251 self.qdiffDialog.show() |
275 QApplication.processEvents() |
252 QApplication.processEvents() |
276 self.qdiffDialog.start(name, qdiff=True) |
253 self.qdiffDialog.start(name, qdiff=True) |
277 |
254 |
278 def hgQueueShowHeader(self, name): |
255 def hgQueueShowHeader(self): |
279 """ |
256 """ |
280 Public method to show the commit message of the current patch. |
257 Public method to show the commit message of the current patch. |
281 |
|
282 @param name file/directory name (string) |
|
283 """ |
258 """ |
284 from .HgQueuesHeaderDialog import HgQueuesHeaderDialog |
259 from .HgQueuesHeaderDialog import HgQueuesHeaderDialog |
285 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
260 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
286 self.qheaderDialog.show() |
261 self.qheaderDialog.show() |
287 QApplication.processEvents() |
262 QApplication.processEvents() |
288 self.qheaderDialog.start(name) |
263 self.qheaderDialog.start() |
289 |
264 |
290 def hgQueuePushPopPatches(self, name, operation, doAll=False, named=False, |
265 def hgQueuePushPopPatches(self, operation, doAll=False, named=False, |
291 force=False): |
266 force=False): |
292 """ |
267 """ |
293 Public method to push patches onto the stack or pop patches off the |
268 Public method to push patches onto the stack or pop patches off the |
294 stack. |
269 stack. |
295 |
270 |
296 @param name file/directory name (string) |
|
297 @param operation operation type to be performed (Queues.POP, |
271 @param operation operation type to be performed (Queues.POP, |
298 Queues.PUSH, Queues.GOTO) |
272 Queues.PUSH, Queues.GOTO) |
299 @keyparam doAll flag indicating to push/pop all (boolean) |
273 @param doAll flag indicating to push/pop all (boolean) |
300 @keyparam named flag indicating to push/pop until a named patch |
274 @param named flag indicating to push/pop until a named patch |
301 is at the top of the stack (boolean) |
275 is at the top of the stack (boolean) |
302 @keyparam force flag indicating a forceful pop (boolean) |
276 @param force flag indicating a forceful pop (boolean) |
303 @return flag indicating that the project should be reread (boolean) |
277 @return flag indicating that the project should be reread (boolean) |
304 @exception ValueError raised to indicate an invalid operation |
278 @exception ValueError raised to indicate an invalid operation |
305 """ |
279 """ |
306 # find the root of the repo |
|
307 repodir = self.vcs.splitPath(name)[0] |
|
308 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
309 repodir = os.path.dirname(repodir) |
|
310 if os.path.splitdrive(repodir)[1] == os.sep: |
|
311 return False |
|
312 |
|
313 if operation == Queues.POP: |
280 if operation == Queues.POP: |
314 args = self.vcs.initCommand("qpop") |
281 args = self.vcs.initCommand("qpop") |
315 title = self.tr("Pop Patches") |
282 title = self.tr("Pop Patches") |
316 listType = Queues.APPLIED_LIST |
283 listType = Queues.APPLIED_LIST |
317 elif operation == Queues.PUSH: |
284 elif operation == Queues.PUSH: |
348 self.tr("Select Patch"), |
315 self.tr("Select Patch"), |
349 self.tr("""No patches to select from.""")) |
316 self.tr("""No patches to select from.""")) |
350 return False |
317 return False |
351 |
318 |
352 dia = HgDialog(title, self.vcs) |
319 dia = HgDialog(title, self.vcs) |
353 res = dia.startProcess(args, repodir) |
320 res = dia.startProcess(args) |
354 if res: |
321 if res: |
355 dia.exec() |
322 dia.exec() |
356 res = dia.hasAddOrDelete() |
323 res = dia.hasAddOrDelete() |
357 self.vcs.checkVCSStatus() |
324 self.vcs.checkVCSStatus() |
358 return res |
325 return res |
359 |
326 |
360 def hgQueueListPatches(self, name): |
327 def hgQueueListPatches(self): |
361 """ |
328 """ |
362 Public method to show a list of all patches. |
329 Public method to show a list of all patches. |
363 |
|
364 @param name file/directory name (string) |
|
365 """ |
330 """ |
366 from .HgQueuesListDialog import HgQueuesListDialog |
331 from .HgQueuesListDialog import HgQueuesListDialog |
367 self.queuesListDialog = HgQueuesListDialog(self.vcs) |
332 self.queuesListDialog = HgQueuesListDialog(self.vcs) |
368 self.queuesListDialog.show() |
333 self.queuesListDialog.show() |
369 self.queuesListDialog.start(name) |
334 self.queuesListDialog.start() |
370 |
335 |
371 def hgQueueFinishAppliedPatches(self, name): |
336 def hgQueueFinishAppliedPatches(self): |
372 """ |
337 """ |
373 Public method to finish all applied patches. |
338 Public method to finish all applied patches. |
374 |
339 """ |
375 @param name file/directory name (string) |
|
376 """ |
|
377 # find the root of the repo |
|
378 repodir = self.vcs.splitPath(name)[0] |
|
379 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
380 repodir = os.path.dirname(repodir) |
|
381 if os.path.splitdrive(repodir)[1] == os.sep: |
|
382 return |
|
383 |
|
384 args = self.vcs.initCommand("qfinish") |
340 args = self.vcs.initCommand("qfinish") |
385 args.append("--applied") |
341 args.append("--applied") |
386 |
342 |
387 dia = HgDialog(self.tr('Finish Applied Patches'), self.vcs) |
343 dia = HgDialog(self.tr('Finish Applied Patches'), self.vcs) |
388 res = dia.startProcess(args, repodir) |
344 res = dia.startProcess(args) |
389 if res: |
345 if res: |
390 dia.exec() |
346 dia.exec() |
391 self.vcs.checkVCSStatus() |
347 self.vcs.checkVCSStatus() |
392 |
348 |
393 def hgQueueRenamePatch(self, name): |
349 def hgQueueRenamePatch(self): |
394 """ |
350 """ |
395 Public method to rename the current or a selected patch. |
351 Public method to rename the current or a selected patch. |
396 |
352 """ |
397 @param name file/directory name (string) |
|
398 """ |
|
399 # find the root of the repo |
|
400 repodir = self.vcs.splitPath(name)[0] |
|
401 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
402 repodir = os.path.dirname(repodir) |
|
403 if os.path.splitdrive(repodir)[1] == os.sep: |
|
404 return |
|
405 |
|
406 args = self.vcs.initCommand("qrename") |
353 args = self.vcs.initCommand("qrename") |
407 patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
354 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
408 if patchnames: |
355 if patchnames: |
409 currentPatch = self.__getCurrentPatch(repodir) |
356 currentPatch = self.__getCurrentPatch() |
410 if currentPatch: |
357 if currentPatch: |
411 from .HgQueuesRenamePatchDialog import ( |
358 from .HgQueuesRenamePatchDialog import ( |
412 HgQueuesRenamePatchDialog |
359 HgQueuesRenamePatchDialog |
413 ) |
360 ) |
414 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
361 dlg = HgQueuesRenamePatchDialog(currentPatch, patchnames) |
417 if selectedPatch: |
364 if selectedPatch: |
418 args.append(selectedPatch) |
365 args.append(selectedPatch) |
419 args.append(newName) |
366 args.append(newName) |
420 |
367 |
421 dia = HgDialog(self.tr("Rename Patch"), self.vcs) |
368 dia = HgDialog(self.tr("Rename Patch"), self.vcs) |
422 res = dia.startProcess(args, repodir) |
369 res = dia.startProcess(args) |
423 if res: |
370 if res: |
424 dia.exec() |
371 dia.exec() |
425 |
372 |
426 def hgQueueDeletePatch(self, name): |
373 def hgQueueDeletePatch(self): |
427 """ |
374 """ |
428 Public method to delete a selected unapplied patch. |
375 Public method to delete a selected unapplied patch. |
429 |
376 """ |
430 @param name file/directory name (string) |
|
431 """ |
|
432 # find the root of the repo |
|
433 repodir = self.vcs.splitPath(name)[0] |
|
434 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
435 repodir = os.path.dirname(repodir) |
|
436 if os.path.splitdrive(repodir)[1] == os.sep: |
|
437 return |
|
438 |
|
439 args = self.vcs.initCommand("qdelete") |
377 args = self.vcs.initCommand("qdelete") |
440 patchnames = sorted(self.__getPatchesList(repodir, |
378 patchnames = sorted(self.__getPatchesList(Queues.UNAPPLIED_LIST)) |
441 Queues.UNAPPLIED_LIST)) |
|
442 if patchnames: |
379 if patchnames: |
443 patch, ok = QInputDialog.getItem( |
380 patch, ok = QInputDialog.getItem( |
444 None, |
381 None, |
445 self.tr("Select Patch"), |
382 self.tr("Select Patch"), |
446 self.tr("Select the patch to be deleted:"), |
383 self.tr("Select the patch to be deleted:"), |
448 0, False) |
385 0, False) |
449 if ok and patch: |
386 if ok and patch: |
450 args.append(patch) |
387 args.append(patch) |
451 |
388 |
452 dia = HgDialog(self.tr("Delete Patch"), self.vcs) |
389 dia = HgDialog(self.tr("Delete Patch"), self.vcs) |
453 res = dia.startProcess(args, repodir) |
390 res = dia.startProcess(args) |
454 if res: |
391 if res: |
455 dia.exec() |
392 dia.exec() |
456 else: |
393 else: |
457 E5MessageBox.information( |
394 E5MessageBox.information( |
458 None, |
395 None, |
459 self.tr("Select Patch"), |
396 self.tr("Select Patch"), |
460 self.tr("""No patches to select from.""")) |
397 self.tr("""No patches to select from.""")) |
461 |
398 |
462 def hgQueueFoldUnappliedPatches(self, name): |
399 def hgQueueFoldUnappliedPatches(self): |
463 """ |
400 """ |
464 Public method to fold patches into the current patch. |
401 Public method to fold patches into the current patch. |
465 |
402 """ |
466 @param name file/directory name (string) |
|
467 """ |
|
468 # find the root of the repo |
|
469 repodir = self.vcs.splitPath(name)[0] |
|
470 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
471 repodir = os.path.dirname(repodir) |
|
472 if os.path.splitdrive(repodir)[1] == os.sep: |
|
473 return |
|
474 |
|
475 args = self.vcs.initCommand("qfold") |
403 args = self.vcs.initCommand("qfold") |
476 patchnames = sorted( |
404 patchnames = sorted( |
477 self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST, |
405 self.__getPatchesList(Queues.UNAPPLIED_LIST, withSummary=True)) |
478 withSummary=True)) |
|
479 if patchnames: |
406 if patchnames: |
480 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
407 from .HgQueuesFoldDialog import HgQueuesFoldDialog |
481 dlg = HgQueuesFoldDialog(patchnames) |
408 dlg = HgQueuesFoldDialog(patchnames) |
482 if dlg.exec() == QDialog.Accepted: |
409 if dlg.exec() == QDialog.Accepted: |
483 message, patchesList = dlg.getData() |
410 message, patchesList = dlg.getData() |
500 E5MessageBox.information( |
427 E5MessageBox.information( |
501 None, |
428 None, |
502 self.tr("Fold Patches"), |
429 self.tr("Fold Patches"), |
503 self.tr("""No patches available to be folded.""")) |
430 self.tr("""No patches available to be folded.""")) |
504 |
431 |
505 def hgQueueGuardsList(self, name): |
432 def hgQueueGuardsList(self): |
506 """ |
433 """ |
507 Public method to list the guards for the current or a named patch. |
434 Public method to list the guards for the current or a named patch. |
508 |
435 """ |
509 @param name file/directory name (string) |
436 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
510 """ |
|
511 # find the root of the repo |
|
512 repodir = self.vcs.splitPath(name)[0] |
|
513 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
514 repodir = os.path.dirname(repodir) |
|
515 if os.path.splitdrive(repodir)[1] == os.sep: |
|
516 return |
|
517 |
|
518 patchnames = sorted( |
|
519 self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
|
520 if patchnames: |
437 if patchnames: |
521 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
438 from .HgQueuesListGuardsDialog import HgQueuesListGuardsDialog |
522 self.queuesListGuardsDialog = HgQueuesListGuardsDialog( |
439 self.queuesListGuardsDialog = HgQueuesListGuardsDialog( |
523 self.vcs, patchnames) |
440 self.vcs, patchnames) |
524 self.queuesListGuardsDialog.show() |
441 self.queuesListGuardsDialog.show() |
525 self.queuesListGuardsDialog.start(name) |
442 self.queuesListGuardsDialog.start() |
526 else: |
443 else: |
527 E5MessageBox.information( |
444 E5MessageBox.information( |
528 None, |
445 None, |
529 self.tr("List Guards"), |
446 self.tr("List Guards"), |
530 self.tr("""No patches available to list guards for.""")) |
447 self.tr("""No patches available to list guards for.""")) |
531 |
448 |
532 def hgQueueGuardsListAll(self, name): |
449 def hgQueueGuardsListAll(self): |
533 """ |
450 """ |
534 Public method to list all guards of all patches. |
451 Public method to list all guards of all patches. |
535 |
|
536 @param name file/directory name (string) |
|
537 """ |
452 """ |
538 from .HgQueuesListAllGuardsDialog import HgQueuesListAllGuardsDialog |
453 from .HgQueuesListAllGuardsDialog import HgQueuesListAllGuardsDialog |
539 self.queuesListAllGuardsDialog = HgQueuesListAllGuardsDialog(self.vcs) |
454 self.queuesListAllGuardsDialog = HgQueuesListAllGuardsDialog(self.vcs) |
540 self.queuesListAllGuardsDialog.show() |
455 self.queuesListAllGuardsDialog.show() |
541 self.queuesListAllGuardsDialog.start(name) |
456 self.queuesListAllGuardsDialog.start() |
542 |
457 |
543 def hgQueueGuardsDefine(self, name): |
458 def hgQueueGuardsDefine(self): |
544 """ |
459 """ |
545 Public method to define guards for the current or a named patch. |
460 Public method to define guards for the current or a named patch. |
546 |
461 """ |
547 @param name file/directory name (string) |
462 patchnames = sorted(self.__getPatchesList(Queues.SERIES_LIST)) |
548 """ |
|
549 # find the root of the repo |
|
550 repodir = self.vcs.splitPath(name)[0] |
|
551 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
552 repodir = os.path.dirname(repodir) |
|
553 if os.path.splitdrive(repodir)[1] == os.sep: |
|
554 return |
|
555 |
|
556 patchnames = sorted( |
|
557 self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
|
558 if patchnames: |
463 if patchnames: |
559 from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog |
464 from .HgQueuesDefineGuardsDialog import HgQueuesDefineGuardsDialog |
560 self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog( |
465 self.queuesDefineGuardsDialog = HgQueuesDefineGuardsDialog( |
561 self.vcs, self, patchnames) |
466 self.vcs, self, patchnames) |
562 self.queuesDefineGuardsDialog.show() |
467 self.queuesDefineGuardsDialog.show() |
563 self.queuesDefineGuardsDialog.start(name) |
468 self.queuesDefineGuardsDialog.start() |
564 else: |
469 else: |
565 E5MessageBox.information( |
470 E5MessageBox.information( |
566 None, |
471 None, |
567 self.tr("Define Guards"), |
472 self.tr("Define Guards"), |
568 self.tr("""No patches available to define guards for.""")) |
473 self.tr("""No patches available to define guards for.""")) |
569 |
474 |
570 def hgQueueGuardsDropAll(self, name): |
475 def hgQueueGuardsDropAll(self): |
571 """ |
476 """ |
572 Public method to drop all guards of the current or a named patch. |
477 Public method to drop all guards of the current or a named patch. |
573 |
478 """ |
574 @param name file/directory name (string) |
|
575 """ |
|
576 # find the root of the repo |
|
577 repodir = self.vcs.splitPath(name)[0] |
|
578 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
579 repodir = os.path.dirname(repodir) |
|
580 if os.path.splitdrive(repodir)[1] == os.sep: |
|
581 return |
|
582 |
|
583 patchnames = sorted( |
479 patchnames = sorted( |
584 self.__getPatchesList(repodir, Queues.SERIES_LIST)) |
480 self.__getPatchesList(Queues.SERIES_LIST)) |
585 if patchnames: |
481 if patchnames: |
586 patch, ok = QInputDialog.getItem( |
482 patch, ok = QInputDialog.getItem( |
587 None, |
483 None, |
588 self.tr("Drop All Guards"), |
484 self.tr("Drop All Guards"), |
589 self.tr("Select the patch to drop guards for" |
485 self.tr("Select the patch to drop guards for" |
602 E5MessageBox.information( |
498 E5MessageBox.information( |
603 None, |
499 None, |
604 self.tr("Drop All Guards"), |
500 self.tr("Drop All Guards"), |
605 self.tr("""No patches available to define guards for.""")) |
501 self.tr("""No patches available to define guards for.""")) |
606 |
502 |
607 def hgQueueGuardsSetActive(self, name): |
503 def hgQueueGuardsSetActive(self): |
608 """ |
504 """ |
609 Public method to set the active guards. |
505 Public method to set the active guards. |
610 |
506 """ |
611 @param name file/directory name (string) |
507 guardsList = self.getGuardsList() |
612 """ |
|
613 # find the root of the repo |
|
614 repodir = self.vcs.splitPath(name)[0] |
|
615 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
616 repodir = os.path.dirname(repodir) |
|
617 if os.path.splitdrive(repodir)[1] == os.sep: |
|
618 return |
|
619 |
|
620 guardsList = self.getGuardsList(repodir) |
|
621 if guardsList: |
508 if guardsList: |
622 activeGuardsList = self.getGuardsList(repodir, allGuards=False) |
509 activeGuardsList = self.getGuardsList(allGuards=False) |
623 from .HgQueuesGuardsSelectionDialog import ( |
510 from .HgQueuesGuardsSelectionDialog import ( |
624 HgQueuesGuardsSelectionDialog |
511 HgQueuesGuardsSelectionDialog |
625 ) |
512 ) |
626 dlg = HgQueuesGuardsSelectionDialog( |
513 dlg = HgQueuesGuardsSelectionDialog( |
627 guardsList, activeGuards=activeGuardsList, listOnly=False) |
514 guardsList, activeGuards=activeGuardsList, listOnly=False) |
630 if guards: |
517 if guards: |
631 args = self.vcs.initCommand("qselect") |
518 args = self.vcs.initCommand("qselect") |
632 args.extend(guards) |
519 args.extend(guards) |
633 |
520 |
634 dia = HgDialog(self.tr('Set Active Guards'), self.vcs) |
521 dia = HgDialog(self.tr('Set Active Guards'), self.vcs) |
635 res = dia.startProcess(args, repodir) |
522 res = dia.startProcess(args) |
636 if res: |
523 if res: |
637 dia.exec() |
524 dia.exec() |
638 else: |
525 else: |
639 E5MessageBox.information( |
526 E5MessageBox.information( |
640 None, |
527 None, |
641 self.tr("Set Active Guards"), |
528 self.tr("Set Active Guards"), |
642 self.tr("""No guards available to select from.""")) |
529 self.tr("""No guards available to select from.""")) |
643 return |
530 return |
644 |
531 |
645 def hgQueueGuardsDeactivate(self, name): |
532 def hgQueueGuardsDeactivate(self): |
646 """ |
533 """ |
647 Public method to deactivate all active guards. |
534 Public method to deactivate all active guards. |
648 |
535 """ |
649 @param name file/directory name (string) |
|
650 """ |
|
651 # find the root of the repo |
|
652 repodir = self.vcs.splitPath(name)[0] |
|
653 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
654 repodir = os.path.dirname(repodir) |
|
655 if os.path.splitdrive(repodir)[1] == os.sep: |
|
656 return |
|
657 |
|
658 args = self.vcs.initCommand("qselect") |
536 args = self.vcs.initCommand("qselect") |
659 args.append("--none") |
537 args.append("--none") |
660 |
538 |
661 dia = HgDialog(self.tr('Deactivate Guards'), self.vcs) |
539 dia = HgDialog(self.tr('Deactivate Guards'), self.vcs) |
662 res = dia.startProcess(args, repodir) |
540 res = dia.startProcess(args) |
663 if res: |
541 if res: |
664 dia.exec() |
542 dia.exec() |
665 |
543 |
666 def hgQueueGuardsIdentifyActive(self, name): |
544 def hgQueueGuardsIdentifyActive(self): |
667 """ |
545 """ |
668 Public method to list all active guards. |
546 Public method to list all active guards. |
669 |
547 """ |
670 @param name file/directory name (string) |
548 guardsList = self.getGuardsList(allGuards=False) |
671 """ |
|
672 # find the root of the repo |
|
673 repodir = self.vcs.splitPath(name)[0] |
|
674 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
675 repodir = os.path.dirname(repodir) |
|
676 if os.path.splitdrive(repodir)[1] == os.sep: |
|
677 return |
|
678 |
|
679 guardsList = self.getGuardsList(repodir, allGuards=False) |
|
680 if guardsList: |
549 if guardsList: |
681 from .HgQueuesGuardsSelectionDialog import ( |
550 from .HgQueuesGuardsSelectionDialog import ( |
682 HgQueuesGuardsSelectionDialog |
551 HgQueuesGuardsSelectionDialog |
683 ) |
552 ) |
684 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
553 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
685 dlg.exec() |
554 dlg.exec() |
686 |
555 |
687 def hgQueueCreateRenameQueue(self, name, isCreate): |
556 def hgQueueCreateRenameQueue(self, isCreate): |
688 """ |
557 """ |
689 Public method to create a new queue or rename the active queue. |
558 Public method to create a new queue or rename the active queue. |
690 |
559 |
691 @param name file/directory name (string) |
|
692 @param isCreate flag indicating to create a new queue (boolean) |
560 @param isCreate flag indicating to create a new queue (boolean) |
693 """ |
561 """ |
694 # find the root of the repo |
|
695 repodir = self.vcs.splitPath(name)[0] |
|
696 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
697 repodir = os.path.dirname(repodir) |
|
698 if os.path.splitdrive(repodir)[1] == os.sep: |
|
699 return |
|
700 |
|
701 if isCreate: |
562 if isCreate: |
702 title = self.tr("Create New Queue") |
563 title = self.tr("Create New Queue") |
703 else: |
564 else: |
704 title = self.tr("Rename Active Queue") |
565 title = self.tr("Rename Active Queue") |
705 from .HgQueuesQueueManagementDialog import ( |
566 from .HgQueuesQueueManagementDialog import ( |
706 HgQueuesQueueManagementDialog |
567 HgQueuesQueueManagementDialog |
707 ) |
568 ) |
708 dlg = HgQueuesQueueManagementDialog( |
569 dlg = HgQueuesQueueManagementDialog( |
709 HgQueuesQueueManagementDialog.NAME_INPUT, |
570 HgQueuesQueueManagementDialog.NAME_INPUT, |
710 title, False, repodir, self.vcs) |
571 title, False, self.vcs) |
711 if dlg.exec() == QDialog.Accepted: |
572 if dlg.exec() == QDialog.Accepted: |
712 queueName = dlg.getData() |
573 queueName = dlg.getData() |
713 if queueName: |
574 if queueName: |
714 args = self.vcs.initCommand("qqueue") |
575 args = self.vcs.initCommand("qqueue") |
715 if isCreate: |
576 if isCreate: |
737 self.queuesListQueuesDialog is not None and |
598 self.queuesListQueuesDialog is not None and |
738 self.queuesListQueuesDialog.isVisible() |
599 self.queuesListQueuesDialog.isVisible() |
739 ): |
600 ): |
740 self.queuesListQueuesDialog.refresh() |
601 self.queuesListQueuesDialog.refresh() |
741 |
602 |
742 def hgQueueDeletePurgeActivateQueue(self, name, operation): |
603 def hgQueueDeletePurgeActivateQueue(self, operation): |
743 """ |
604 """ |
744 Public method to delete the reference to a queue and optionally |
605 Public method to delete the reference to a queue and optionally |
745 remove the patch directory or set the active queue. |
606 remove the patch directory or set the active queue. |
746 |
607 |
747 @param name file/directory name (string) |
|
748 @param operation operation to be performed (Queues.QUEUE_DELETE, |
608 @param operation operation to be performed (Queues.QUEUE_DELETE, |
749 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
609 Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) |
750 @exception ValueError raised to indicate an invalid operation |
610 @exception ValueError raised to indicate an invalid operation |
751 """ |
611 """ |
752 # find the root of the repo |
|
753 repodir = self.vcs.splitPath(name)[0] |
|
754 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
755 repodir = os.path.dirname(repodir) |
|
756 if os.path.splitdrive(repodir)[1] == os.sep: |
|
757 return |
|
758 |
|
759 if operation == Queues.QUEUE_PURGE: |
612 if operation == Queues.QUEUE_PURGE: |
760 title = self.tr("Purge Queue") |
613 title = self.tr("Purge Queue") |
761 elif operation == Queues.QUEUE_DELETE: |
614 elif operation == Queues.QUEUE_DELETE: |
762 title = self.tr("Delete Queue") |
615 title = self.tr("Delete Queue") |
763 elif operation == Queues.QUEUE_ACTIVATE: |
616 elif operation == Queues.QUEUE_ACTIVATE: |
801 self.queuesListQueuesDialog is not None and |
654 self.queuesListQueuesDialog is not None and |
802 self.queuesListQueuesDialog.isVisible() |
655 self.queuesListQueuesDialog.isVisible() |
803 ): |
656 ): |
804 self.queuesListQueuesDialog.refresh() |
657 self.queuesListQueuesDialog.refresh() |
805 |
658 |
806 def hgQueueListQueues(self, name): |
659 def hgQueueListQueues(self): |
807 """ |
660 """ |
808 Public method to list available queues. |
661 Public method to list available queues. |
809 |
662 """ |
810 @param name file/directory name (string) |
|
811 """ |
|
812 # find the root of the repo |
|
813 repodir = self.vcs.splitPath(name)[0] |
|
814 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
815 repodir = os.path.dirname(repodir) |
|
816 if os.path.splitdrive(repodir)[1] == os.sep: |
|
817 return |
|
818 |
|
819 from .HgQueuesQueueManagementDialog import ( |
663 from .HgQueuesQueueManagementDialog import ( |
820 HgQueuesQueueManagementDialog |
664 HgQueuesQueueManagementDialog |
821 ) |
665 ) |
822 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
666 self.queuesListQueuesDialog = HgQueuesQueueManagementDialog( |
823 HgQueuesQueueManagementDialog.NO_INPUT, |
667 HgQueuesQueueManagementDialog.NO_INPUT, |
824 self.tr("Available Queues"), |
668 self.tr("Available Queues"), |
825 False, repodir, self.vcs) |
669 False, self.vcs) |
826 self.queuesListQueuesDialog.show() |
670 self.queuesListQueuesDialog.show() |
827 |
671 |
828 def hgQueueInit(self, name): |
672 def hgQueueInit(self, name): |
829 """ |
673 """ |
830 Public method to initialize a new queue repository. |
674 Public method to initialize a new queue repository. |
831 |
675 |
832 @param name directory name (string) |
676 @param name directory name (string) |
833 """ |
677 """ |
834 # find the root of the repo |
|
835 repodir = self.vcs.splitPath(name)[0] |
|
836 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
|
837 repodir = os.path.dirname(repodir) |
|
838 if os.path.splitdrive(repodir)[1] == os.sep: |
|
839 return |
|
840 |
|
841 args = self.vcs.initCommand("init") |
678 args = self.vcs.initCommand("init") |
842 args.append('--mq') |
679 args.append('--mq') |
843 args.append(repodir) |
680 args.append(self.vcs.getClient().getRepository()) |
844 # init is not possible with the command server |
681 # init is not possible with the command server |
845 dia = HgDialog( |
682 dia = HgDialog( |
846 self.tr('Initializing new queue repository'), self.vcs) |
683 self.tr('Initializing new queue repository'), self.vcs) |
847 res = dia.startProcess(args) |
684 res = dia.startProcess(args) |
848 if res: |
685 if res: |