eric7/Plugins/VcsPlugins/vcsMercurial/hg.py

branch
eric7
changeset 9152
8a68afaf1ba2
parent 9025
9fe8cfa14542
child 9153
506e35e424d5
--- a/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Wed Jun 15 09:44:07 2022 +0200
+++ b/eric7/Plugins/VcsPlugins/vcsMercurial/hg.py	Thu Jun 16 18:28:59 2022 +0200
@@ -10,10 +10,9 @@
 import os
 import shutil
 import contextlib
+import pathlib
 
-from PyQt6.QtCore import (
-    pyqtSignal, QFileInfo, QFileSystemWatcher, QCoreApplication
-)
+from PyQt6.QtCore import pyqtSignal, QFileSystemWatcher, QCoreApplication
 from PyQt6.QtWidgets import QApplication, QDialog, QInputDialog
 
 from EricWidgets.EricApplication import ericApp
@@ -2136,23 +2135,23 @@
         if not fname:
             return  # user aborted
         
-        ext = QFileInfo(fname).suffix()
-        if not ext:
+        fpath = pathlib.Path(fname)
+        if not fpath.suffix:
             ex = selectedFilter.split("(*")[1].split(")")[0]
             if ex:
-                fname += ex
-        if QFileInfo(fname).exists():
+                fpath = fpath.with_suffix(ex)
+        if fpath.exists():
             res = EricMessageBox.yesNo(
                 self.__ui,
                 self.tr("Create changegroup"),
                 self.tr("<p>The Mercurial changegroup file <b>{0}</b> "
                         "already exists. Overwrite it?</p>")
-                    .format(fname),
+                    .format(str(fpath)),
                 icon=EricMessageBox.Warning)
             if not res:
                 return
-        fname = Utilities.toNativeSeparators(fname)
-        self.__lastChangeGroupPath = os.path.dirname(fname)
+        
+        self.__lastChangeGroupPath = fpath.parent
         
         args = self.initCommand("bundle")
         if bundleAll:
@@ -2166,7 +2165,7 @@
         if compression:
             args.append("--type")
             args.append(compression)
-        args.append(fname)
+        args.append(str(fpath))
         
         dia = HgDialog(self.tr('Create changegroup'), self)
         res = dia.startProcess(args)

eric ide

mercurial