Plugins/VcsPlugins/vcsPySvn/subversion.py

branch
Py2 comp.
changeset 3484
645c12de6b0c
parent 3178
f25fc1364c88
parent 3349
2a034a7f1f54
child 3598
37fdb72a2388
equal deleted inserted replaced
3456:96232974dcdb 3484:645c12de6b0c
199 """ 199 """
200 success = self.vcsImport(vcsDataDict, project.ppath)[0] 200 success = self.vcsImport(vcsDataDict, project.ppath)[0]
201 if not success: 201 if not success:
202 E5MessageBox.critical( 202 E5MessageBox.critical(
203 self.__ui, 203 self.__ui,
204 self.trUtf8("Create project in repository"), 204 self.tr("Create project in repository"),
205 self.trUtf8( 205 self.tr(
206 """The project could not be created in the repository.""" 206 """The project could not be created in the repository."""
207 """ Maybe the given repository doesn't exist or the""" 207 """ Maybe the given repository doesn't exist or the"""
208 """ repository server is down.""")) 208 """ repository server is down."""))
209 else: 209 else:
210 cwdIsPpath = False 210 cwdIsPpath = False
223 if not os.path.isfile(pfn): 223 if not os.path.isfile(pfn):
224 pfn += "z" 224 pfn += "z"
225 if not os.path.isfile(pfn): 225 if not os.path.isfile(pfn):
226 E5MessageBox.critical( 226 E5MessageBox.critical(
227 self.__ui, 227 self.__ui,
228 self.trUtf8("New project"), 228 self.tr("New project"),
229 self.trUtf8( 229 self.tr(
230 """The project could not be checked out of the""" 230 """The project could not be checked out of the"""
231 """ repository.<br />""" 231 """ repository.<br />"""
232 """Restoring the original contents.""")) 232 """Restoring the original contents."""))
233 if os.getcwd() == project.ppath: 233 if os.getcwd() == project.ppath:
234 os.chdir(os.path.dirname(project.ppath)) 234 os.chdir(os.path.dirname(project.ppath))
295 recurse = "--non-recursive" not in opts 295 recurse = "--non-recursive" not in opts
296 url = self.__svnURL(vcsDir) 296 url = self.__svnURL(vcsDir)
297 client = self.getClient() 297 client = self.getClient()
298 if not noDialog: 298 if not noDialog:
299 dlg = SvnDialog( 299 dlg = SvnDialog(
300 self.trUtf8('Importing project into Subversion repository'), 300 self.tr('Importing project into Subversion repository'),
301 "import{0} --message {1} .".format( 301 "import{0} --message {1} .".format(
302 (not recurse) and " --non-recursive" or "", msg), 302 (not recurse) and " --non-recursive" or "", msg),
303 client) 303 client)
304 QApplication.processEvents() 304 QApplication.processEvents()
305 try: 305 try:
310 rev = None 310 rev = None
311 if not noDialog: 311 if not noDialog:
312 dlg.showError(e.args[0]) 312 dlg.showError(e.args[0])
313 locker.unlock() 313 locker.unlock()
314 if not noDialog: 314 if not noDialog:
315 rev and dlg.showMessage(self.trUtf8("Imported revision {0}.\n") 315 rev and dlg.showMessage(self.tr("Imported revision {0}.\n")
316 .format(rev.number)) 316 .format(rev.number))
317 dlg.finish() 317 dlg.finish()
318 dlg.exec_() 318 dlg.exec_()
319 os.chdir(cwd) 319 os.chdir(cwd)
320 320
348 else: 348 else:
349 if not tag.startswith('tags') and \ 349 if not tag.startswith('tags') and \
350 not tag.startswith('branches'): 350 not tag.startswith('branches'):
351 type_, ok = QInputDialog.getItem( 351 type_, ok = QInputDialog.getItem(
352 None, 352 None,
353 self.trUtf8("Subversion Checkout"), 353 self.tr("Subversion Checkout"),
354 self.trUtf8( 354 self.tr(
355 "The tag must be a normal tag (tags) or" 355 "The tag must be a normal tag (tags) or"
356 " a branch tag (branches)." 356 " a branch tag (branches)."
357 " Please select from the list."), 357 " Please select from the list."),
358 self.tagTypeList, 358 self.tagTypeList,
359 0, False) 359 0, False)
368 recurse = "--non-recursive" not in opts 368 recurse = "--non-recursive" not in opts
369 url = self.__svnURL(svnUrl) 369 url = self.__svnURL(svnUrl)
370 client = self.getClient() 370 client = self.getClient()
371 if not noDialog: 371 if not noDialog:
372 dlg = SvnDialog( 372 dlg = SvnDialog(
373 self.trUtf8('Checking project out of Subversion repository'), 373 self.tr('Checking project out of Subversion repository'),
374 "checkout{0} {1} {2}".format( 374 "checkout{0} {1} {2}".format(
375 (not recurse) and " --non-recursive" or "", 375 (not recurse) and " --non-recursive" or "",
376 url, projectDir), 376 url, projectDir),
377 client) 377 client)
378 QApplication.processEvents() 378 QApplication.processEvents()
413 else: 413 else:
414 if not tag.startswith('tags') and \ 414 if not tag.startswith('tags') and \
415 not tag.startswith('branches'): 415 not tag.startswith('branches'):
416 type_, ok = QInputDialog.getItem( 416 type_, ok = QInputDialog.getItem(
417 None, 417 None,
418 self.trUtf8("Subversion Export"), 418 self.tr("Subversion Export"),
419 self.trUtf8( 419 self.tr(
420 "The tag must be a normal tag (tags) or" 420 "The tag must be a normal tag (tags) or"
421 " a branch tag (branches)." 421 " a branch tag (branches)."
422 " Please select from the list."), 422 " Please select from the list."),
423 self.tagTypeList, 423 self.tagTypeList,
424 0, False) 424 0, False)
432 opts = self.options['global'] 432 opts = self.options['global']
433 recurse = "--non-recursive" not in opts 433 recurse = "--non-recursive" not in opts
434 url = self.__svnURL(svnUrl) 434 url = self.__svnURL(svnUrl)
435 client = self.getClient() 435 client = self.getClient()
436 dlg = SvnDialog( 436 dlg = SvnDialog(
437 self.trUtf8('Exporting project from Subversion repository'), 437 self.tr('Exporting project from Subversion repository'),
438 "export --force{0} {1} {2}".format( 438 "export --force{0} {1} {2}".format(
439 (not recurse) and " --non-recursive" or "", 439 (not recurse) and " --non-recursive" or "",
440 url, projectDir), 440 url, projectDir),
441 client) 441 client)
442 QApplication.processEvents() 442 QApplication.processEvents()
513 break 513 break
514 514
515 if not ok: 515 if not ok:
516 res = E5MessageBox.yesNo( 516 res = E5MessageBox.yesNo(
517 self.__ui, 517 self.__ui,
518 self.trUtf8("Commit Changes"), 518 self.tr("Commit Changes"),
519 self.trUtf8( 519 self.tr(
520 """The commit affects files, that have unsaved""" 520 """The commit affects files, that have unsaved"""
521 """ changes. Shall the commit be continued?"""), 521 """ changes. Shall the commit be continued?"""),
522 icon=E5MessageBox.Warning) 522 icon=E5MessageBox.Warning)
523 if not res: 523 if not res:
524 return 524 return
555 recurse = "--non-recursive" not in opts 555 recurse = "--non-recursive" not in opts
556 keeplocks = "--keep-locks" in opts 556 keeplocks = "--keep-locks" in opts
557 client = self.getClient() 557 client = self.getClient()
558 if not noDialog: 558 if not noDialog:
559 dlg = SvnDialog( 559 dlg = SvnDialog(
560 self.trUtf8('Commiting changes to Subversion repository'), 560 self.tr('Commiting changes to Subversion repository'),
561 "commit{0}{1}{2}{3} --message {4} {5}".format( 561 "commit{0}{1}{2}{3} --message {4} {5}".format(
562 (not recurse) and " --non-recursive" or "", 562 (not recurse) and " --non-recursive" or "",
563 keeplocks and " --keep-locks" or "", 563 keeplocks and " --keep-locks" or "",
564 keepChangelists and " --keep-changelists" or "", 564 keepChangelists and " --keep-changelists" or "",
565 changelists and 565 changelists and
580 rev = None 580 rev = None
581 if not noDialog: 581 if not noDialog:
582 dlg.showError(e.args[0]) 582 dlg.showError(e.args[0])
583 locker.unlock() 583 locker.unlock()
584 if not noDialog: 584 if not noDialog:
585 rev and dlg.showMessage(self.trUtf8("Committed revision {0}.") 585 rev and dlg.showMessage(self.tr("Committed revision {0}.")
586 .format(rev.number)) 586 .format(rev.number))
587 dlg.finish() 587 dlg.finish()
588 dlg.exec_() 588 dlg.exec_()
589 os.chdir(cwd) 589 os.chdir(cwd)
590 self.committed.emit() 590 self.committed.emit()
613 opts = self.options['global'] + self.options['update'] 613 opts = self.options['global'] + self.options['update']
614 recurse = "--non-recursive" not in opts 614 recurse = "--non-recursive" not in opts
615 client = self.getClient() 615 client = self.getClient()
616 if not noDialog: 616 if not noDialog:
617 dlg = SvnDialog( 617 dlg = SvnDialog(
618 self.trUtf8('Synchronizing with the Subversion repository'), 618 self.tr('Synchronizing with the Subversion repository'),
619 "update{0} {1}".format( 619 "update{0} {1}".format(
620 (not recurse) and " --non-recursive" or "", 620 (not recurse) and " --non-recursive" or "",
621 " ".join(fnames)), 621 " ".join(fnames)),
622 client) 622 client)
623 QApplication.processEvents() 623 QApplication.processEvents()
721 force = "--force" in opts or noDialog 721 force = "--force" in opts or noDialog
722 noignore = "--no-ignore" in opts 722 noignore = "--no-ignore" in opts
723 client = self.getClient() 723 client = self.getClient()
724 if not noDialog: 724 if not noDialog:
725 dlg = SvnDialog( 725 dlg = SvnDialog(
726 self.trUtf8('Adding files/directories to the Subversion' 726 self.tr('Adding files/directories to the Subversion'
727 ' repository'), 727 ' repository'),
728 "add --non-recursive{0}{1} {2}".format( 728 "add --non-recursive{0}{1} {2}".format(
729 force and " --force" or "", 729 force and " --force" or "",
730 noignore and " --no-ignore" or "", 730 noignore and " --no-ignore" or "",
731 " ".join(names)), 731 " ".join(names)),
732 client) 732 client)
829 recurse = True 829 recurse = True
830 force = "--force" in opts 830 force = "--force" in opts
831 ignore = "--ignore" in opts 831 ignore = "--ignore" in opts
832 client = self.getClient() 832 client = self.getClient()
833 dlg = SvnDialog( 833 dlg = SvnDialog(
834 self.trUtf8('Adding directory trees to the Subversion repository'), 834 self.tr('Adding directory trees to the Subversion repository'),
835 "add{0}{1} {2}".format( 835 "add{0}{1} {2}".format(
836 force and " --force" or "", 836 force and " --force" or "",
837 ignore and " --ignore" or "", 837 ignore and " --ignore" or "",
838 " ".join(names)), 838 " ".join(names)),
839 client) 839 client)
866 opts = self.options['global'] + self.options['remove'] 866 opts = self.options['global'] + self.options['remove']
867 force = "--force" in opts or noDialog 867 force = "--force" in opts or noDialog
868 client = self.getClient() 868 client = self.getClient()
869 if not noDialog: 869 if not noDialog:
870 dlg = SvnDialog( 870 dlg = SvnDialog(
871 self.trUtf8('Removing files/directories from the Subversion' 871 self.tr('Removing files/directories from the Subversion'
872 ' repository'), 872 ' repository'),
873 "remove{0} {1}".format( 873 "remove{0} {1}".format(
874 force and " --force" or "", 874 force and " --force" or "",
875 " ".join(name)), 875 " ".join(name)),
876 client) 876 client)
877 QApplication.processEvents() 877 QApplication.processEvents()
930 log = "" 930 log = ""
931 target = target 931 target = target
932 if not noDialog: 932 if not noDialog:
933 dlg = \ 933 dlg = \
934 SvnDialog( 934 SvnDialog(
935 self.trUtf8('Moving {0}').format(name), 935 self.tr('Moving {0}').format(name),
936 "move{0}{1} {2} {3}".format( 936 "move{0}{1} {2} {3}".format(
937 force and " --force" or "", 937 force and " --force" or "",
938 log and (" --message {0}".format(log)) or "", 938 log and (" --message {0}".format(log)) or "",
939 name, target), 939 name, target),
940 client, log=log) 940 client, log=log)
972 @param name file/directory name to show the log of (string) 972 @param name file/directory name to show the log of (string)
973 """ 973 """
974 isFile = os.path.isfile(name) 974 isFile = os.path.isfile(name)
975 noEntries, ok = QInputDialog.getInt( 975 noEntries, ok = QInputDialog.getInt(
976 None, 976 None,
977 self.trUtf8("Subversion Log"), 977 self.tr("Subversion Log"),
978 self.trUtf8("Select number of entries to show."), 978 self.tr("Select number of entries to show."),
979 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1) 979 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1)
980 if ok: 980 if ok:
981 from .SvnLogDialog import SvnLogDialog 981 from .SvnLogDialog import SvnLogDialog
982 self.log = SvnLogDialog(self, isFile=isFile) 982 self.log = SvnLogDialog(self, isFile=isFile)
983 self.log.show() 983 self.log.show()
1040 1040
1041 reposURL = self.svnGetReposName(dname) 1041 reposURL = self.svnGetReposName(dname)
1042 if reposURL is None: 1042 if reposURL is None:
1043 E5MessageBox.critical( 1043 E5MessageBox.critical(
1044 self.__ui, 1044 self.__ui,
1045 self.trUtf8("Subversion Error"), 1045 self.tr("Subversion Error"),
1046 self.trUtf8( 1046 self.tr(
1047 """The URL of the project repository could not be""" 1047 """The URL of the project repository could not be"""
1048 """ retrieved from the working copy. The tag operation""" 1048 """ retrieved from the working copy. The tag operation"""
1049 """ will be aborted""")) 1049 """ will be aborted"""))
1050 return 1050 return
1051 1051
1067 if self.otherData["standardLayout"]: 1067 if self.otherData["standardLayout"]:
1068 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1068 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1069 if not rx_base.exactMatch(reposURL): 1069 if not rx_base.exactMatch(reposURL):
1070 E5MessageBox.critical( 1070 E5MessageBox.critical(
1071 self.__ui, 1071 self.__ui,
1072 self.trUtf8("Subversion Error"), 1072 self.tr("Subversion Error"),
1073 self.trUtf8( 1073 self.tr(
1074 """The URL of the project repository has an""" 1074 """The URL of the project repository has an"""
1075 """ invalid format. The tag operation will""" 1075 """ invalid format. The tag operation will"""
1076 """ be aborted""")) 1076 """ be aborted"""))
1077 return 1077 return
1078 1078
1089 client = self.getClient() 1089 client = self.getClient()
1090 rev = None 1090 rev = None
1091 if tagOp in [1, 2]: 1091 if tagOp in [1, 2]:
1092 log = 'Created tag <{0}>'.format(self.tagName) 1092 log = 'Created tag <{0}>'.format(self.tagName)
1093 dlg = SvnDialog( 1093 dlg = SvnDialog(
1094 self.trUtf8('Tagging {0} in the Subversion repository') 1094 self.tr('Tagging {0} in the Subversion repository')
1095 .format(name), 1095 .format(name),
1096 "copy --message {0} {1} {2}".format(log, reposURL, url), 1096 "copy --message {0} {1} {2}".format(log, reposURL, url),
1097 client, log=log) 1097 client, log=log)
1098 QApplication.processEvents() 1098 QApplication.processEvents()
1099 locker = QMutexLocker(self.vcsExecutionMutex) 1099 locker = QMutexLocker(self.vcsExecutionMutex)
1103 dlg.showError(e.args[0]) 1103 dlg.showError(e.args[0])
1104 locker.unlock() 1104 locker.unlock()
1105 else: 1105 else:
1106 log = 'Deleted tag <{0}>'.format(self.tagName) 1106 log = 'Deleted tag <{0}>'.format(self.tagName)
1107 dlg = SvnDialog( 1107 dlg = SvnDialog(
1108 self.trUtf8('Tagging {0} in the Subversion repository') 1108 self.tr('Tagging {0} in the Subversion repository')
1109 .format(name), 1109 .format(name),
1110 "remove --message {0} {1}".format(log, url), 1110 "remove --message {0} {1}".format(log, url),
1111 client, log=log) 1111 client, log=log)
1112 QApplication.processEvents() 1112 QApplication.processEvents()
1113 locker = QMutexLocker(self.vcsExecutionMutex) 1113 locker = QMutexLocker(self.vcsExecutionMutex)
1115 rev = client.remove(url) 1115 rev = client.remove(url)
1116 except pysvn.ClientError as e: 1116 except pysvn.ClientError as e:
1117 dlg.showError(e.args[0]) 1117 dlg.showError(e.args[0])
1118 locker.unlock() 1118 locker.unlock()
1119 rev and dlg.showMessage( 1119 rev and dlg.showMessage(
1120 self.trUtf8("Revision {0}.\n").format(rev.number)) 1120 self.tr("Revision {0}.\n").format(rev.number))
1121 dlg.finish() 1121 dlg.finish()
1122 dlg.exec_() 1122 dlg.exec_()
1123 1123
1124 def vcsRevert(self, name): 1124 def vcsRevert(self, name):
1125 """ 1125 """
1138 if names[0]: 1138 if names[0]:
1139 from UI.DeleteFilesConfirmationDialog import \ 1139 from UI.DeleteFilesConfirmationDialog import \
1140 DeleteFilesConfirmationDialog 1140 DeleteFilesConfirmationDialog
1141 dia = DeleteFilesConfirmationDialog( 1141 dia = DeleteFilesConfirmationDialog(
1142 self.parent(), 1142 self.parent(),
1143 self.trUtf8("Revert changes"), 1143 self.tr("Revert changes"),
1144 self.trUtf8( 1144 self.tr(
1145 "Do you really want to revert all changes to these files" 1145 "Do you really want to revert all changes to these files"
1146 " or directories?"), 1146 " or directories?"),
1147 name) 1147 name)
1148 yes = dia.exec_() == QDialog.Accepted 1148 yes = dia.exec_() == QDialog.Accepted
1149 else: 1149 else:
1150 yes = E5MessageBox.yesNo( 1150 yes = E5MessageBox.yesNo(
1151 None, 1151 None,
1152 self.trUtf8("Revert changes"), 1152 self.tr("Revert changes"),
1153 self.trUtf8("""Do you really want to revert all changes of""" 1153 self.tr("""Do you really want to revert all changes of"""
1154 """ the project?""")) 1154 """ the project?"""))
1155 if yes: 1155 if yes:
1156 client = self.getClient() 1156 client = self.getClient()
1157 dlg = SvnDialog( 1157 dlg = SvnDialog(
1158 self.trUtf8('Reverting changes'), 1158 self.tr('Reverting changes'),
1159 "revert {0} {1}".format( 1159 "revert {0} {1}".format(
1160 (not recurse) and " --non-recursive" or "", 1160 (not recurse) and " --non-recursive" or "",
1161 " ".join(name)), 1161 " ".join(name)),
1162 client) 1162 client)
1163 QApplication.processEvents() 1163 QApplication.processEvents()
1183 1183
1184 reposURL = self.svnGetReposName(dname) 1184 reposURL = self.svnGetReposName(dname)
1185 if reposURL is None: 1185 if reposURL is None:
1186 E5MessageBox.critical( 1186 E5MessageBox.critical(
1187 self.__ui, 1187 self.__ui,
1188 self.trUtf8("Subversion Error"), 1188 self.tr("Subversion Error"),
1189 self.trUtf8( 1189 self.tr(
1190 """The URL of the project repository could not be""" 1190 """The URL of the project repository could not be"""
1191 """ retrieved from the working copy. The switch""" 1191 """ retrieved from the working copy. The switch"""
1192 """ operation will be aborted""")) 1192 """ operation will be aborted"""))
1193 return False 1193 return False
1194 1194
1210 if self.otherData["standardLayout"]: 1210 if self.otherData["standardLayout"]:
1211 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1211 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1212 if not rx_base.exactMatch(reposURL): 1212 if not rx_base.exactMatch(reposURL):
1213 E5MessageBox.critical( 1213 E5MessageBox.critical(
1214 self.__ui, 1214 self.__ui,
1215 self.trUtf8("Subversion Error"), 1215 self.tr("Subversion Error"),
1216 self.trUtf8( 1216 self.tr(
1217 """The URL of the project repository has an""" 1217 """The URL of the project repository has an"""
1218 """ invalid format. The switch operation will""" 1218 """ invalid format. The switch operation will"""
1219 """ be aborted""")) 1219 """ be aborted"""))
1220 return False 1220 return False
1221 1221
1232 else: 1232 else:
1233 url = self.__svnURL(tag) 1233 url = self.__svnURL(tag)
1234 tn = url 1234 tn = url
1235 1235
1236 client = self.getClient() 1236 client = self.getClient()
1237 dlg = SvnDialog(self.trUtf8('Switching to {0}').format(tn), 1237 dlg = SvnDialog(self.tr('Switching to {0}').format(tn),
1238 "switch {0} {1}".format(url, name), 1238 "switch {0} {1}".format(url, name),
1239 client) 1239 client)
1240 QApplication.processEvents() 1240 QApplication.processEvents()
1241 locker = QMutexLocker(self.vcsExecutionMutex) 1241 locker = QMutexLocker(self.vcsExecutionMutex)
1242 try: 1242 try:
1243 rev = client.switch(name, url) 1243 rev = client.switch(name, url)
1244 dlg.showMessage(self.trUtf8("Revision {0}.\n").format(rev.number)) 1244 dlg.showMessage(self.tr("Revision {0}.\n").format(rev.number))
1245 except pysvn.ClientError as e: 1245 except pysvn.ClientError as e:
1246 dlg.showError(e.args[0]) 1246 dlg.showError(e.args[0])
1247 locker.unlock() 1247 locker.unlock()
1248 dlg.finish() 1248 dlg.finish()
1249 dlg.exec_() 1249 dlg.exec_()
1336 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified) 1336 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified)
1337 rev2 = "" 1337 rev2 = ""
1338 client = self.getClient() 1338 client = self.getClient()
1339 dlg = \ 1339 dlg = \
1340 SvnDialog( 1340 SvnDialog(
1341 self.trUtf8('Merging {0}').format(name), 1341 self.tr('Merging {0}').format(name),
1342 "merge{0}{1} {2} {3} {4}".format( 1342 "merge{0}{1} {2} {3} {4}".format(
1343 (not recurse) and " --non-recursive" or "", 1343 (not recurse) and " --non-recursive" or "",
1344 force and " --force" or "", 1344 force and " --force" or "",
1345 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""), 1345 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""),
1346 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""), 1346 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""),
1636 Public method used to cleanup the working copy. 1636 Public method used to cleanup the working copy.
1637 1637
1638 @param name directory name to be cleaned up (string) 1638 @param name directory name to be cleaned up (string)
1639 """ 1639 """
1640 client = self.getClient() 1640 client = self.getClient()
1641 dlg = SvnDialog(self.trUtf8('Cleaning up {0}').format(name), 1641 dlg = SvnDialog(self.tr('Cleaning up {0}').format(name),
1642 "cleanup {0}".format(name), 1642 "cleanup {0}".format(name),
1643 client) 1643 client)
1644 QApplication.processEvents() 1644 QApplication.processEvents()
1645 locker = QMutexLocker(self.vcsExecutionMutex) 1645 locker = QMutexLocker(self.vcsExecutionMutex)
1646 try: 1646 try:
1675 args = [] 1675 args = []
1676 self.addArguments(args, commandList) 1676 self.addArguments(args, commandList)
1677 1677
1678 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \ 1678 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \
1679 SvnDialog as SvnProcessDialog 1679 SvnDialog as SvnProcessDialog
1680 dia = SvnProcessDialog(self.trUtf8('Subversion command')) 1680 dia = SvnProcessDialog(self.tr('Subversion command'))
1681 res = dia.startProcess(args, wd) 1681 res = dia.startProcess(args, wd)
1682 if res: 1682 if res:
1683 dia.exec_() 1683 dia.exec_()
1684 1684
1685 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): 1685 def vcsOptionsDialog(self, project, archive, editable=False, parent=None):
1795 cwd = os.getcwd() 1795 cwd = os.getcwd()
1796 os.chdir(dname) 1796 os.chdir(dname)
1797 opts = self.options['global'] 1797 opts = self.options['global']
1798 recurse = "--non-recursive" not in opts 1798 recurse = "--non-recursive" not in opts
1799 client = self.getClient() 1799 client = self.getClient()
1800 dlg = SvnDialog(self.trUtf8('Resolving conficts'), 1800 dlg = SvnDialog(self.tr('Resolving conficts'),
1801 "resolved{0} {1}".format( 1801 "resolved{0} {1}".format(
1802 (not recurse) and " --non-recursive" or "", 1802 (not recurse) and " --non-recursive" or "",
1803 " ".join(fnames)), 1803 " ".join(fnames)),
1804 client) 1804 client)
1805 QApplication.processEvents() 1805 QApplication.processEvents()
1836 else: 1836 else:
1837 log = "" 1837 log = ""
1838 target = target 1838 target = target
1839 dlg = \ 1839 dlg = \
1840 SvnDialog( 1840 SvnDialog(
1841 self.trUtf8('Copying {0}').format(name), 1841 self.tr('Copying {0}').format(name),
1842 "copy{0} {1} {2}".format( 1842 "copy{0} {1} {2}".format(
1843 log and (" --message {0}".format(log)) or "", 1843 log and (" --message {0}".format(log)) or "",
1844 name, target), 1844 name, target),
1845 client, log=log) 1845 client, log=log)
1846 QApplication.processEvents() 1846 QApplication.processEvents()
1888 if dlg.exec_() == QDialog.Accepted: 1888 if dlg.exec_() == QDialog.Accepted:
1889 propName, propValue, recurse = dlg.getData() 1889 propName, propValue, recurse = dlg.getData()
1890 if not propName: 1890 if not propName:
1891 E5MessageBox.critical( 1891 E5MessageBox.critical(
1892 self.__ui, 1892 self.__ui,
1893 self.trUtf8("Subversion Set Property"), 1893 self.tr("Subversion Set Property"),
1894 self.trUtf8( 1894 self.tr(
1895 """You have to supply a property name. Aborting.""")) 1895 """You have to supply a property name. Aborting."""))
1896 return 1896 return
1897 1897
1898 if isinstance(name, list): 1898 if isinstance(name, list):
1899 dname, fnames = self.splitPathList(name) 1899 dname, fnames = self.splitPathList(name)
1907 opts = self.options['global'] 1907 opts = self.options['global']
1908 skipchecks = "--skip-checks" in opts 1908 skipchecks = "--skip-checks" in opts
1909 client = self.getClient() 1909 client = self.getClient()
1910 dlg = \ 1910 dlg = \
1911 SvnDialog( 1911 SvnDialog(
1912 self.trUtf8('Subversion Set Property'), 1912 self.tr('Subversion Set Property'),
1913 "propset{0}{1} {2} {3} {4}".format( 1913 "propset{0}{1} {2} {3} {4}".format(
1914 recurse and " --recurse" or "", 1914 recurse and " --recurse" or "",
1915 skipchecks and " --skip-checks" or "", 1915 skipchecks and " --skip-checks" or "",
1916 propName, propValue, 1916 propName, propValue,
1917 " ".join(fnames)), 1917 " ".join(fnames)),
1922 client.propset(propName, propValue, name, 1922 client.propset(propName, propValue, name,
1923 recurse=recurse, skip_checks=skipchecks) 1923 recurse=recurse, skip_checks=skipchecks)
1924 except pysvn.ClientError as e: 1924 except pysvn.ClientError as e:
1925 dlg.showError(e.args[0]) 1925 dlg.showError(e.args[0])
1926 locker.unlock() 1926 locker.unlock()
1927 dlg.showMessage(self.trUtf8("Property set.")) 1927 dlg.showMessage(self.tr("Property set."))
1928 dlg.finish() 1928 dlg.finish()
1929 dlg.exec_() 1929 dlg.exec_()
1930 os.chdir(cwd) 1930 os.chdir(cwd)
1931 1931
1932 def svnDelProp(self, name, recursive=False): 1932 def svnDelProp(self, name, recursive=False):
1942 propName, recurse = dlg.getData() 1942 propName, recurse = dlg.getData()
1943 1943
1944 if not propName: 1944 if not propName:
1945 E5MessageBox.critical( 1945 E5MessageBox.critical(
1946 self.__ui, 1946 self.__ui,
1947 self.trUtf8("Subversion Delete Property"), 1947 self.tr("Subversion Delete Property"),
1948 self.trUtf8( 1948 self.tr(
1949 """You have to supply a property name. Aborting.""")) 1949 """You have to supply a property name. Aborting."""))
1950 return 1950 return
1951 1951
1952 if isinstance(name, list): 1952 if isinstance(name, list):
1953 dname, fnames = self.splitPathList(name) 1953 dname, fnames = self.splitPathList(name)
1961 opts = self.options['global'] 1961 opts = self.options['global']
1962 skipchecks = "--skip-checks" in opts 1962 skipchecks = "--skip-checks" in opts
1963 client = self.getClient() 1963 client = self.getClient()
1964 dlg = \ 1964 dlg = \
1965 SvnDialog( 1965 SvnDialog(
1966 self.trUtf8('Subversion Delete Property'), 1966 self.tr('Subversion Delete Property'),
1967 "propdel{0}{1} {2} {3}".format( 1967 "propdel{0}{1} {2} {3}".format(
1968 recurse and " --recurse" or "", 1968 recurse and " --recurse" or "",
1969 skipchecks and " --skip-checks" or "", 1969 skipchecks and " --skip-checks" or "",
1970 propName, " ".join(fnames)), 1970 propName, " ".join(fnames)),
1971 client) 1971 client)
1975 client.propdel(propName, name, 1975 client.propdel(propName, name,
1976 recurse=recurse, skip_checks=skipchecks) 1976 recurse=recurse, skip_checks=skipchecks)
1977 except pysvn.ClientError as e: 1977 except pysvn.ClientError as e:
1978 dlg.showError(e.args[0]) 1978 dlg.showError(e.args[0])
1979 locker.unlock() 1979 locker.unlock()
1980 dlg.showMessage(self.trUtf8("Property deleted.")) 1980 dlg.showMessage(self.tr("Property deleted."))
1981 dlg.finish() 1981 dlg.finish()
1982 dlg.exec_() 1982 dlg.exec_()
1983 os.chdir(cwd) 1983 os.chdir(cwd)
1984 1984
1985 def svnListTagBranch(self, path, tags=True): 1985 def svnListTagBranch(self, path, tags=True):
2171 2171
2172 output1, error = self.__svnGetFileForRevision(name, rev=rev1) 2172 output1, error = self.__svnGetFileForRevision(name, rev=rev1)
2173 if error: 2173 if error:
2174 E5MessageBox.critical( 2174 E5MessageBox.critical(
2175 self.__ui, 2175 self.__ui,
2176 self.trUtf8("Subversion Side-by-Side Difference"), 2176 self.tr("Subversion Side-by-Side Difference"),
2177 error) 2177 error)
2178 return 2178 return
2179 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") 2179 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".")
2180 2180
2181 if rev2: 2181 if rev2:
2182 output2, error = self.__svnGetFileForRevision(name, rev=rev2) 2182 output2, error = self.__svnGetFileForRevision(name, rev=rev2)
2183 if error: 2183 if error:
2184 E5MessageBox.critical( 2184 E5MessageBox.critical(
2185 self.__ui, 2185 self.__ui,
2186 self.trUtf8("Subversion Side-by-Side Difference"), 2186 self.tr("Subversion Side-by-Side Difference"),
2187 error) 2187 error)
2188 return 2188 return
2189 name2 = "{0} (rev. {1})".format(name, rev2) 2189 name2 = "{0} (rev. {1})".format(name, rev2)
2190 else: 2190 else:
2191 try: 2191 try:
2194 f1.close() 2194 f1.close()
2195 name2 = name 2195 name2 = name
2196 except IOError: 2196 except IOError:
2197 E5MessageBox.critical( 2197 E5MessageBox.critical(
2198 self.__ui, 2198 self.__ui,
2199 self.trUtf8("Subversion Side-by-Side Difference"), 2199 self.tr("Subversion Side-by-Side Difference"),
2200 self.trUtf8( 2200 self.tr(
2201 """<p>The file <b>{0}</b> could not be read.</p>""") 2201 """<p>The file <b>{0}</b> could not be read.</p>""")
2202 .format(name)) 2202 .format(name))
2203 return 2203 return
2204 2204
2205 if self.sbsDiff is None: 2205 if self.sbsDiff is None:
2206 from UI.CompareDialog import CompareDialog 2206 from UI.CompareDialog import CompareDialog
2207 self.sbsDiff = CompareDialog() 2207 self.sbsDiff = CompareDialog()
2208 self.sbsDiff.show() 2208 self.sbsDiff.show()
2209 self.sbsDiff.compare(output1, output2, name1, name2) 2209 self.sbsDiff.compare(output1, output2, name1, name2)
2210 2210
2211 def svnLogBrowser(self, path, isFile=False): 2211 def vcsLogBrowser(self, name, isFile=False):
2212 """ 2212 """
2213 Public method used to browse the log of a file/directory from the 2213 Public method used to browse the log of a file/directory from the
2214 Subversion repository. 2214 Subversion repository.
2215 2215
2216 @param path file/directory name to show the log of (string) 2216 @param name file/directory name to show the log of (string)
2217 @param isFile flag indicating log for a file is to be shown (boolean) 2217 @param isFile flag indicating log for a file is to be shown (boolean)
2218 """ 2218 """
2219 from .SvnLogBrowserDialog import SvnLogBrowserDialog 2219 if self.logBrowser is None:
2220 self.logBrowser = SvnLogBrowserDialog(self, isFile=isFile) 2220 from .SvnLogBrowserDialog import SvnLogBrowserDialog
2221 self.logBrowser = SvnLogBrowserDialog(self)
2221 self.logBrowser.show() 2222 self.logBrowser.show()
2222 QApplication.processEvents() 2223 QApplication.processEvents()
2223 self.logBrowser.start(path) 2224 self.logBrowser.start(name, isFile=isFile)
2224 2225
2225 def svnLock(self, name, stealIt=False, parent=None): 2226 def svnLock(self, name, stealIt=False, parent=None):
2226 """ 2227 """
2227 Public method used to lock a file in the Subversion repository. 2228 Public method used to lock a file in the Subversion repository.
2228 2229
2232 @param parent reference to the parent object of the subversion dialog 2233 @param parent reference to the parent object of the subversion dialog
2233 (QWidget) 2234 (QWidget)
2234 """ 2235 """
2235 comment, ok = QInputDialog.getText( 2236 comment, ok = QInputDialog.getText(
2236 None, 2237 None,
2237 self.trUtf8("Subversion Lock"), 2238 self.tr("Subversion Lock"),
2238 self.trUtf8("Enter lock comment"), 2239 self.tr("Enter lock comment"),
2239 QLineEdit.Normal) 2240 QLineEdit.Normal)
2240 2241
2241 if not ok: 2242 if not ok:
2242 return 2243 return
2243 2244
2251 cwd = os.getcwd() 2252 cwd = os.getcwd()
2252 os.chdir(dname) 2253 os.chdir(dname)
2253 client = self.getClient() 2254 client = self.getClient()
2254 dlg = \ 2255 dlg = \
2255 SvnDialog( 2256 SvnDialog(
2256 self.trUtf8('Locking in the Subversion repository'), 2257 self.tr('Locking in the Subversion repository'),
2257 "lock{0}{1} {2}".format( 2258 "lock{0}{1} {2}".format(
2258 stealIt and " --force" or "", 2259 stealIt and " --force" or "",
2259 comment and (" --message {0}".format(comment)) or "", 2260 comment and (" --message {0}".format(comment)) or "",
2260 " ".join(fnames)), 2261 " ".join(fnames)),
2261 client, parent=parent) 2262 client, parent=parent)
2291 cwd = os.getcwd() 2292 cwd = os.getcwd()
2292 os.chdir(dname) 2293 os.chdir(dname)
2293 client = self.getClient() 2294 client = self.getClient()
2294 dlg = \ 2295 dlg = \
2295 SvnDialog( 2296 SvnDialog(
2296 self.trUtf8('Unlocking in the Subversion repository'), 2297 self.tr('Unlocking in the Subversion repository'),
2297 "unlock{0} {1}".format( 2298 "unlock{0} {1}".format(
2298 breakIt and " --force" or "", 2299 breakIt and " --force" or "",
2299 " ".join(fnames)), 2300 " ".join(fnames)),
2300 client, parent=parent) 2301 client, parent=parent)
2301 QApplication.processEvents() 2302 QApplication.processEvents()
2338 else: 2339 else:
2339 msg = "relocate {0} {1} {2}".format(currUrl, newUrl, 2340 msg = "relocate {0} {1} {2}".format(currUrl, newUrl,
2340 projectPath) 2341 projectPath)
2341 client = self.getClient() 2342 client = self.getClient()
2342 dlg = \ 2343 dlg = \
2343 SvnDialog(self.trUtf8('Relocating'), msg, client) 2344 SvnDialog(self.tr('Relocating'), msg, client)
2344 QApplication.processEvents() 2345 QApplication.processEvents()
2345 locker = QMutexLocker(self.vcsExecutionMutex) 2346 locker = QMutexLocker(self.vcsExecutionMutex)
2346 try: 2347 try:
2347 if inside: 2348 if inside:
2348 client.switch(projectPath, newUrl) 2349 client.switch(projectPath, newUrl)
2366 url = None 2367 url = None
2367 2368
2368 if url is None: 2369 if url is None:
2369 url, ok = QInputDialog.getText( 2370 url, ok = QInputDialog.getText(
2370 None, 2371 None,
2371 self.trUtf8("Repository Browser"), 2372 self.tr("Repository Browser"),
2372 self.trUtf8("Enter the repository URL."), 2373 self.tr("Enter the repository URL."),
2373 QLineEdit.Normal) 2374 QLineEdit.Normal)
2374 if not ok or not url: 2375 if not ok or not url:
2375 return 2376 return
2376 2377
2377 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog 2378 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
2389 """ 2390 """
2390 if not isinstance(names, list): 2391 if not isinstance(names, list):
2391 names = [names] 2392 names = [names]
2392 client = self.getClient() 2393 client = self.getClient()
2393 dlg = \ 2394 dlg = \
2394 SvnDialog(self.trUtf8('Remove from changelist'), 2395 SvnDialog(self.tr('Remove from changelist'),
2395 "changelist --remove {0}".format(" ".join(names)), 2396 "changelist --remove {0}".format(" ".join(names)),
2396 client) 2397 client)
2397 QApplication.processEvents() 2398 QApplication.processEvents()
2398 locker = QMutexLocker(self.vcsExecutionMutex) 2399 locker = QMutexLocker(self.vcsExecutionMutex)
2399 try: 2400 try:
2417 if not isinstance(names, list): 2418 if not isinstance(names, list):
2418 names = [names] 2419 names = [names]
2419 2420
2420 clname, ok = QInputDialog.getItem( 2421 clname, ok = QInputDialog.getItem(
2421 None, 2422 None,
2422 self.trUtf8("Add to changelist"), 2423 self.tr("Add to changelist"),
2423 self.trUtf8("Enter name of the changelist:"), 2424 self.tr("Enter name of the changelist:"),
2424 sorted(self.svnGetChangelists()), 2425 sorted(self.svnGetChangelists()),
2425 0, True) 2426 0, True)
2426 if not ok or not clname: 2427 if not ok or not clname:
2427 return 2428 return
2428 2429
2429 client = self.getClient() 2430 client = self.getClient()
2430 dlg = \ 2431 dlg = \
2431 SvnDialog(self.trUtf8('Add to changelist'), 2432 SvnDialog(self.tr('Add to changelist'),
2432 "changelist {0}".format(" ".join(names)), 2433 "changelist {0}".format(" ".join(names)),
2433 client) 2434 client)
2434 QApplication.processEvents() 2435 QApplication.processEvents()
2435 locker = QMutexLocker(self.vcsExecutionMutex) 2436 locker = QMutexLocker(self.vcsExecutionMutex)
2436 try: 2437 try:
2487 2488
2488 @param path directory name to show change lists for (string) 2489 @param path directory name to show change lists for (string)
2489 """ 2490 """
2490 client = self.getClient() 2491 client = self.getClient()
2491 dlg = \ 2492 dlg = \
2492 SvnDialog(self.trUtf8('Upgrade'), 2493 SvnDialog(self.tr('Upgrade'),
2493 "upgrade {0}".format(path), 2494 "upgrade {0}".format(path),
2494 client) 2495 client)
2495 QApplication.processEvents() 2496 QApplication.processEvents()
2496 locker = QMutexLocker(self.vcsExecutionMutex) 2497 locker = QMutexLocker(self.vcsExecutionMutex)
2497 try: 2498 try:

eric ide

mercurial