eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py

changeset 8259
2bbec88047dd
parent 8243
cc717c2ae956
--- a/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Wed Apr 21 17:56:12 2021 +0200
+++ b/eric6/Plugins/VcsPlugins/vcsGit/GitStatusDialog.py	Wed Apr 21 19:40:50 2021 +0200
@@ -1165,10 +1165,11 @@
         """
         cursor = self.lDiffEdit.textCursor()
         startIndex, endIndex = self.__selectedLinesIndexes(self.lDiffEdit)
-        if cursor.hasSelection():
-            patch = self.lDiffParser.createLinesPatch(startIndex, endIndex)
-        else:
-            patch = self.lDiffParser.createHunkPatch(startIndex)
+        patch = (
+            self.lDiffParser.createLinesPatch(startIndex, endIndex)
+            if cursor.hasSelection() else
+            self.lDiffParser.createHunkPatch(startIndex)
+        )
         if patch:
             patchFile = self.__tmpPatchFileName()
             try:
@@ -1186,11 +1187,12 @@
         """
         cursor = self.rDiffEdit.textCursor()
         startIndex, endIndex = self.__selectedLinesIndexes(self.rDiffEdit)
-        if cursor.hasSelection():
-            patch = self.rDiffParser.createLinesPatch(startIndex, endIndex,
-                                                      reverse=True)
-        else:
-            patch = self.rDiffParser.createHunkPatch(startIndex)
+        patch = (
+            self.rDiffParser.createLinesPatch(startIndex, endIndex,
+                                              reverse=True)
+            if cursor.hasSelection() else
+            self.rDiffParser.createHunkPatch(startIndex)
+        )
         if patch:
             patchFile = self.__tmpPatchFileName()
             try:
@@ -1208,10 +1210,11 @@
         """
         cursor = self.lDiffEdit.textCursor()
         startIndex, endIndex = self.__selectedLinesIndexes(self.lDiffEdit)
-        if cursor.hasSelection():
-            title = self.tr("Revert selected lines")
-        else:
-            title = self.tr("Revert hunk")
+        title = (
+            self.tr("Revert selected lines")
+            if cursor.hasSelection() else
+            self.tr("Revert hunk")
+        )
         res = E5MessageBox.yesNo(
             self,
             title,

eric ide

mercurial