diff -r 734353e7d679 -r e92f0dd51979 Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py --- a/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Sun Feb 23 15:24:28 2014 +0100 +++ b/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/queues.py Sun Feb 23 19:20:43 2014 +0100 @@ -17,8 +17,6 @@ from ..HgExtension import HgExtension from ..HgDialog import HgDialog -import Preferences - class Queues(HgExtension): """ @@ -87,13 +85,12 @@ """ patchesList = [] - args = [] if listType == Queues.APPLIED_LIST: - args.append("qapplied") + args = self.vcs.initCommand("qapplied") elif listType == Queues.UNAPPLIED_LIST: - args.append("qunapplied") + args = self.vcs.initCommand("qunapplied") elif listType == Queues.SERIES_LIST: - args.append("qseries") + args = self.vcs.initCommand("qseries") else: raise ValueError("illegal value for listType") if withSummary: @@ -104,7 +101,6 @@ if client: output = client.runcommand(args)[0] else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -112,8 +108,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = str( - process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), + self.vcs.getEncoding(), 'replace') for line in output.splitlines(): if withSummary: @@ -137,14 +133,12 @@ """ currentPatch = "" - args = [] - args.append("qtop") + args = self.vcs.initCommand("qtop") client = self.vcs.getClient() if client: currentPatch = client.runcommand(args)[0].strip() else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -152,9 +146,9 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - currentPatch = str( - process.readAllStandardOutput(), - ioEncoding, 'replace').strip() + currentPatch = str(process.readAllStandardOutput(), + self.vcs.getEncoding(), + 'replace').strip() return currentPatch @@ -167,14 +161,12 @@ """ message = "" - args = [] - args.append("qheader") + args = self.vcs.initCommand("qheader") client = self.vcs.getClient() if client: message = client.runcommand(args)[0] else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -182,9 +174,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - message = str( - process.readAllStandardOutput(), - ioEncoding, 'replace') + message = str(process.readAllStandardOutput(), + self.vcs.getEncoding(), 'replace') return message @@ -198,8 +189,7 @@ """ guardsList = [] - args = [] - args.append("qselect") + args = self.vcs.initCommand("qselect") if all: args.append("--series") @@ -208,7 +198,6 @@ if client: output = client.runcommand(args)[0] else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -216,8 +205,8 @@ if procStarted: finished = process.waitForFinished(30000) if finished and process.exitCode() == 0: - output = str( - process.readAllStandardOutput(), ioEncoding, 'replace') + output = str(process.readAllStandardOutput(), + self.vcs.getEncoding(), 'replace') for guard in output.splitlines(): guard = guard.strip() @@ -247,8 +236,7 @@ name, message, (userData, currentUser, userName), \ (dateData, currentDate, dateStr) = dlg.getData() - args = [] - args.append("qnew") + args = self.vcs.initCommand("qnew") if message != "": args.append("--message") args.append(message) @@ -287,8 +275,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qrefresh") + args = self.vcs.initCommand("qrefresh") if editMessage: currentMessage = self.__getCommitMessage(repodir) @@ -369,17 +356,16 @@ if os.path.splitdrive(repodir)[1] == os.sep: return False - args = [] if operation == Queues.POP: - args.append("qpop") + args = self.vcs.initCommand("qpop") title = self.tr("Pop Patches") listType = Queues.APPLIED_LIST elif operation == Queues.PUSH: - args.append("qpush") + args = self.vcs.initCommand("qpush") title = self.tr("Push Patches") listType = Queues.UNAPPLIED_LIST elif operation == Queues.GOTO: - args.append("qgoto") + args = self.vcs.initCommand("qgoto") title = self.tr("Go to Patch") listType = Queues.SERIES_LIST else: @@ -441,8 +427,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qfinish") + args = self.vcs.initCommand("qfinish") args.append("--applied") dia = HgDialog(self.tr('Finish Applied Patches'), self.vcs) @@ -464,8 +449,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qrename") + args = self.vcs.initCommand("qrename") patchnames = sorted(self.__getPatchesList(repodir, Queues.SERIES_LIST)) if patchnames: currentPatch = self.__getCurrentPatch(repodir) @@ -497,8 +481,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qdelete") + args = self.vcs.initCommand("qdelete") patchnames = sorted(self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST)) if patchnames: @@ -534,8 +517,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qfold") + args = self.vcs.initCommand("qfold") patchnames = sorted( self.__getPatchesList(repodir, Queues.UNAPPLIED_LIST, withSummary=True)) @@ -654,8 +636,7 @@ [""] + patchnames, 0, False) if ok: - args = [] - args.append("qguard") + args = self.vcs.initCommand("qguard") if patch: args.append(patch) args.append("--none") @@ -699,8 +680,7 @@ if dlg.exec_() == QDialog.Accepted: guards = dlg.getData() if guards: - args = [] - args.append("qselect") + args = self.vcs.initCommand("qselect") args.extend(guards) dia = HgDialog(self.tr('Set Active Guards'), self.vcs) @@ -727,8 +707,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append("qselect") + args = self.vcs.initCommand("qselect") args.append("--none") dia = HgDialog(self.tr('Deactivate Guards'), self.vcs) @@ -782,8 +761,7 @@ if dlg.exec_() == QDialog.Accepted: queueName = dlg.getData() if queueName: - args = [] - args.append("qqueue") + args = self.vcs.initCommand("qqueue") if isCreate: args.append("--create") else: @@ -795,7 +773,6 @@ if client: error = client.runcommand(args)[1] else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -804,9 +781,8 @@ finished = process.waitForFinished(30000) if finished: if process.exitCode() != 0: - error = \ - str(process.readAllStandardError(), - ioEncoding, 'replace') + error = str(process.readAllStandardError(), + self.vcs.getEncoding(), 'replace') if error: if isCreate: @@ -858,8 +834,7 @@ if dlg.exec_() == QDialog.Accepted: queueName = dlg.getData() if queueName: - args = [] - args.append("qqueue") + args = self.vcs.initCommand("qqueue") if operation == Queues.QUEUE_PURGE: args.append("--purge") elif operation == Queues.QUEUE_DELETE: @@ -871,7 +846,6 @@ if client: error = client.runcommand(args)[1] else: - ioEncoding = Preferences.getSystem("IOEncoding") process = QProcess() process.setWorkingDirectory(repodir) process.start('hg', args) @@ -880,9 +854,8 @@ finished = process.waitForFinished(30000) if finished: if process.exitCode() != 0: - error = \ - str(process.readAllStandardError(), - ioEncoding, 'replace') + error = str(process.readAllStandardError(), + self.vcs.getEncoding(), 'replace') if error: if operation == Queues.QUEUE_PURGE: @@ -935,8 +908,7 @@ if os.path.splitdrive(repodir)[1] == os.sep: return - args = [] - args.append('init') + args = self.vcs.initCommand("init") args.append('--mq') args.append(repodir) # init is not possible with the command server