Plugins/VcsPlugins/vcsPySvn/subversion.py

changeset 3190
a9a94491c4fd
parent 3160
209a07d7e401
child 3287
c3d784c057b3
equal deleted inserted replaced
3189:9a21c547de5f 3190:a9a94491c4fd
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( 200 E5MessageBox.critical(
201 self.__ui, 201 self.__ui,
202 self.trUtf8("Create project in repository"), 202 self.tr("Create project in repository"),
203 self.trUtf8( 203 self.tr(
204 """The project could not be created in the repository.""" 204 """The project could not be created in the repository."""
205 """ Maybe the given repository doesn't exist or the""" 205 """ Maybe the given repository doesn't exist or the"""
206 """ repository server is down.""")) 206 """ repository server is down."""))
207 else: 207 else:
208 cwdIsPpath = False 208 cwdIsPpath = False
221 if not os.path.isfile(pfn): 221 if not os.path.isfile(pfn):
222 pfn += "z" 222 pfn += "z"
223 if not os.path.isfile(pfn): 223 if not os.path.isfile(pfn):
224 E5MessageBox.critical( 224 E5MessageBox.critical(
225 self.__ui, 225 self.__ui,
226 self.trUtf8("New project"), 226 self.tr("New project"),
227 self.trUtf8( 227 self.tr(
228 """The project could not be checked out of the""" 228 """The project could not be checked out of the"""
229 """ repository.<br />""" 229 """ repository.<br />"""
230 """Restoring the original contents.""")) 230 """Restoring the original contents."""))
231 if os.getcwd() == project.ppath: 231 if os.getcwd() == project.ppath:
232 os.chdir(os.path.dirname(project.ppath)) 232 os.chdir(os.path.dirname(project.ppath))
293 recurse = "--non-recursive" not in opts 293 recurse = "--non-recursive" not in opts
294 url = self.__svnURL(vcsDir) 294 url = self.__svnURL(vcsDir)
295 client = self.getClient() 295 client = self.getClient()
296 if not noDialog: 296 if not noDialog:
297 dlg = SvnDialog( 297 dlg = SvnDialog(
298 self.trUtf8('Importing project into Subversion repository'), 298 self.tr('Importing project into Subversion repository'),
299 "import{0} --message {1} .".format( 299 "import{0} --message {1} .".format(
300 (not recurse) and " --non-recursive" or "", msg), 300 (not recurse) and " --non-recursive" or "", msg),
301 client) 301 client)
302 QApplication.processEvents() 302 QApplication.processEvents()
303 try: 303 try:
308 rev = None 308 rev = None
309 if not noDialog: 309 if not noDialog:
310 dlg.showError(e.args[0]) 310 dlg.showError(e.args[0])
311 locker.unlock() 311 locker.unlock()
312 if not noDialog: 312 if not noDialog:
313 rev and dlg.showMessage(self.trUtf8("Imported revision {0}.\n") 313 rev and dlg.showMessage(self.tr("Imported revision {0}.\n")
314 .format(rev.number)) 314 .format(rev.number))
315 dlg.finish() 315 dlg.finish()
316 dlg.exec_() 316 dlg.exec_()
317 os.chdir(cwd) 317 os.chdir(cwd)
318 318
346 else: 346 else:
347 if not tag.startswith('tags') and \ 347 if not tag.startswith('tags') and \
348 not tag.startswith('branches'): 348 not tag.startswith('branches'):
349 type_, ok = QInputDialog.getItem( 349 type_, ok = QInputDialog.getItem(
350 None, 350 None,
351 self.trUtf8("Subversion Checkout"), 351 self.tr("Subversion Checkout"),
352 self.trUtf8( 352 self.tr(
353 "The tag must be a normal tag (tags) or" 353 "The tag must be a normal tag (tags) or"
354 " a branch tag (branches)." 354 " a branch tag (branches)."
355 " Please select from the list."), 355 " Please select from the list."),
356 self.tagTypeList, 356 self.tagTypeList,
357 0, False) 357 0, False)
366 recurse = "--non-recursive" not in opts 366 recurse = "--non-recursive" not in opts
367 url = self.__svnURL(svnUrl) 367 url = self.__svnURL(svnUrl)
368 client = self.getClient() 368 client = self.getClient()
369 if not noDialog: 369 if not noDialog:
370 dlg = SvnDialog( 370 dlg = SvnDialog(
371 self.trUtf8('Checking project out of Subversion repository'), 371 self.tr('Checking project out of Subversion repository'),
372 "checkout{0} {1} {2}".format( 372 "checkout{0} {1} {2}".format(
373 (not recurse) and " --non-recursive" or "", 373 (not recurse) and " --non-recursive" or "",
374 url, projectDir), 374 url, projectDir),
375 client) 375 client)
376 QApplication.processEvents() 376 QApplication.processEvents()
411 else: 411 else:
412 if not tag.startswith('tags') and \ 412 if not tag.startswith('tags') and \
413 not tag.startswith('branches'): 413 not tag.startswith('branches'):
414 type_, ok = QInputDialog.getItem( 414 type_, ok = QInputDialog.getItem(
415 None, 415 None,
416 self.trUtf8("Subversion Export"), 416 self.tr("Subversion Export"),
417 self.trUtf8( 417 self.tr(
418 "The tag must be a normal tag (tags) or" 418 "The tag must be a normal tag (tags) or"
419 " a branch tag (branches)." 419 " a branch tag (branches)."
420 " Please select from the list."), 420 " Please select from the list."),
421 self.tagTypeList, 421 self.tagTypeList,
422 0, False) 422 0, False)
430 opts = self.options['global'] 430 opts = self.options['global']
431 recurse = "--non-recursive" not in opts 431 recurse = "--non-recursive" not in opts
432 url = self.__svnURL(svnUrl) 432 url = self.__svnURL(svnUrl)
433 client = self.getClient() 433 client = self.getClient()
434 dlg = SvnDialog( 434 dlg = SvnDialog(
435 self.trUtf8('Exporting project from Subversion repository'), 435 self.tr('Exporting project from Subversion repository'),
436 "export --force{0} {1} {2}".format( 436 "export --force{0} {1} {2}".format(
437 (not recurse) and " --non-recursive" or "", 437 (not recurse) and " --non-recursive" or "",
438 url, projectDir), 438 url, projectDir),
439 client) 439 client)
440 QApplication.processEvents() 440 QApplication.processEvents()
511 break 511 break
512 512
513 if not ok: 513 if not ok:
514 res = E5MessageBox.yesNo( 514 res = E5MessageBox.yesNo(
515 self.__ui, 515 self.__ui,
516 self.trUtf8("Commit Changes"), 516 self.tr("Commit Changes"),
517 self.trUtf8( 517 self.tr(
518 """The commit affects files, that have unsaved""" 518 """The commit affects files, that have unsaved"""
519 """ changes. Shall the commit be continued?"""), 519 """ changes. Shall the commit be continued?"""),
520 icon=E5MessageBox.Warning) 520 icon=E5MessageBox.Warning)
521 if not res: 521 if not res:
522 return 522 return
553 recurse = "--non-recursive" not in opts 553 recurse = "--non-recursive" not in opts
554 keeplocks = "--keep-locks" in opts 554 keeplocks = "--keep-locks" in opts
555 client = self.getClient() 555 client = self.getClient()
556 if not noDialog: 556 if not noDialog:
557 dlg = SvnDialog( 557 dlg = SvnDialog(
558 self.trUtf8('Commiting changes to Subversion repository'), 558 self.tr('Commiting changes to Subversion repository'),
559 "commit{0}{1}{2}{3} --message {4} {5}".format( 559 "commit{0}{1}{2}{3} --message {4} {5}".format(
560 (not recurse) and " --non-recursive" or "", 560 (not recurse) and " --non-recursive" or "",
561 keeplocks and " --keep-locks" or "", 561 keeplocks and " --keep-locks" or "",
562 keepChangelists and " --keep-changelists" or "", 562 keepChangelists and " --keep-changelists" or "",
563 changelists and 563 changelists and
578 rev = None 578 rev = None
579 if not noDialog: 579 if not noDialog:
580 dlg.showError(e.args[0]) 580 dlg.showError(e.args[0])
581 locker.unlock() 581 locker.unlock()
582 if not noDialog: 582 if not noDialog:
583 rev and dlg.showMessage(self.trUtf8("Committed revision {0}.") 583 rev and dlg.showMessage(self.tr("Committed revision {0}.")
584 .format(rev.number)) 584 .format(rev.number))
585 dlg.finish() 585 dlg.finish()
586 dlg.exec_() 586 dlg.exec_()
587 os.chdir(cwd) 587 os.chdir(cwd)
588 self.committed.emit() 588 self.committed.emit()
611 opts = self.options['global'] + self.options['update'] 611 opts = self.options['global'] + self.options['update']
612 recurse = "--non-recursive" not in opts 612 recurse = "--non-recursive" not in opts
613 client = self.getClient() 613 client = self.getClient()
614 if not noDialog: 614 if not noDialog:
615 dlg = SvnDialog( 615 dlg = SvnDialog(
616 self.trUtf8('Synchronizing with the Subversion repository'), 616 self.tr('Synchronizing with the Subversion repository'),
617 "update{0} {1}".format( 617 "update{0} {1}".format(
618 (not recurse) and " --non-recursive" or "", 618 (not recurse) and " --non-recursive" or "",
619 " ".join(fnames)), 619 " ".join(fnames)),
620 client) 620 client)
621 QApplication.processEvents() 621 QApplication.processEvents()
719 force = "--force" in opts or noDialog 719 force = "--force" in opts or noDialog
720 noignore = "--no-ignore" in opts 720 noignore = "--no-ignore" in opts
721 client = self.getClient() 721 client = self.getClient()
722 if not noDialog: 722 if not noDialog:
723 dlg = SvnDialog( 723 dlg = SvnDialog(
724 self.trUtf8('Adding files/directories to the Subversion' 724 self.tr('Adding files/directories to the Subversion'
725 ' repository'), 725 ' repository'),
726 "add --non-recursive{0}{1} {2}".format( 726 "add --non-recursive{0}{1} {2}".format(
727 force and " --force" or "", 727 force and " --force" or "",
728 noignore and " --no-ignore" or "", 728 noignore and " --no-ignore" or "",
729 " ".join(names)), 729 " ".join(names)),
730 client) 730 client)
827 recurse = True 827 recurse = True
828 force = "--force" in opts 828 force = "--force" in opts
829 ignore = "--ignore" in opts 829 ignore = "--ignore" in opts
830 client = self.getClient() 830 client = self.getClient()
831 dlg = SvnDialog( 831 dlg = SvnDialog(
832 self.trUtf8('Adding directory trees to the Subversion repository'), 832 self.tr('Adding directory trees to the Subversion repository'),
833 "add{0}{1} {2}".format( 833 "add{0}{1} {2}".format(
834 force and " --force" or "", 834 force and " --force" or "",
835 ignore and " --ignore" or "", 835 ignore and " --ignore" or "",
836 " ".join(names)), 836 " ".join(names)),
837 client) 837 client)
864 opts = self.options['global'] + self.options['remove'] 864 opts = self.options['global'] + self.options['remove']
865 force = "--force" in opts or noDialog 865 force = "--force" in opts or noDialog
866 client = self.getClient() 866 client = self.getClient()
867 if not noDialog: 867 if not noDialog:
868 dlg = SvnDialog( 868 dlg = SvnDialog(
869 self.trUtf8('Removing files/directories from the Subversion' 869 self.tr('Removing files/directories from the Subversion'
870 ' repository'), 870 ' repository'),
871 "remove{0} {1}".format( 871 "remove{0} {1}".format(
872 force and " --force" or "", 872 force and " --force" or "",
873 " ".join(name)), 873 " ".join(name)),
874 client) 874 client)
875 QApplication.processEvents() 875 QApplication.processEvents()
928 log = "" 928 log = ""
929 target = target 929 target = target
930 if not noDialog: 930 if not noDialog:
931 dlg = \ 931 dlg = \
932 SvnDialog( 932 SvnDialog(
933 self.trUtf8('Moving {0}').format(name), 933 self.tr('Moving {0}').format(name),
934 "move{0}{1} {2} {3}".format( 934 "move{0}{1} {2} {3}".format(
935 force and " --force" or "", 935 force and " --force" or "",
936 log and (" --message {0}".format(log)) or "", 936 log and (" --message {0}".format(log)) or "",
937 name, target), 937 name, target),
938 client, log=log) 938 client, log=log)
970 @param name file/directory name to show the log of (string) 970 @param name file/directory name to show the log of (string)
971 """ 971 """
972 isFile = os.path.isfile(name) 972 isFile = os.path.isfile(name)
973 noEntries, ok = QInputDialog.getInt( 973 noEntries, ok = QInputDialog.getInt(
974 None, 974 None,
975 self.trUtf8("Subversion Log"), 975 self.tr("Subversion Log"),
976 self.trUtf8("Select number of entries to show."), 976 self.tr("Select number of entries to show."),
977 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1) 977 self.getPlugin().getPreferences("LogLimit"), 1, 999999, 1)
978 if ok: 978 if ok:
979 from .SvnLogDialog import SvnLogDialog 979 from .SvnLogDialog import SvnLogDialog
980 self.log = SvnLogDialog(self, isFile=isFile) 980 self.log = SvnLogDialog(self, isFile=isFile)
981 self.log.show() 981 self.log.show()
1038 1038
1039 reposURL = self.svnGetReposName(dname) 1039 reposURL = self.svnGetReposName(dname)
1040 if reposURL is None: 1040 if reposURL is None:
1041 E5MessageBox.critical( 1041 E5MessageBox.critical(
1042 self.__ui, 1042 self.__ui,
1043 self.trUtf8("Subversion Error"), 1043 self.tr("Subversion Error"),
1044 self.trUtf8( 1044 self.tr(
1045 """The URL of the project repository could not be""" 1045 """The URL of the project repository could not be"""
1046 """ retrieved from the working copy. The tag operation""" 1046 """ retrieved from the working copy. The tag operation"""
1047 """ will be aborted""")) 1047 """ will be aborted"""))
1048 return 1048 return
1049 1049
1065 if self.otherData["standardLayout"]: 1065 if self.otherData["standardLayout"]:
1066 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1066 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1067 if not rx_base.exactMatch(reposURL): 1067 if not rx_base.exactMatch(reposURL):
1068 E5MessageBox.critical( 1068 E5MessageBox.critical(
1069 self.__ui, 1069 self.__ui,
1070 self.trUtf8("Subversion Error"), 1070 self.tr("Subversion Error"),
1071 self.trUtf8( 1071 self.tr(
1072 """The URL of the project repository has an""" 1072 """The URL of the project repository has an"""
1073 """ invalid format. The tag operation will""" 1073 """ invalid format. The tag operation will"""
1074 """ be aborted""")) 1074 """ be aborted"""))
1075 return 1075 return
1076 1076
1087 client = self.getClient() 1087 client = self.getClient()
1088 rev = None 1088 rev = None
1089 if tagOp in [1, 2]: 1089 if tagOp in [1, 2]:
1090 log = 'Created tag <{0}>'.format(self.tagName) 1090 log = 'Created tag <{0}>'.format(self.tagName)
1091 dlg = SvnDialog( 1091 dlg = SvnDialog(
1092 self.trUtf8('Tagging {0} in the Subversion repository') 1092 self.tr('Tagging {0} in the Subversion repository')
1093 .format(name), 1093 .format(name),
1094 "copy --message {0} {1} {2}".format(log, reposURL, url), 1094 "copy --message {0} {1} {2}".format(log, reposURL, url),
1095 client, log=log) 1095 client, log=log)
1096 QApplication.processEvents() 1096 QApplication.processEvents()
1097 locker = QMutexLocker(self.vcsExecutionMutex) 1097 locker = QMutexLocker(self.vcsExecutionMutex)
1101 dlg.showError(e.args[0]) 1101 dlg.showError(e.args[0])
1102 locker.unlock() 1102 locker.unlock()
1103 else: 1103 else:
1104 log = 'Deleted tag <{0}>'.format(self.tagName) 1104 log = 'Deleted tag <{0}>'.format(self.tagName)
1105 dlg = SvnDialog( 1105 dlg = SvnDialog(
1106 self.trUtf8('Tagging {0} in the Subversion repository') 1106 self.tr('Tagging {0} in the Subversion repository')
1107 .format(name), 1107 .format(name),
1108 "remove --message {0} {1}".format(log, url), 1108 "remove --message {0} {1}".format(log, url),
1109 client, log=log) 1109 client, log=log)
1110 QApplication.processEvents() 1110 QApplication.processEvents()
1111 locker = QMutexLocker(self.vcsExecutionMutex) 1111 locker = QMutexLocker(self.vcsExecutionMutex)
1113 rev = client.remove(url) 1113 rev = client.remove(url)
1114 except pysvn.ClientError as e: 1114 except pysvn.ClientError as e:
1115 dlg.showError(e.args[0]) 1115 dlg.showError(e.args[0])
1116 locker.unlock() 1116 locker.unlock()
1117 rev and dlg.showMessage( 1117 rev and dlg.showMessage(
1118 self.trUtf8("Revision {0}.\n").format(rev.number)) 1118 self.tr("Revision {0}.\n").format(rev.number))
1119 dlg.finish() 1119 dlg.finish()
1120 dlg.exec_() 1120 dlg.exec_()
1121 1121
1122 def vcsRevert(self, name): 1122 def vcsRevert(self, name):
1123 """ 1123 """
1136 if names[0]: 1136 if names[0]:
1137 from UI.DeleteFilesConfirmationDialog import \ 1137 from UI.DeleteFilesConfirmationDialog import \
1138 DeleteFilesConfirmationDialog 1138 DeleteFilesConfirmationDialog
1139 dia = DeleteFilesConfirmationDialog( 1139 dia = DeleteFilesConfirmationDialog(
1140 self.parent(), 1140 self.parent(),
1141 self.trUtf8("Revert changes"), 1141 self.tr("Revert changes"),
1142 self.trUtf8( 1142 self.tr(
1143 "Do you really want to revert all changes to these files" 1143 "Do you really want to revert all changes to these files"
1144 " or directories?"), 1144 " or directories?"),
1145 name) 1145 name)
1146 yes = dia.exec_() == QDialog.Accepted 1146 yes = dia.exec_() == QDialog.Accepted
1147 else: 1147 else:
1148 yes = E5MessageBox.yesNo( 1148 yes = E5MessageBox.yesNo(
1149 None, 1149 None,
1150 self.trUtf8("Revert changes"), 1150 self.tr("Revert changes"),
1151 self.trUtf8("""Do you really want to revert all changes of""" 1151 self.tr("""Do you really want to revert all changes of"""
1152 """ the project?""")) 1152 """ the project?"""))
1153 if yes: 1153 if yes:
1154 client = self.getClient() 1154 client = self.getClient()
1155 dlg = SvnDialog( 1155 dlg = SvnDialog(
1156 self.trUtf8('Reverting changes'), 1156 self.tr('Reverting changes'),
1157 "revert {0} {1}".format( 1157 "revert {0} {1}".format(
1158 (not recurse) and " --non-recursive" or "", 1158 (not recurse) and " --non-recursive" or "",
1159 " ".join(name)), 1159 " ".join(name)),
1160 client) 1160 client)
1161 QApplication.processEvents() 1161 QApplication.processEvents()
1181 1181
1182 reposURL = self.svnGetReposName(dname) 1182 reposURL = self.svnGetReposName(dname)
1183 if reposURL is None: 1183 if reposURL is None:
1184 E5MessageBox.critical( 1184 E5MessageBox.critical(
1185 self.__ui, 1185 self.__ui,
1186 self.trUtf8("Subversion Error"), 1186 self.tr("Subversion Error"),
1187 self.trUtf8( 1187 self.tr(
1188 """The URL of the project repository could not be""" 1188 """The URL of the project repository could not be"""
1189 """ retrieved from the working copy. The switch""" 1189 """ retrieved from the working copy. The switch"""
1190 """ operation will be aborted""")) 1190 """ operation will be aborted"""))
1191 return False 1191 return False
1192 1192
1208 if self.otherData["standardLayout"]: 1208 if self.otherData["standardLayout"]:
1209 rx_base = QRegExp('(.+)/(trunk|tags|branches).*') 1209 rx_base = QRegExp('(.+)/(trunk|tags|branches).*')
1210 if not rx_base.exactMatch(reposURL): 1210 if not rx_base.exactMatch(reposURL):
1211 E5MessageBox.critical( 1211 E5MessageBox.critical(
1212 self.__ui, 1212 self.__ui,
1213 self.trUtf8("Subversion Error"), 1213 self.tr("Subversion Error"),
1214 self.trUtf8( 1214 self.tr(
1215 """The URL of the project repository has an""" 1215 """The URL of the project repository has an"""
1216 """ invalid format. The switch operation will""" 1216 """ invalid format. The switch operation will"""
1217 """ be aborted""")) 1217 """ be aborted"""))
1218 return False 1218 return False
1219 1219
1230 else: 1230 else:
1231 url = self.__svnURL(tag) 1231 url = self.__svnURL(tag)
1232 tn = url 1232 tn = url
1233 1233
1234 client = self.getClient() 1234 client = self.getClient()
1235 dlg = SvnDialog(self.trUtf8('Switching to {0}').format(tn), 1235 dlg = SvnDialog(self.tr('Switching to {0}').format(tn),
1236 "switch {0} {1}".format(url, name), 1236 "switch {0} {1}".format(url, name),
1237 client) 1237 client)
1238 QApplication.processEvents() 1238 QApplication.processEvents()
1239 locker = QMutexLocker(self.vcsExecutionMutex) 1239 locker = QMutexLocker(self.vcsExecutionMutex)
1240 try: 1240 try:
1241 rev = client.switch(name, url) 1241 rev = client.switch(name, url)
1242 dlg.showMessage(self.trUtf8("Revision {0}.\n").format(rev.number)) 1242 dlg.showMessage(self.tr("Revision {0}.\n").format(rev.number))
1243 except pysvn.ClientError as e: 1243 except pysvn.ClientError as e:
1244 dlg.showError(e.args[0]) 1244 dlg.showError(e.args[0])
1245 locker.unlock() 1245 locker.unlock()
1246 dlg.finish() 1246 dlg.finish()
1247 dlg.exec_() 1247 dlg.exec_()
1334 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified) 1334 revision2 = pysvn.Revision(pysvn.opt_revision_kind.unspecified)
1335 rev2 = "" 1335 rev2 = ""
1336 client = self.getClient() 1336 client = self.getClient()
1337 dlg = \ 1337 dlg = \
1338 SvnDialog( 1338 SvnDialog(
1339 self.trUtf8('Merging {0}').format(name), 1339 self.tr('Merging {0}').format(name),
1340 "merge{0}{1} {2} {3} {4}".format( 1340 "merge{0}{1} {2} {3} {4}".format(
1341 (not recurse) and " --non-recursive" or "", 1341 (not recurse) and " --non-recursive" or "",
1342 force and " --force" or "", 1342 force and " --force" or "",
1343 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""), 1343 "{0}{1}".format(url1, rev1 and ("@" + rev1) or ""),
1344 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""), 1344 "{0}{1}".format(url2, rev2 and ("@" + rev2) or ""),
1632 Public method used to cleanup the working copy. 1632 Public method used to cleanup the working copy.
1633 1633
1634 @param name directory name to be cleaned up (string) 1634 @param name directory name to be cleaned up (string)
1635 """ 1635 """
1636 client = self.getClient() 1636 client = self.getClient()
1637 dlg = SvnDialog(self.trUtf8('Cleaning up {0}').format(name), 1637 dlg = SvnDialog(self.tr('Cleaning up {0}').format(name),
1638 "cleanup {0}".format(name), 1638 "cleanup {0}".format(name),
1639 client) 1639 client)
1640 QApplication.processEvents() 1640 QApplication.processEvents()
1641 locker = QMutexLocker(self.vcsExecutionMutex) 1641 locker = QMutexLocker(self.vcsExecutionMutex)
1642 try: 1642 try:
1671 args = [] 1671 args = []
1672 self.addArguments(args, commandList) 1672 self.addArguments(args, commandList)
1673 1673
1674 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \ 1674 from Plugins.VcsPlugins.vcsSubversion.SvnDialog import \
1675 SvnDialog as SvnProcessDialog 1675 SvnDialog as SvnProcessDialog
1676 dia = SvnProcessDialog(self.trUtf8('Subversion command')) 1676 dia = SvnProcessDialog(self.tr('Subversion command'))
1677 res = dia.startProcess(args, wd) 1677 res = dia.startProcess(args, wd)
1678 if res: 1678 if res:
1679 dia.exec_() 1679 dia.exec_()
1680 1680
1681 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): 1681 def vcsOptionsDialog(self, project, archive, editable=False, parent=None):
1788 cwd = os.getcwd() 1788 cwd = os.getcwd()
1789 os.chdir(dname) 1789 os.chdir(dname)
1790 opts = self.options['global'] 1790 opts = self.options['global']
1791 recurse = "--non-recursive" not in opts 1791 recurse = "--non-recursive" not in opts
1792 client = self.getClient() 1792 client = self.getClient()
1793 dlg = SvnDialog(self.trUtf8('Resolving conficts'), 1793 dlg = SvnDialog(self.tr('Resolving conficts'),
1794 "resolved{0} {1}".format( 1794 "resolved{0} {1}".format(
1795 (not recurse) and " --non-recursive" or "", 1795 (not recurse) and " --non-recursive" or "",
1796 " ".join(fnames)), 1796 " ".join(fnames)),
1797 client) 1797 client)
1798 QApplication.processEvents() 1798 QApplication.processEvents()
1829 else: 1829 else:
1830 log = "" 1830 log = ""
1831 target = target 1831 target = target
1832 dlg = \ 1832 dlg = \
1833 SvnDialog( 1833 SvnDialog(
1834 self.trUtf8('Copying {0}').format(name), 1834 self.tr('Copying {0}').format(name),
1835 "copy{0} {1} {2}".format( 1835 "copy{0} {1} {2}".format(
1836 log and (" --message {0}".format(log)) or "", 1836 log and (" --message {0}".format(log)) or "",
1837 name, target), 1837 name, target),
1838 client, log=log) 1838 client, log=log)
1839 QApplication.processEvents() 1839 QApplication.processEvents()
1881 if dlg.exec_() == QDialog.Accepted: 1881 if dlg.exec_() == QDialog.Accepted:
1882 propName, propValue, recurse = dlg.getData() 1882 propName, propValue, recurse = dlg.getData()
1883 if not propName: 1883 if not propName:
1884 E5MessageBox.critical( 1884 E5MessageBox.critical(
1885 self.__ui, 1885 self.__ui,
1886 self.trUtf8("Subversion Set Property"), 1886 self.tr("Subversion Set Property"),
1887 self.trUtf8( 1887 self.tr(
1888 """You have to supply a property name. Aborting.""")) 1888 """You have to supply a property name. Aborting."""))
1889 return 1889 return
1890 1890
1891 if isinstance(name, list): 1891 if isinstance(name, list):
1892 dname, fnames = self.splitPathList(name) 1892 dname, fnames = self.splitPathList(name)
1900 opts = self.options['global'] 1900 opts = self.options['global']
1901 skipchecks = "--skip-checks" in opts 1901 skipchecks = "--skip-checks" in opts
1902 client = self.getClient() 1902 client = self.getClient()
1903 dlg = \ 1903 dlg = \
1904 SvnDialog( 1904 SvnDialog(
1905 self.trUtf8('Subversion Set Property'), 1905 self.tr('Subversion Set Property'),
1906 "propset{0}{1} {2} {3} {4}".format( 1906 "propset{0}{1} {2} {3} {4}".format(
1907 recurse and " --recurse" or "", 1907 recurse and " --recurse" or "",
1908 skipchecks and " --skip-checks" or "", 1908 skipchecks and " --skip-checks" or "",
1909 propName, propValue, 1909 propName, propValue,
1910 " ".join(fnames)), 1910 " ".join(fnames)),
1915 client.propset(propName, propValue, name, 1915 client.propset(propName, propValue, name,
1916 recurse=recurse, skip_checks=skipchecks) 1916 recurse=recurse, skip_checks=skipchecks)
1917 except pysvn.ClientError as e: 1917 except pysvn.ClientError as e:
1918 dlg.showError(e.args[0]) 1918 dlg.showError(e.args[0])
1919 locker.unlock() 1919 locker.unlock()
1920 dlg.showMessage(self.trUtf8("Property set.")) 1920 dlg.showMessage(self.tr("Property set."))
1921 dlg.finish() 1921 dlg.finish()
1922 dlg.exec_() 1922 dlg.exec_()
1923 os.chdir(cwd) 1923 os.chdir(cwd)
1924 1924
1925 def svnDelProp(self, name, recursive=False): 1925 def svnDelProp(self, name, recursive=False):
1935 propName, recurse = dlg.getData() 1935 propName, recurse = dlg.getData()
1936 1936
1937 if not propName: 1937 if not propName:
1938 E5MessageBox.critical( 1938 E5MessageBox.critical(
1939 self.__ui, 1939 self.__ui,
1940 self.trUtf8("Subversion Delete Property"), 1940 self.tr("Subversion Delete Property"),
1941 self.trUtf8( 1941 self.tr(
1942 """You have to supply a property name. Aborting.""")) 1942 """You have to supply a property name. Aborting."""))
1943 return 1943 return
1944 1944
1945 if isinstance(name, list): 1945 if isinstance(name, list):
1946 dname, fnames = self.splitPathList(name) 1946 dname, fnames = self.splitPathList(name)
1954 opts = self.options['global'] 1954 opts = self.options['global']
1955 skipchecks = "--skip-checks" in opts 1955 skipchecks = "--skip-checks" in opts
1956 client = self.getClient() 1956 client = self.getClient()
1957 dlg = \ 1957 dlg = \
1958 SvnDialog( 1958 SvnDialog(
1959 self.trUtf8('Subversion Delete Property'), 1959 self.tr('Subversion Delete Property'),
1960 "propdel{0}{1} {2} {3}".format( 1960 "propdel{0}{1} {2} {3}".format(
1961 recurse and " --recurse" or "", 1961 recurse and " --recurse" or "",
1962 skipchecks and " --skip-checks" or "", 1962 skipchecks and " --skip-checks" or "",
1963 propName, " ".join(fnames)), 1963 propName, " ".join(fnames)),
1964 client) 1964 client)
1968 client.propdel(propName, name, 1968 client.propdel(propName, name,
1969 recurse=recurse, skip_checks=skipchecks) 1969 recurse=recurse, skip_checks=skipchecks)
1970 except pysvn.ClientError as e: 1970 except pysvn.ClientError as e:
1971 dlg.showError(e.args[0]) 1971 dlg.showError(e.args[0])
1972 locker.unlock() 1972 locker.unlock()
1973 dlg.showMessage(self.trUtf8("Property deleted.")) 1973 dlg.showMessage(self.tr("Property deleted."))
1974 dlg.finish() 1974 dlg.finish()
1975 dlg.exec_() 1975 dlg.exec_()
1976 os.chdir(cwd) 1976 os.chdir(cwd)
1977 1977
1978 def svnListTagBranch(self, path, tags=True): 1978 def svnListTagBranch(self, path, tags=True):
2164 2164
2165 output1, error = self.__svnGetFileForRevision(name, rev=rev1) 2165 output1, error = self.__svnGetFileForRevision(name, rev=rev1)
2166 if error: 2166 if error:
2167 E5MessageBox.critical( 2167 E5MessageBox.critical(
2168 self.__ui, 2168 self.__ui,
2169 self.trUtf8("Subversion Side-by-Side Difference"), 2169 self.tr("Subversion Side-by-Side Difference"),
2170 error) 2170 error)
2171 return 2171 return
2172 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") 2172 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".")
2173 2173
2174 if rev2: 2174 if rev2:
2175 output2, error = self.__svnGetFileForRevision(name, rev=rev2) 2175 output2, error = self.__svnGetFileForRevision(name, rev=rev2)
2176 if error: 2176 if error:
2177 E5MessageBox.critical( 2177 E5MessageBox.critical(
2178 self.__ui, 2178 self.__ui,
2179 self.trUtf8("Subversion Side-by-Side Difference"), 2179 self.tr("Subversion Side-by-Side Difference"),
2180 error) 2180 error)
2181 return 2181 return
2182 name2 = "{0} (rev. {1})".format(name, rev2) 2182 name2 = "{0} (rev. {1})".format(name, rev2)
2183 else: 2183 else:
2184 try: 2184 try:
2187 f1.close() 2187 f1.close()
2188 name2 = name 2188 name2 = name
2189 except IOError: 2189 except IOError:
2190 E5MessageBox.critical( 2190 E5MessageBox.critical(
2191 self.__ui, 2191 self.__ui,
2192 self.trUtf8("Subversion Side-by-Side Difference"), 2192 self.tr("Subversion Side-by-Side Difference"),
2193 self.trUtf8( 2193 self.tr(
2194 """<p>The file <b>{0}</b> could not be read.</p>""") 2194 """<p>The file <b>{0}</b> could not be read.</p>""")
2195 .format(name)) 2195 .format(name))
2196 return 2196 return
2197 2197
2198 if self.sbsDiff is None: 2198 if self.sbsDiff is None:
2225 @param parent reference to the parent object of the subversion dialog 2225 @param parent reference to the parent object of the subversion dialog
2226 (QWidget) 2226 (QWidget)
2227 """ 2227 """
2228 comment, ok = QInputDialog.getText( 2228 comment, ok = QInputDialog.getText(
2229 None, 2229 None,
2230 self.trUtf8("Subversion Lock"), 2230 self.tr("Subversion Lock"),
2231 self.trUtf8("Enter lock comment"), 2231 self.tr("Enter lock comment"),
2232 QLineEdit.Normal) 2232 QLineEdit.Normal)
2233 2233
2234 if not ok: 2234 if not ok:
2235 return 2235 return
2236 2236
2244 cwd = os.getcwd() 2244 cwd = os.getcwd()
2245 os.chdir(dname) 2245 os.chdir(dname)
2246 client = self.getClient() 2246 client = self.getClient()
2247 dlg = \ 2247 dlg = \
2248 SvnDialog( 2248 SvnDialog(
2249 self.trUtf8('Locking in the Subversion repository'), 2249 self.tr('Locking in the Subversion repository'),
2250 "lock{0}{1} {2}".format( 2250 "lock{0}{1} {2}".format(
2251 stealIt and " --force" or "", 2251 stealIt and " --force" or "",
2252 comment and (" --message {0}".format(comment)) or "", 2252 comment and (" --message {0}".format(comment)) or "",
2253 " ".join(fnames)), 2253 " ".join(fnames)),
2254 client, parent=parent) 2254 client, parent=parent)
2284 cwd = os.getcwd() 2284 cwd = os.getcwd()
2285 os.chdir(dname) 2285 os.chdir(dname)
2286 client = self.getClient() 2286 client = self.getClient()
2287 dlg = \ 2287 dlg = \
2288 SvnDialog( 2288 SvnDialog(
2289 self.trUtf8('Unlocking in the Subversion repository'), 2289 self.tr('Unlocking in the Subversion repository'),
2290 "unlock{0} {1}".format( 2290 "unlock{0} {1}".format(
2291 breakIt and " --force" or "", 2291 breakIt and " --force" or "",
2292 " ".join(fnames)), 2292 " ".join(fnames)),
2293 client, parent=parent) 2293 client, parent=parent)
2294 QApplication.processEvents() 2294 QApplication.processEvents()
2331 else: 2331 else:
2332 msg = "relocate {0} {1} {2}".format(currUrl, newUrl, 2332 msg = "relocate {0} {1} {2}".format(currUrl, newUrl,
2333 projectPath) 2333 projectPath)
2334 client = self.getClient() 2334 client = self.getClient()
2335 dlg = \ 2335 dlg = \
2336 SvnDialog(self.trUtf8('Relocating'), msg, client) 2336 SvnDialog(self.tr('Relocating'), msg, client)
2337 QApplication.processEvents() 2337 QApplication.processEvents()
2338 locker = QMutexLocker(self.vcsExecutionMutex) 2338 locker = QMutexLocker(self.vcsExecutionMutex)
2339 try: 2339 try:
2340 if inside: 2340 if inside:
2341 client.switch(projectPath, newUrl) 2341 client.switch(projectPath, newUrl)
2359 url = None 2359 url = None
2360 2360
2361 if url is None: 2361 if url is None:
2362 url, ok = QInputDialog.getText( 2362 url, ok = QInputDialog.getText(
2363 None, 2363 None,
2364 self.trUtf8("Repository Browser"), 2364 self.tr("Repository Browser"),
2365 self.trUtf8("Enter the repository URL."), 2365 self.tr("Enter the repository URL."),
2366 QLineEdit.Normal) 2366 QLineEdit.Normal)
2367 if not ok or not url: 2367 if not ok or not url:
2368 return 2368 return
2369 2369
2370 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog 2370 from .SvnRepoBrowserDialog import SvnRepoBrowserDialog
2382 """ 2382 """
2383 if not isinstance(names, list): 2383 if not isinstance(names, list):
2384 names = [names] 2384 names = [names]
2385 client = self.getClient() 2385 client = self.getClient()
2386 dlg = \ 2386 dlg = \
2387 SvnDialog(self.trUtf8('Remove from changelist'), 2387 SvnDialog(self.tr('Remove from changelist'),
2388 "changelist --remove {0}".format(" ".join(names)), 2388 "changelist --remove {0}".format(" ".join(names)),
2389 client) 2389 client)
2390 QApplication.processEvents() 2390 QApplication.processEvents()
2391 locker = QMutexLocker(self.vcsExecutionMutex) 2391 locker = QMutexLocker(self.vcsExecutionMutex)
2392 try: 2392 try:
2410 if not isinstance(names, list): 2410 if not isinstance(names, list):
2411 names = [names] 2411 names = [names]
2412 2412
2413 clname, ok = QInputDialog.getItem( 2413 clname, ok = QInputDialog.getItem(
2414 None, 2414 None,
2415 self.trUtf8("Add to changelist"), 2415 self.tr("Add to changelist"),
2416 self.trUtf8("Enter name of the changelist:"), 2416 self.tr("Enter name of the changelist:"),
2417 sorted(self.svnGetChangelists()), 2417 sorted(self.svnGetChangelists()),
2418 0, True) 2418 0, True)
2419 if not ok or not clname: 2419 if not ok or not clname:
2420 return 2420 return
2421 2421
2422 client = self.getClient() 2422 client = self.getClient()
2423 dlg = \ 2423 dlg = \
2424 SvnDialog(self.trUtf8('Add to changelist'), 2424 SvnDialog(self.tr('Add to changelist'),
2425 "changelist {0}".format(" ".join(names)), 2425 "changelist {0}".format(" ".join(names)),
2426 client) 2426 client)
2427 QApplication.processEvents() 2427 QApplication.processEvents()
2428 locker = QMutexLocker(self.vcsExecutionMutex) 2428 locker = QMutexLocker(self.vcsExecutionMutex)
2429 try: 2429 try:
2478 2478
2479 @param path directory name to show change lists for (string) 2479 @param path directory name to show change lists for (string)
2480 """ 2480 """
2481 client = self.getClient() 2481 client = self.getClient()
2482 dlg = \ 2482 dlg = \
2483 SvnDialog(self.trUtf8('Upgrade'), 2483 SvnDialog(self.tr('Upgrade'),
2484 "upgrade {0}".format(path), 2484 "upgrade {0}".format(path),
2485 client) 2485 client)
2486 QApplication.processEvents() 2486 QApplication.processEvents()
2487 locker = QMutexLocker(self.vcsExecutionMutex) 2487 locker = QMutexLocker(self.vcsExecutionMutex)
2488 try: 2488 try:

eric ide

mercurial