--- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Thu Apr 08 17:27:12 2021 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Thu Apr 08 18:27:47 2021 +0200 @@ -81,14 +81,17 @@ """ patchesList = [] + if listType not in (Queues.APPLIED_LIST, Queues.UNAPPLIED_LIST, + Queues.SERIES_LIST): + raise ValueError("illegal value for listType") + if listType == Queues.APPLIED_LIST: args = self.vcs.initCommand("qapplied") elif listType == Queues.UNAPPLIED_LIST: args = self.vcs.initCommand("qunapplied") - elif listType == Queues.SERIES_LIST: + else: args = self.vcs.initCommand("qseries") - else: - raise ValueError("illegal value for listType") + if withSummary: args.append("--summary") @@ -277,6 +280,9 @@ @return flag indicating that the project should be reread (boolean) @exception ValueError raised to indicate an invalid operation """ + if operation not in (Queues.POP, Queues.PUSH, Queues.GOTO): + raise ValueError("illegal value for operation") + if operation == Queues.POP: args = self.vcs.initCommand("qpop") title = self.tr("Pop Patches") @@ -285,12 +291,11 @@ args = self.vcs.initCommand("qpush") title = self.tr("Push Patches") listType = Queues.UNAPPLIED_LIST - elif operation == Queues.GOTO: + else: args = self.vcs.initCommand("qgoto") title = self.tr("Go to Patch") listType = Queues.SERIES_LIST - else: - raise ValueError("illegal value for operation") + args.append("-v") if force: args.append("--force") @@ -609,14 +614,16 @@ Queues.QUEUE_PURGE, Queues.QUEUE_ACTIVATE) @exception ValueError raised to indicate an invalid operation """ + if operation not in (Queues.QUEUE_PURGE, Queues.QUEUE_DELETE, + Queues.QUEUE_ACTIVATE): + raise ValueError("illegal value for operation") + if operation == Queues.QUEUE_PURGE: title = self.tr("Purge Queue") elif operation == Queues.QUEUE_DELETE: title = self.tr("Delete Queue") - elif operation == Queues.QUEUE_ACTIVATE: + else: title = self.tr("Activate Queue") - else: - raise ValueError("illegal value for operation") from .HgQueuesQueueManagementDialog import ( HgQueuesQueueManagementDialog