Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 3020
542e97d4ecb3
parent 3009
bf5ae5d7477d
child 3024
17c01303a239
equal deleted inserted replaced
3019:7912530a33e2 3020:542e97d4ecb3
195 @param vcsDataDict dictionary of data required for the conversion 195 @param vcsDataDict dictionary of data required for the conversion
196 @param project reference to the project object 196 @param project reference to the project object
197 """ 197 """
198 success = self.vcsImport(vcsDataDict, project.ppath)[0] 198 success = self.vcsImport(vcsDataDict, project.ppath)[0]
199 if not success: 199 if not success:
200 E5MessageBox.critical(self.__ui, 200 E5MessageBox.critical(
201 self.__ui,
201 self.trUtf8("Create project in repository"), 202 self.trUtf8("Create project in repository"),
202 self.trUtf8( 203 self.trUtf8(
203 """The project could not be created in the repository.""" 204 """The project could not be created in the repository."""
204 """ Maybe the given repository doesn't exist or the""" 205 """ Maybe the given repository doesn't exist or the"""
205 """ repository server is down.""")) 206 """ repository server is down."""))
218 self.vcsCommit(project.ppath, vcsDataDict["message"], True) 219 self.vcsCommit(project.ppath, vcsDataDict["message"], True)
219 pfn = project.pfile 220 pfn = project.pfile
220 if not os.path.isfile(pfn): 221 if not os.path.isfile(pfn):
221 pfn += "z" 222 pfn += "z"
222 if not os.path.isfile(pfn): 223 if not os.path.isfile(pfn):
223 E5MessageBox.critical(self.__ui, 224 E5MessageBox.critical(
225 self.__ui,
224 self.trUtf8("New project"), 226 self.trUtf8("New project"),
225 self.trUtf8( 227 self.trUtf8(
226 """The project could not be checked out of the""" 228 """The project could not be checked out of the"""
227 """ repository.<br />""" 229 """ repository.<br />"""
228 """Restoring the original contents.""")) 230 """Restoring the original contents."""))
505 ok &= editor.checkDirty() 507 ok &= editor.checkDirty()
506 if not ok: 508 if not ok:
507 break 509 break
508 510
509 if not ok: 511 if not ok:
510 res = E5MessageBox.yesNo(self.__ui, 512 res = E5MessageBox.yesNo(
513 self.__ui,
511 self.trUtf8("Commit Changes"), 514 self.trUtf8("Commit Changes"),
512 self.trUtf8( 515 self.trUtf8(
513 """The commit affects files, that have unsaved""" 516 """The commit affects files, that have unsaved"""
514 """ changes. Shall the commit be continued?"""), 517 """ changes. Shall the commit be continued?"""),
515 icon=E5MessageBox.Warning) 518 icon=E5MessageBox.Warning)
1031 """ 1034 """
1032 dname, fname = self.splitPath(name) 1035 dname, fname = self.splitPath(name)
1033 1036
1034 reposURL = self.svnGetReposName(dname) 1037 reposURL = self.svnGetReposName(dname)
1035 if reposURL is None: 1038 if reposURL is None:
1036 E5MessageBox.critical(self.__ui, 1039 E5MessageBox.critical(
1040 self.__ui,
1037 self.trUtf8("Subversion Error"), 1041 self.trUtf8("Subversion Error"),
1038 self.trUtf8( 1042 self.trUtf8(
1039 """The URL of the project repository could not be""" 1043 """The URL of the project repository could not be"""
1040 """ retrieved from the working copy. The tag operation""" 1044 """ retrieved from the working copy. The tag operation"""
1041 """ will be aborted""")) 1045 """ will be aborted"""))
1057 return 1061 return
1058 1062
1059 if self.otherData["standardLayout"]: 1063 if self.otherData["standardLayout"]:
1060 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1064 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1061 if not rx_base.exactMatch(reposURL): 1065 if not rx_base.exactMatch(reposURL):
1062 E5MessageBox.critical(self.__ui, 1066 E5MessageBox.critical(
1067 self.__ui,
1063 self.trUtf8("Subversion Error"), 1068 self.trUtf8("Subversion Error"),
1064 self.trUtf8("""The URL of the project repository has an""" 1069 self.trUtf8("""The URL of the project repository has an"""
1065 """ invalid format. The tag operation will""" 1070 """ invalid format. The tag operation will"""
1066 """ be aborted""")) 1071 """ be aborted"""))
1067 return 1072 return
1134 "Do you really want to revert all changes to these files" 1139 "Do you really want to revert all changes to these files"
1135 " or directories?"), 1140 " or directories?"),
1136 name) 1141 name)
1137 yes = dia.exec_() == QDialog.Accepted 1142 yes = dia.exec_() == QDialog.Accepted
1138 else: 1143 else:
1139 yes = E5MessageBox.yesNo(None, 1144 yes = E5MessageBox.yesNo(
1145 None,
1140 self.trUtf8("Revert changes"), 1146 self.trUtf8("Revert changes"),
1141 self.trUtf8("""Do you really want to revert all changes of""" 1147 self.trUtf8("""Do you really want to revert all changes of"""
1142 """ the project?""")) 1148 """ the project?"""))
1143 if yes: 1149 if yes:
1144 client = self.getClient() 1150 client = self.getClient()
1169 """ 1175 """
1170 dname, fname = self.splitPath(name) 1176 dname, fname = self.splitPath(name)
1171 1177
1172 reposURL = self.svnGetReposName(dname) 1178 reposURL = self.svnGetReposName(dname)
1173 if reposURL is None: 1179 if reposURL is None:
1174 E5MessageBox.critical(self.__ui, 1180 E5MessageBox.critical(
1181 self.__ui,
1175 self.trUtf8("Subversion Error"), 1182 self.trUtf8("Subversion Error"),
1176 self.trUtf8( 1183 self.trUtf8(
1177 """The URL of the project repository could not be""" 1184 """The URL of the project repository could not be"""
1178 """ retrieved from the working copy. The switch""" 1185 """ retrieved from the working copy. The switch"""
1179 """ operation will be aborted""")) 1186 """ operation will be aborted"""))
1195 return False 1202 return False
1196 1203
1197 if self.otherData["standardLayout"]: 1204 if self.otherData["standardLayout"]:
1198 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1205 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1199 if not rx_base.exactMatch(reposURL): 1206 if not rx_base.exactMatch(reposURL):
1200 E5MessageBox.critical(self.__ui, 1207 E5MessageBox.critical(
1208 self.__ui,
1201 self.trUtf8("Subversion Error"), 1209 self.trUtf8("Subversion Error"),
1202 self.trUtf8("""The URL of the project repository has an""" 1210 self.trUtf8("""The URL of the project repository has an"""
1203 """ invalid format. The switch operation will""" 1211 """ invalid format. The switch operation will"""
1204 """ be aborted""")) 1212 """ be aborted"""))
1205 return False 1213 return False
1849 from .SvnPropSetDialog import SvnPropSetDialog 1857 from .SvnPropSetDialog import SvnPropSetDialog
1850 dlg = SvnPropSetDialog(recursive) 1858 dlg = SvnPropSetDialog(recursive)
1851 if dlg.exec_() == QDialog.Accepted: 1859 if dlg.exec_() == QDialog.Accepted:
1852 propName, propValue, recurse = dlg.getData() 1860 propName, propValue, recurse = dlg.getData()
1853 if not propName: 1861 if not propName:
1854 E5MessageBox.critical(self.__ui, 1862 E5MessageBox.critical(
1863 self.__ui,
1855 self.trUtf8("Subversion Set Property"), 1864 self.trUtf8("Subversion Set Property"),
1856 self.trUtf8( 1865 self.trUtf8(
1857 """You have to supply a property name. Aborting.""")) 1866 """You have to supply a property name. Aborting."""))
1858 return 1867 return
1859 1868
1902 dlg = SvnPropDelDialog(recursive) 1911 dlg = SvnPropDelDialog(recursive)
1903 if dlg.exec_() == QDialog.Accepted: 1912 if dlg.exec_() == QDialog.Accepted:
1904 propName, recurse = dlg.getData() 1913 propName, recurse = dlg.getData()
1905 1914
1906 if not propName: 1915 if not propName:
1907 E5MessageBox.critical(self.__ui, 1916 E5MessageBox.critical(
1917 self.__ui,
1908 self.trUtf8("Subversion Delete Property"), 1918 self.trUtf8("Subversion Delete Property"),
1909 self.trUtf8( 1919 self.trUtf8(
1910 """You have to supply a property name. Aborting.""")) 1920 """You have to supply a property name. Aborting."""))
1911 return 1921 return
1912 1922
2130 else: 2140 else:
2131 rev1, rev2 = "", "" 2141 rev1, rev2 = "", ""
2132 2142
2133 output1, error = self.__svnGetFileForRevision(name, rev=rev1) 2143 output1, error = self.__svnGetFileForRevision(name, rev=rev1)
2134 if error: 2144 if error:
2135 E5MessageBox.critical(self.__ui, 2145 E5MessageBox.critical(
2146 self.__ui,
2136 self.trUtf8("Subversion Side-by-Side Difference"), 2147 self.trUtf8("Subversion Side-by-Side Difference"),
2137 error) 2148 error)
2138 return 2149 return
2139 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") 2150 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".")
2140 2151
2141 if rev2: 2152 if rev2:
2142 output2, error = self.__svnGetFileForRevision(name, rev=rev2) 2153 output2, error = self.__svnGetFileForRevision(name, rev=rev2)
2143 if error: 2154 if error:
2144 E5MessageBox.critical(self.__ui, 2155 E5MessageBox.critical(
2156 self.__ui,
2145 self.trUtf8("Subversion Side-by-Side Difference"), 2157 self.trUtf8("Subversion Side-by-Side Difference"),
2146 error) 2158 error)
2147 return 2159 return
2148 name2 = "{0} (rev. {1})".format(name, rev2) 2160 name2 = "{0} (rev. {1})".format(name, rev2)
2149 else: 2161 else:
2151 f1 = open(name, "r", encoding="utf-8") 2163 f1 = open(name, "r", encoding="utf-8")
2152 output2 = f1.read() 2164 output2 = f1.read()
2153 f1.close() 2165 f1.close()
2154 name2 = name 2166 name2 = name
2155 except IOError: 2167 except IOError:
2156 E5MessageBox.critical(self.__ui, 2168 E5MessageBox.critical(
2169 self.__ui,
2157 self.trUtf8("Subversion Side-by-Side Difference"), 2170 self.trUtf8("Subversion Side-by-Side Difference"),
2158 self.trUtf8( 2171 self.trUtf8(
2159 """<p>The file <b>{0}</b> could not be read.</p>""") 2172 """<p>The file <b>{0}</b> could not be read.</p>""")
2160 .format(name)) 2173 .format(name))
2161 return 2174 return

eric ide

mercurial