diff -r 4ef3b78ebb4e -r c4d0cac9b5c9 eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py --- a/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sat Sep 21 20:30:56 2019 +0200 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/HgLogBrowserDialog.py Sat Sep 21 22:03:03 2019 +0200 @@ -12,12 +12,16 @@ import re import collections -from PyQt5.QtCore import pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, \ - QSize, QPoint, QFileInfo -from PyQt5.QtGui import QCursor, QColor, QPixmap, QPainter, QPen, QBrush, \ - QIcon, QTextCursor -from PyQt5.QtWidgets import QWidget, QDialogButtonBox, QHeaderView, \ - QTreeWidgetItem, QApplication, QLineEdit, QMenu, QInputDialog +from PyQt5.QtCore import ( + pyqtSlot, Qt, QDate, QProcess, QTimer, QRegExp, QSize, QPoint, QFileInfo +) +from PyQt5.QtGui import ( + QCursor, QColor, QPixmap, QPainter, QPen, QBrush, QIcon, QTextCursor +) +from PyQt5.QtWidgets import ( + QWidget, QDialogButtonBox, QHeaderView, QTreeWidgetItem, QApplication, + QLineEdit, QMenu, QInputDialog +) from E5Gui.E5Application import e5App from E5Gui import E5MessageBox, E5FileDialog @@ -430,8 +434,10 @@ if self.__hgClient.isExecuting(): self.__hgClient.cancel() else: - if self.process is not None and \ - self.process.state() != QProcess.NotRunning: + if ( + self.process is not None and + self.process.state() != QProcess.NotRunning + ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) @@ -737,8 +743,10 @@ if self.__bundle: args.append("--repository") args.append(self.__bundle) - elif self.vcs.bundleFile and \ - os.path.exists(self.vcs.bundleFile): + elif ( + self.vcs.bundleFile and + os.path.exists(self.vcs.bundleFile) + ): args.append("--repository") args.append(self.vcs.bundleFile) args.append("--template") @@ -1044,10 +1052,9 @@ itm.setData(0, self.__incomingRole, self.commandMode == "incoming") if self.logTree.topLevelItemCount() > 1: - topedges = \ - self.logTree.topLevelItem( - self.logTree.indexOfTopLevelItem(itm) - 1)\ - .data(0, self.__edgesRole) + topedges = self.logTree.topLevelItem( + self.logTree.indexOfTopLevelItem(itm) - 1 + ).data(0, self.__edgesRole) else: topedges = None @@ -1101,9 +1108,11 @@ if startRev is not None: args.append('--rev') args.append('{0}:0'.format(startRev)) - if not self.projectMode and \ - not self.fname == "." and \ - not self.stopCheckBox.isChecked(): + if ( + not self.projectMode and + not self.fname == "." and + not self.stopCheckBox.isChecked() + ): args.append('--follow') if self.commandMode == "log": args.append('--copies') @@ -1137,23 +1146,29 @@ else: err = "" if err: - if self.commandMode == "incoming" and \ - self.initialCommandMode == "full_log": + if ( + self.commandMode == "incoming" and + self.initialCommandMode == "full_log" + ): # ignore the error self.commandMode = "log" else: self.__showError(err) - elif self.commandMode != "incoming" or \ + elif ( + self.commandMode != "incoming" or (self.vcs.bundleFile and - os.path.exists(self.vcs.bundleFile)) or \ - self.__bundle: + os.path.exists(self.vcs.bundleFile)) or + self.__bundle + ): out, err = self.__hgClient.runcommand(args) self.buf = out.splitlines(True) if err: self.__showError(err) self.__processBuffer() - elif self.commandMode == "incoming" and \ - self.initialCommandMode == "full_log": + elif ( + self.commandMode == "incoming" and + self.initialCommandMode == "full_log" + ): # no incoming changesets, just switch to log mode self.commandMode = "log" self.__finish() @@ -1170,10 +1185,12 @@ if procStarted: process.waitForFinished(30000) - if self.commandMode != "incoming" or \ + if ( + self.commandMode != "incoming" or (self.vcs.bundleFile and - os.path.exists(self.vcs.bundleFile)) or \ - self.__bundle: + os.path.exists(self.vcs.bundleFile)) or + self.__bundle + ): self.process.start('hg', args) procStarted = self.process.waitForStarted(5000) if not procStarted: @@ -1255,8 +1272,10 @@ Private slot called when the process finished or the user pressed the button. """ - if self.process is not None and \ - self.process.state() != QProcess.NotRunning: + if ( + self.process is not None and + self.process.state() != QProcess.NotRunning + ): self.process.terminate() QTimer.singleShot(2000, self.process.kill) self.process.waitForFinished(3000) @@ -1309,9 +1328,10 @@ elif key == "user": log["author"] = value.strip() elif key == "parents": - log["parents"] = \ - [int(x.split(":", 1)[0]) - for x in value.strip().split()] + log["parents"] = [ + int(x.split(":", 1)[0]) + for x in value.strip().split() + ] elif key == "date": log["date"] = " ".join(value.strip().split()[:2]) elif key == "description": @@ -1386,8 +1406,10 @@ log["parents"], log["branches"], log["tags"], log["phase"], log["bookmarks"], log["latesttag"]) dt = QDate.fromString(log["date"], Qt.ISODate) - if not self.__maxDate.isValid() and \ - not self.__minDate.isValid(): + if ( + not self.__maxDate.isValid() and + not self.__minDate.isValid() + ): self.__maxDate = dt self.__minDate = dt else: @@ -1540,8 +1562,10 @@ selectedItems = self.logTree.selectedItems() if len(selectedItems) == 1: currentItem = selectedItems[0] - rev2 = currentItem.text(self.RevisionColumn).split(":", 1)[0]\ + rev2 = ( + currentItem.text(self.RevisionColumn).split(":", 1)[0] .strip() + ) parents = currentItem.data(0, self.__parentsRole) if parents: parentLinks = [] @@ -1587,9 +1611,11 @@ public += 1 # step 2: set the status of the phase action - if public == 0 and \ - ((secret > 0 and draft == 0) or - (secret == 0 and draft > 0)): + if ( + public == 0 and + ((secret > 0 and draft == 0) or + (secret == 0 and draft > 0)) + ): self.__phaseAct.setEnabled(True) else: self.__phaseAct.setEnabled(False) @@ -1768,8 +1794,9 @@ index2 = self.logTree.indexOfTopLevelItem(selectedItems[1]) if index1 > index2: # Swap the entries - selectedItems[0], selectedItems[1] = \ + selectedItems[0], selectedItems[1] = ( selectedItems[1], selectedItems[0] + ) html = "{0}<hr/>{1}".format( self.__generateDetailsTableText(selectedItems[0]), self.__generateDetailsTableText(selectedItems[1]), @@ -2028,12 +2055,14 @@ txt = "\n".join(topItem.data(0, self.__messageRole)) else: txt = topItem.text(fieldIndex) - if topItem.text(self.DateColumn) <= to_ and \ - topItem.text(self.DateColumn) >= from_ and \ - (branch == self.__allBranchesFilter or - topItem.text(self.BranchColumn) in - [branch, closedBranch]) and \ - searchRx.indexIn(txt) > -1: + if ( + topItem.text(self.DateColumn) <= to_ and + topItem.text(self.DateColumn) >= from_ and + (branch == self.__allBranchesFilter or + topItem.text(self.BranchColumn) in + [branch, closedBranch]) and + searchRx.indexIn(txt) > -1 + ): topItem.setHidden(False) if topItem is currentItem: self.on_logTree_currentItemChanged(topItem, None) @@ -2317,8 +2346,9 @@ if len([itm for itm in self.logTree.selectedItems() if not itm.data(0, self.__incomingRole)]) == 1: itm = self.logTree.selectedItems()[0] - rev, changeset = \ + rev, changeset = ( itm.text(self.RevisionColumn).strip().split(":", 1) + ) bookmark, ok = QInputDialog.getText( self, self.tr("Define Bookmark"), @@ -2339,8 +2369,9 @@ if len([itm for itm in self.logTree.selectedItems() if not itm.data(0, self.__incomingRole)]) == 1: itm = self.logTree.selectedItems()[0] - rev, changeset = \ + rev, changeset = ( itm.text(self.RevisionColumn).strip().split(":", 1) + ) bookmarksList = self.vcs.hgGetBookmarksList(self.repodir) bookmark, ok = QInputDialog.getItem( self, @@ -2515,8 +2546,8 @@ } elif len(selectedItems) == 1: # the selected changeset is the base - rev = selectedItems[0].text(self.RevisionColumn)\ - .split(":", 1)[0].strip() + rev = selectedItems[0].text(self.RevisionColumn).split( + ":", 1)[0].strip() bundleData = { "revs": [], "base": rev,