183 message = str(process.readAllStandardOutput(), |
183 message = str(process.readAllStandardOutput(), |
184 self.vcs.getEncoding(), 'replace') |
184 self.vcs.getEncoding(), 'replace') |
185 |
185 |
186 return message |
186 return message |
187 |
187 |
188 def getGuardsList(self, repodir, all=True): |
188 def getGuardsList(self, repodir, allGuards=True): |
189 """ |
189 """ |
190 Public method to get a list of all guards defined. |
190 Public method to get a list of all guards defined. |
191 |
191 |
192 @param repodir directory name of the repository (string) |
192 @param repodir directory name of the repository (string) |
193 @param all flag indicating to get all guards (boolean) |
193 @param allGuards flag indicating to get all guards (boolean) |
194 @return sorted list of guards (list of strings) |
194 @return sorted list of guards (list of strings) |
195 """ |
195 """ |
196 guardsList = [] |
196 guardsList = [] |
197 |
197 |
198 args = self.vcs.initCommand("qselect") |
198 args = self.vcs.initCommand("qselect") |
199 if all: |
199 if allGuards: |
200 args.append("--series") |
200 args.append("--series") |
201 |
201 |
202 client = self.vcs.getClient() |
202 client = self.vcs.getClient() |
203 output = "" |
203 output = "" |
204 if client: |
204 if client: |
214 output = str(process.readAllStandardOutput(), |
214 output = str(process.readAllStandardOutput(), |
215 self.vcs.getEncoding(), 'replace') |
215 self.vcs.getEncoding(), 'replace') |
216 |
216 |
217 for guard in output.splitlines(): |
217 for guard in output.splitlines(): |
218 guard = guard.strip() |
218 guard = guard.strip() |
219 if all: |
219 if allGuards: |
220 guard = guard[1:] |
220 guard = guard[1:] |
221 if guard not in guardsList: |
221 if guard not in guardsList: |
222 guardsList.append(guard) |
222 guardsList.append(guard) |
223 |
223 |
224 return sorted(guardsList) |
224 return sorted(guardsList) |
337 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
337 self.qheaderDialog = HgQueuesHeaderDialog(self.vcs) |
338 self.qheaderDialog.show() |
338 self.qheaderDialog.show() |
339 QApplication.processEvents() |
339 QApplication.processEvents() |
340 self.qheaderDialog.start(name) |
340 self.qheaderDialog.start(name) |
341 |
341 |
342 def hgQueuePushPopPatches(self, name, operation, all=False, named=False, |
342 def hgQueuePushPopPatches(self, name, operation, doAll=False, named=False, |
343 force=False): |
343 force=False): |
344 """ |
344 """ |
345 Public method to push patches onto the stack or pop patches off the |
345 Public method to push patches onto the stack or pop patches off the |
346 stack. |
346 stack. |
347 |
347 |
348 @param name file/directory name (string) |
348 @param name file/directory name (string) |
349 @param operation operation type to be performed (Queues.POP, |
349 @param operation operation type to be performed (Queues.POP, |
350 Queues.PUSH, Queues.GOTO) |
350 Queues.PUSH, Queues.GOTO) |
351 @keyparam all flag indicating to push/pop all (boolean) |
351 @keyparam doAll flag indicating to push/pop all (boolean) |
352 @keyparam named flag indicating to push/pop until a named patch |
352 @keyparam named flag indicating to push/pop until a named patch |
353 is at the top of the stack (boolean) |
353 is at the top of the stack (boolean) |
354 @keyparam force flag indicating a forceful pop (boolean) |
354 @keyparam force flag indicating a forceful pop (boolean) |
355 @return flag indicating that the project should be reread (boolean) |
355 @return flag indicating that the project should be reread (boolean) |
356 @exception ValueError raised to indicate an invalid operation |
356 @exception ValueError raised to indicate an invalid operation |
377 else: |
377 else: |
378 raise ValueError("illegal value for operation") |
378 raise ValueError("illegal value for operation") |
379 args.append("-v") |
379 args.append("-v") |
380 if force: |
380 if force: |
381 args.append("--force") |
381 args.append("--force") |
382 if all and operation in (Queues.POP, Queues.PUSH): |
382 if doAll and operation in (Queues.POP, Queues.PUSH): |
383 args.append("--all") |
383 args.append("--all") |
384 elif named or operation == Queues.GOTO: |
384 elif named or operation == Queues.GOTO: |
385 patchnames = self.__getPatchesList(repodir, listType) |
385 patchnames = self.__getPatchesList(repodir, listType) |
386 if patchnames: |
386 if patchnames: |
387 patch, ok = QInputDialog.getItem( |
387 patch, ok = QInputDialog.getItem( |
676 if os.path.splitdrive(repodir)[1] == os.sep: |
676 if os.path.splitdrive(repodir)[1] == os.sep: |
677 return |
677 return |
678 |
678 |
679 guardsList = self.getGuardsList(repodir) |
679 guardsList = self.getGuardsList(repodir) |
680 if guardsList: |
680 if guardsList: |
681 activeGuardsList = self.getGuardsList(repodir, all=False) |
681 activeGuardsList = self.getGuardsList(repodir, allGuards=False) |
682 from .HgQueuesGuardsSelectionDialog import \ |
682 from .HgQueuesGuardsSelectionDialog import \ |
683 HgQueuesGuardsSelectionDialog |
683 HgQueuesGuardsSelectionDialog |
684 dlg = HgQueuesGuardsSelectionDialog( |
684 dlg = HgQueuesGuardsSelectionDialog( |
685 guardsList, activeGuards=activeGuardsList, listOnly=False) |
685 guardsList, activeGuards=activeGuardsList, listOnly=False) |
686 if dlg.exec_() == QDialog.Accepted: |
686 if dlg.exec_() == QDialog.Accepted: |
732 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
732 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)): |
733 repodir = os.path.dirname(repodir) |
733 repodir = os.path.dirname(repodir) |
734 if os.path.splitdrive(repodir)[1] == os.sep: |
734 if os.path.splitdrive(repodir)[1] == os.sep: |
735 return |
735 return |
736 |
736 |
737 guardsList = self.getGuardsList(repodir, all=False) |
737 guardsList = self.getGuardsList(repodir, allGuards=False) |
738 if guardsList: |
738 if guardsList: |
739 from .HgQueuesGuardsSelectionDialog import \ |
739 from .HgQueuesGuardsSelectionDialog import \ |
740 HgQueuesGuardsSelectionDialog |
740 HgQueuesGuardsSelectionDialog |
741 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
741 dlg = HgQueuesGuardsSelectionDialog(guardsList, listOnly=True) |
742 dlg.exec_() |
742 dlg.exec_() |