Git Interface: changed code again to cope with 'scp like' repository URLs.

Fri, 08 Feb 2019 17:38:00 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 08 Feb 2019 17:38:00 +0100
changeset 6707
30f0ac20df50
parent 6703
31b0306f0ecc
child 6708
80fee080d9fe

Git Interface: changed code again to cope with 'scp like' repository URLs.

Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py file | annotate | diff | comparison | revisions
Plugins/VcsPlugins/vcsGit/git.py file | annotate | diff | comparison | revisions
--- a/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.py	Wed Feb 06 19:21:41 2019 +0100
+++ b/Plugins/VcsPlugins/vcsGit/GitNewProjectOptionsDialog.py	Fri Feb 08 17:38:00 2019 +0100
@@ -118,19 +118,22 @@
         @type str
         """
         enable = False
+        vcsUrlEnable = False
         
         if txt:
             url = QUrl.fromUserInput(txt)
             if url.isValid():
                 if url.scheme() in ConfigGitSchemes:
                     enable = True
+                    vcsUrlEnable = url.scheme() == "file"
             elif ':' in txt:
                 # assume scp like repository URL
                 enable = True
+        else:
+            vcsUrlEnable = True
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
-        
-        self.vcsUrlButton.setEnabled(url.scheme() == "file" or len(txt) == 0)
+        self.vcsUrlButton.setEnabled(vcsUrlEnable)
     
     @pyqtSlot()
     def on_vcsUrlClearHistoryButton_clicked(self):
@@ -152,10 +155,8 @@
         """
         self.__saveHistory()
         
-        url = QUrl.fromUserInput(
-            self.vcsUrlCombo.currentText().replace("\\", "/"))
         vcsdatadict = {
-            "url": url.toString(QUrl.None_),
+            "url": self.vcsUrlCombo.currentText().replace("\\", "/"),
         }
         return (self.vcsProjectDirEdit.text(), vcsdatadict)
     
--- a/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py	Wed Feb 06 19:21:41 2019 +0100
+++ b/Plugins/VcsPlugins/vcsGit/GitSubmoduleAddDialog.py	Fri Feb 08 17:38:00 2019 +0100
@@ -78,20 +78,22 @@
         @type str
         """
         enable = False
+        vcsUrlEnable = False
         
         if txt:
             url = QUrl.fromUserInput(txt)
             if url.isValid():
                 if url.scheme() in ConfigGitSchemes:
                     enable = True
+                    vcsUrlEnable = url.scheme() == "file"
             elif ':' in txt:
                 # assume scp like repository URL
                 enable = True
+        else:
+            vcsUrlEnable = True
         
         self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enable)
-        
-        self.submoduleUrlButton.setEnabled(url.scheme() == "file" or
-                                           len(txt) == 0)
+        self.submoduleUrlButton.setEnabled(vcsUrlEnable)
     
     @pyqtSlot()
     def on_submoduleUrlButton_clicked(self):
@@ -145,19 +147,12 @@
         """
         self.__saveHistory()
         
-        url = QUrl.fromUserInput(
-            self.submoduleUrlCombo.currentText().replace("\\", "/"))
         path = self.submoduleDirEdit.text()
         if path:
             path = self.__getRelativePath(path)
         
-        try:
-            formattingOptions = QUrl.FormattingOptions(QUrl.None_)
-        except AttributeError:
-            # for PyQt < 5.6.0
-            formattingOptions = QUrl.FormattingOptions(0)
         return (
-            url.toString(formattingOptions),
+            self.submoduleUrlCombo.currentText().replace("\\", "/"),
             self.branchEdit.text(),
             self.nameEdit.text(),
             path,
--- a/Plugins/VcsPlugins/vcsGit/git.py	Wed Feb 06 19:21:41 2019 +0100
+++ b/Plugins/VcsPlugins/vcsGit/git.py	Fri Feb 08 17:38:00 2019 +0100
@@ -1345,7 +1345,10 @@
         if url.endswith('/'):
             url = url[:-1]
         urll = url.split('//')
-        return "{0}//{1}".format(urll[0], '/'.join(urll[1:]))
+        if len(urll) > 1:
+            url = "{0}//{1}".format(urll[0], '/'.join(urll[1:]))
+        
+        return url
     
     def gitCreateIgnoreFile(self, name, autoAdd=False):
         """

eric ide

mercurial