223 self.version = tuple(v) |
223 self.version = tuple(v) |
224 self.__getExtensionsInfo() |
224 self.__getExtensionsInfo() |
225 return True, errMsg |
225 return True, errMsg |
226 else: |
226 else: |
227 if finished: |
227 if finished: |
228 errMsg = self.trUtf8( |
228 errMsg = self.tr( |
229 "The hg process finished with the exit code {0}")\ |
229 "The hg process finished with the exit code {0}")\ |
230 .format(process.exitCode()) |
230 .format(process.exitCode()) |
231 else: |
231 else: |
232 errMsg = self.trUtf8( |
232 errMsg = self.tr( |
233 "The hg process did not finish within 30s.") |
233 "The hg process did not finish within 30s.") |
234 else: |
234 else: |
235 errMsg = self.trUtf8("Could not start the hg executable.") |
235 errMsg = self.tr("Could not start the hg executable.") |
236 |
236 |
237 return False, errMsg |
237 return False, errMsg |
238 |
238 |
239 def vcsInit(self, vcsDir, noDialog=False): |
239 def vcsInit(self, vcsDir, noDialog=False): |
240 """ |
240 """ |
260 """ |
260 """ |
261 success = self.vcsImport(vcsDataDict, project.ppath)[0] |
261 success = self.vcsImport(vcsDataDict, project.ppath)[0] |
262 if not success: |
262 if not success: |
263 E5MessageBox.critical( |
263 E5MessageBox.critical( |
264 self.__ui, |
264 self.__ui, |
265 self.trUtf8("Create project repository"), |
265 self.tr("Create project repository"), |
266 self.trUtf8( |
266 self.tr( |
267 """The project repository could not be created.""")) |
267 """The project repository could not be created.""")) |
268 else: |
268 else: |
269 pfn = project.pfile |
269 pfn = project.pfile |
270 if not os.path.isfile(pfn): |
270 if not os.path.isfile(pfn): |
271 pfn += "z" |
271 pfn += "z" |
288 |
288 |
289 args = [] |
289 args = [] |
290 args.append('init') |
290 args.append('init') |
291 args.append(projectDir) |
291 args.append(projectDir) |
292 # init is not possible with the command server |
292 # init is not possible with the command server |
293 dia = HgDialog(self.trUtf8('Creating Mercurial repository'), self) |
293 dia = HgDialog(self.tr('Creating Mercurial repository'), self) |
294 res = dia.startProcess(args) |
294 res = dia.startProcess(args) |
295 if res: |
295 if res: |
296 dia.exec_() |
296 dia.exec_() |
297 status = dia.normalExit() |
297 status = dia.normalExit() |
298 |
298 |
306 args.append('commit') |
306 args.append('commit') |
307 args.append('--addremove') |
307 args.append('--addremove') |
308 args.append('--message') |
308 args.append('--message') |
309 args.append(msg) |
309 args.append(msg) |
310 dia = HgDialog( |
310 dia = HgDialog( |
311 self.trUtf8('Initial commit to Mercurial repository'), |
311 self.tr('Initial commit to Mercurial repository'), |
312 self) |
312 self) |
313 res = dia.startProcess(args, projectDir) |
313 res = dia.startProcess(args, projectDir) |
314 if res: |
314 if res: |
315 dia.exec_() |
315 dia.exec_() |
316 status = dia.normalExit() |
316 status = dia.normalExit() |
354 else: |
354 else: |
355 out, err = self.__client.runcommand(args) |
355 out, err = self.__client.runcommand(args) |
356 return err == "" |
356 return err == "" |
357 else: |
357 else: |
358 dia = HgDialog( |
358 dia = HgDialog( |
359 self.trUtf8('Cloning project from a Mercurial repository'), |
359 self.tr('Cloning project from a Mercurial repository'), |
360 self) |
360 self) |
361 res = dia.startProcess(args) |
361 res = dia.startProcess(args) |
362 if res: |
362 if res: |
363 dia.exec_() |
363 dia.exec_() |
364 return dia.normalExit() |
364 return dia.normalExit() |
451 break |
451 break |
452 |
452 |
453 if not ok: |
453 if not ok: |
454 res = E5MessageBox.yesNo( |
454 res = E5MessageBox.yesNo( |
455 self.__ui, |
455 self.__ui, |
456 self.trUtf8("Commit Changes"), |
456 self.tr("Commit Changes"), |
457 self.trUtf8( |
457 self.tr( |
458 """The commit affects files, that have unsaved""" |
458 """The commit affects files, that have unsaved""" |
459 """ changes. Shall the commit be continued?"""), |
459 """ changes. Shall the commit be continued?"""), |
460 icon=E5MessageBox.Warning) |
460 icon=E5MessageBox.Warning) |
461 if not res: |
461 if not res: |
462 return |
462 return |
518 |
518 |
519 if noDialog: |
519 if noDialog: |
520 self.startSynchronizedProcess(QProcess(), "hg", args, dname) |
520 self.startSynchronizedProcess(QProcess(), "hg", args, dname) |
521 else: |
521 else: |
522 dia = HgDialog( |
522 dia = HgDialog( |
523 self.trUtf8('Committing changes to Mercurial repository'), |
523 self.tr('Committing changes to Mercurial repository'), |
524 self) |
524 self) |
525 res = dia.startProcess(args, dname) |
525 res = dia.startProcess(args, dname) |
526 if res: |
526 if res: |
527 dia.exec_() |
527 dia.exec_() |
528 self.committed.emit() |
528 self.committed.emit() |
572 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
572 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
573 else: |
573 else: |
574 out, err = self.__client.runcommand(args) |
574 out, err = self.__client.runcommand(args) |
575 res = False |
575 res = False |
576 else: |
576 else: |
577 dia = HgDialog(self.trUtf8( |
577 dia = HgDialog(self.tr( |
578 'Synchronizing with the Mercurial repository'), |
578 'Synchronizing with the Mercurial repository'), |
579 self) |
579 self) |
580 res = dia.startProcess(args, repodir) |
580 res = dia.startProcess(args, repodir) |
581 if res: |
581 if res: |
582 dia.exec_() |
582 dia.exec_() |
626 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
626 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
627 else: |
627 else: |
628 out, err = self.__client.runcommand(args) |
628 out, err = self.__client.runcommand(args) |
629 else: |
629 else: |
630 dia = HgDialog( |
630 dia = HgDialog( |
631 self.trUtf8( |
631 self.tr( |
632 'Adding files/directories to the Mercurial repository'), |
632 'Adding files/directories to the Mercurial repository'), |
633 self) |
633 self) |
634 res = dia.startProcess(args, repodir) |
634 res = dia.startProcess(args, repodir) |
635 if res: |
635 if res: |
636 dia.exec_() |
636 dia.exec_() |
764 QProcess(), 'hg', args, repodir) |
764 QProcess(), 'hg', args, repodir) |
765 else: |
765 else: |
766 out, err = self.__client.runcommand(args) |
766 out, err = self.__client.runcommand(args) |
767 res = err == "" |
767 res = err == "" |
768 else: |
768 else: |
769 dia = HgDialog(self.trUtf8('Renaming {0}').format(name), self) |
769 dia = HgDialog(self.tr('Renaming {0}').format(name), self) |
770 res = dia.startProcess(args, repodir) |
770 res = dia.startProcess(args, repodir) |
771 if res: |
771 if res: |
772 dia.exec_() |
772 dia.exec_() |
773 res = dia.normalExit() |
773 res = dia.normalExit() |
774 if res: |
774 if res: |
928 args.append("Created {1}tag <{0}>.".format(tag, msgPart)) |
928 args.append("Created {1}tag <{0}>.".format(tag, msgPart)) |
929 else: |
929 else: |
930 args.append("Removed {1}tag <{0}>.".format(tag, msgPart)) |
930 args.append("Removed {1}tag <{0}>.".format(tag, msgPart)) |
931 args.append(tag) |
931 args.append(tag) |
932 |
932 |
933 dia = HgDialog(self.trUtf8('Tagging in the Mercurial repository'), |
933 dia = HgDialog(self.tr('Tagging in the Mercurial repository'), |
934 self) |
934 self) |
935 res = dia.startProcess(args, repodir) |
935 res = dia.startProcess(args, repodir) |
936 if res: |
936 if res: |
937 dia.exec_() |
937 dia.exec_() |
938 |
938 |
973 if names[0]: |
973 if names[0]: |
974 from UI.DeleteFilesConfirmationDialog import \ |
974 from UI.DeleteFilesConfirmationDialog import \ |
975 DeleteFilesConfirmationDialog |
975 DeleteFilesConfirmationDialog |
976 dlg = DeleteFilesConfirmationDialog( |
976 dlg = DeleteFilesConfirmationDialog( |
977 self.parent(), |
977 self.parent(), |
978 self.trUtf8("Revert changes"), |
978 self.tr("Revert changes"), |
979 self.trUtf8( |
979 self.tr( |
980 "Do you really want to revert all changes to these files" |
980 "Do you really want to revert all changes to these files" |
981 " or directories?"), |
981 " or directories?"), |
982 names) |
982 names) |
983 yes = dlg.exec_() == QDialog.Accepted |
983 yes = dlg.exec_() == QDialog.Accepted |
984 else: |
984 else: |
985 yes = E5MessageBox.yesNo( |
985 yes = E5MessageBox.yesNo( |
986 None, |
986 None, |
987 self.trUtf8("Revert changes"), |
987 self.tr("Revert changes"), |
988 self.trUtf8("""Do you really want to revert all changes of""" |
988 self.tr("""Do you really want to revert all changes of""" |
989 """ the project?""")) |
989 """ the project?""")) |
990 if yes: |
990 if yes: |
991 dia = HgDialog(self.trUtf8('Reverting changes'), self) |
991 dia = HgDialog(self.tr('Reverting changes'), self) |
992 res = dia.startProcess(args, repodir) |
992 res = dia.startProcess(args, repodir) |
993 if res: |
993 if res: |
994 dia.exec_() |
994 dia.exec_() |
995 res = dia.hasAddOrDelete() |
995 res = dia.hasAddOrDelete() |
996 self.checkVCSStatus() |
996 self.checkVCSStatus() |
1041 args.append("--force") |
1041 args.append("--force") |
1042 if rev: |
1042 if rev: |
1043 args.append("--rev") |
1043 args.append("--rev") |
1044 args.append(rev) |
1044 args.append(rev) |
1045 |
1045 |
1046 dia = HgDialog(self.trUtf8('Merging').format(name), self) |
1046 dia = HgDialog(self.tr('Merging').format(name), self) |
1047 res = dia.startProcess(args, repodir) |
1047 res = dia.startProcess(args, repodir) |
1048 if res: |
1048 if res: |
1049 dia.exec_() |
1049 dia.exec_() |
1050 self.checkVCSStatus() |
1050 self.checkVCSStatus() |
1051 |
1051 |
1299 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
1299 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
1300 repodir = os.path.dirname(repodir) |
1300 repodir = os.path.dirname(repodir) |
1301 if os.path.splitdrive(repodir)[1] == os.sep: |
1301 if os.path.splitdrive(repodir)[1] == os.sep: |
1302 return |
1302 return |
1303 |
1303 |
1304 dia = HgDialog(self.trUtf8('Mercurial command'), self) |
1304 dia = HgDialog(self.tr('Mercurial command'), self) |
1305 res = dia.startProcess(args, repodir) |
1305 res = dia.startProcess(args, repodir) |
1306 if res: |
1306 if res: |
1307 dia.exec_() |
1307 dia.exec_() |
1308 |
1308 |
1309 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): |
1309 def vcsOptionsDialog(self, project, archive, editable=False, parent=None): |
1512 repodir = os.path.dirname(repodir) |
1512 repodir = os.path.dirname(repodir) |
1513 if os.path.splitdrive(repodir)[1] == os.sep: |
1513 if os.path.splitdrive(repodir)[1] == os.sep: |
1514 return False |
1514 return False |
1515 |
1515 |
1516 dia = HgDialog( |
1516 dia = HgDialog( |
1517 self.trUtf8('Copying {0}').format(name), self) |
1517 self.tr('Copying {0}').format(name), self) |
1518 res = dia.startProcess(args, repodir) |
1518 res = dia.startProcess(args, repodir) |
1519 if res: |
1519 if res: |
1520 dia.exec_() |
1520 dia.exec_() |
1521 res = dia.normalExit() |
1521 res = dia.normalExit() |
1522 if res and \ |
1522 if res and \ |
1761 else: |
1761 else: |
1762 error = str( |
1762 error = str( |
1763 process.readAllStandardError(), |
1763 process.readAllStandardError(), |
1764 Preferences.getSystem("IOEncoding"), 'replace') |
1764 Preferences.getSystem("IOEncoding"), 'replace') |
1765 else: |
1765 else: |
1766 error = self.trUtf8( |
1766 error = self.tr( |
1767 "The hg process did not finish within 30s.") |
1767 "The hg process did not finish within 30s.") |
1768 else: |
1768 else: |
1769 error = self.trUtf8( |
1769 error = self.tr( |
1770 'The process {0} could not be started. ' |
1770 'The process {0} could not be started. ' |
1771 'Ensure, that it is in the search path.').format('hg') |
1771 'Ensure, that it is in the search path.').format('hg') |
1772 else: |
1772 else: |
1773 output, error = self.__client.runcommand(args) |
1773 output, error = self.__client.runcommand(args) |
1774 |
1774 |
1815 |
1815 |
1816 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1816 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1817 if error: |
1817 if error: |
1818 E5MessageBox.critical( |
1818 E5MessageBox.critical( |
1819 self.__ui, |
1819 self.__ui, |
1820 self.trUtf8("Mercurial Side-by-Side Difference"), |
1820 self.tr("Mercurial Side-by-Side Difference"), |
1821 error) |
1821 error) |
1822 return |
1822 return |
1823 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1823 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1824 |
1824 |
1825 if rev2: |
1825 if rev2: |
1826 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1826 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1827 if error: |
1827 if error: |
1828 E5MessageBox.critical( |
1828 E5MessageBox.critical( |
1829 self.__ui, |
1829 self.__ui, |
1830 self.trUtf8("Mercurial Side-by-Side Difference"), |
1830 self.tr("Mercurial Side-by-Side Difference"), |
1831 error) |
1831 error) |
1832 return |
1832 return |
1833 name2 = "{0} (rev. {1})".format(name, rev2) |
1833 name2 = "{0} (rev. {1})".format(name, rev2) |
1834 else: |
1834 else: |
1835 try: |
1835 try: |
1912 """ |
1912 """ |
1913 if self.getPlugin().getPreferences("PreferUnbundle") and \ |
1913 if self.getPlugin().getPreferences("PreferUnbundle") and \ |
1914 self.bundleFile and \ |
1914 self.bundleFile and \ |
1915 os.path.exists(self.bundleFile): |
1915 os.path.exists(self.bundleFile): |
1916 command = "unbundle" |
1916 command = "unbundle" |
1917 title = self.trUtf8('Apply changegroups') |
1917 title = self.tr('Apply changegroups') |
1918 else: |
1918 else: |
1919 command = "pull" |
1919 command = "pull" |
1920 title = self.trUtf8('Pulling from a remote Mercurial repository') |
1920 title = self.tr('Pulling from a remote Mercurial repository') |
1921 |
1921 |
1922 args = [] |
1922 args = [] |
1923 args.append(command) |
1923 args.append(command) |
1924 self.addArguments(args, self.options['global']) |
1924 self.addArguments(args, self.options['global']) |
1925 args.append('-v') |
1925 args.append('-v') |
1969 repodir = os.path.dirname(repodir) |
1969 repodir = os.path.dirname(repodir) |
1970 if os.path.splitdrive(repodir)[1] == os.sep: |
1970 if os.path.splitdrive(repodir)[1] == os.sep: |
1971 return |
1971 return |
1972 |
1972 |
1973 dia = HgDialog( |
1973 dia = HgDialog( |
1974 self.trUtf8('Pushing to a remote Mercurial repository'), self) |
1974 self.tr('Pushing to a remote Mercurial repository'), self) |
1975 res = dia.startProcess(args, repodir) |
1975 res = dia.startProcess(args, repodir) |
1976 if res: |
1976 if res: |
1977 dia.exec_() |
1977 dia.exec_() |
1978 res = dia.hasAddOrDelete() |
1978 res = dia.hasAddOrDelete() |
1979 self.checkVCSStatus() |
1979 self.checkVCSStatus() |
2099 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
2099 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
2100 repodir = os.path.dirname(repodir) |
2100 repodir = os.path.dirname(repodir) |
2101 if os.path.splitdrive(repodir)[1] == os.sep: |
2101 if os.path.splitdrive(repodir)[1] == os.sep: |
2102 return |
2102 return |
2103 |
2103 |
2104 dia = HgDialog(self.trUtf8('Resolving files/directories'), self) |
2104 dia = HgDialog(self.tr('Resolving files/directories'), self) |
2105 res = dia.startProcess(args, repodir) |
2105 res = dia.startProcess(args, repodir) |
2106 if res: |
2106 if res: |
2107 dia.exec_() |
2107 dia.exec_() |
2108 self.checkVCSStatus() |
2108 self.checkVCSStatus() |
2109 |
2109 |
2122 if os.path.splitdrive(repodir)[1] == os.sep: |
2122 if os.path.splitdrive(repodir)[1] == os.sep: |
2123 return |
2123 return |
2124 |
2124 |
2125 name, ok = QInputDialog.getItem( |
2125 name, ok = QInputDialog.getItem( |
2126 None, |
2126 None, |
2127 self.trUtf8("Create Branch"), |
2127 self.tr("Create Branch"), |
2128 self.trUtf8("Enter branch name"), |
2128 self.tr("Enter branch name"), |
2129 sorted(self.hgGetBranchesList(repodir)), |
2129 sorted(self.hgGetBranchesList(repodir)), |
2130 0, True) |
2130 0, True) |
2131 if ok and name: |
2131 if ok and name: |
2132 args = [] |
2132 args = [] |
2133 args.append('branch') |
2133 args.append('branch') |
2134 args.append(name.strip().replace(" ", "_")) |
2134 args.append(name.strip().replace(" ", "_")) |
2135 |
2135 |
2136 dia = HgDialog( |
2136 dia = HgDialog( |
2137 self.trUtf8('Creating branch in the Mercurial repository'), |
2137 self.tr('Creating branch in the Mercurial repository'), |
2138 self) |
2138 self) |
2139 res = dia.startProcess(args, repodir) |
2139 res = dia.startProcess(args, repodir) |
2140 if res: |
2140 if res: |
2141 dia.exec_() |
2141 dia.exec_() |
2142 |
2142 |
2156 return |
2156 return |
2157 |
2157 |
2158 args = [] |
2158 args = [] |
2159 args.append("branch") |
2159 args.append("branch") |
2160 |
2160 |
2161 dia = HgDialog(self.trUtf8('Showing current branch'), self) |
2161 dia = HgDialog(self.tr('Showing current branch'), self) |
2162 res = dia.startProcess(args, repodir, False) |
2162 res = dia.startProcess(args, repodir, False) |
2163 if res: |
2163 if res: |
2164 dia.exec_() |
2164 dia.exec_() |
2165 |
2165 |
2166 def hgEditUserConfig(self): |
2166 def hgEditUserConfig(self): |
2250 args = [] |
2250 args = [] |
2251 args.append('showconfig') |
2251 args.append('showconfig') |
2252 args.append("--untrusted") |
2252 args.append("--untrusted") |
2253 |
2253 |
2254 dia = HgDialog( |
2254 dia = HgDialog( |
2255 self.trUtf8('Showing the combined configuration settings'), |
2255 self.tr('Showing the combined configuration settings'), |
2256 self) |
2256 self) |
2257 res = dia.startProcess(args, repodir, False) |
2257 res = dia.startProcess(args, repodir, False) |
2258 if res: |
2258 if res: |
2259 dia.exec_() |
2259 dia.exec_() |
2260 |
2260 |
2324 return |
2324 return |
2325 |
2325 |
2326 args = [] |
2326 args = [] |
2327 args.append('identify') |
2327 args.append('identify') |
2328 |
2328 |
2329 dia = HgDialog(self.trUtf8('Identifying project directory'), self) |
2329 dia = HgDialog(self.tr('Identifying project directory'), self) |
2330 res = dia.startProcess(args, repodir, False) |
2330 res = dia.startProcess(args, repodir, False) |
2331 if res: |
2331 if res: |
2332 dia.exec_() |
2332 dia.exec_() |
2333 |
2333 |
2334 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2334 def hgCreateIgnoreFile(self, name, autoAdd=False): |
2362 |
2362 |
2363 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2363 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2364 if os.path.exists(ignoreName): |
2364 if os.path.exists(ignoreName): |
2365 res = E5MessageBox.yesNo( |
2365 res = E5MessageBox.yesNo( |
2366 self.__ui, |
2366 self.__ui, |
2367 self.trUtf8("Create .hgignore file"), |
2367 self.tr("Create .hgignore file"), |
2368 self.trUtf8("""<p>The file <b>{0}</b> exists already.""" |
2368 self.tr("""<p>The file <b>{0}</b> exists already.""" |
2369 """ Overwrite it?</p>""").format(ignoreName), |
2369 """ Overwrite it?</p>""").format(ignoreName), |
2370 icon=E5MessageBox.Warning) |
2370 icon=E5MessageBox.Warning) |
2371 else: |
2371 else: |
2372 res = True |
2372 res = True |
2373 if res: |
2373 if res: |
2374 try: |
2374 try: |
2416 if dlg.exec_() == QDialog.Accepted: |
2416 if dlg.exec_() == QDialog.Accepted: |
2417 revs, baseRevs, compression, all = dlg.getParameters() |
2417 revs, baseRevs, compression, all = dlg.getParameters() |
2418 |
2418 |
2419 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2419 fname, selectedFilter = E5FileDialog.getSaveFileNameAndFilter( |
2420 None, |
2420 None, |
2421 self.trUtf8("Create changegroup"), |
2421 self.tr("Create changegroup"), |
2422 self.__lastChangeGroupPath or repodir, |
2422 self.__lastChangeGroupPath or repodir, |
2423 self.trUtf8("Mercurial Changegroup Files (*.hg)"), |
2423 self.tr("Mercurial Changegroup Files (*.hg)"), |
2424 None, |
2424 None, |
2425 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
2425 E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite)) |
2426 |
2426 |
2427 if not fname: |
2427 if not fname: |
2428 return # user aborted |
2428 return # user aborted |
2433 if ex: |
2433 if ex: |
2434 fname += ex |
2434 fname += ex |
2435 if QFileInfo(fname).exists(): |
2435 if QFileInfo(fname).exists(): |
2436 res = E5MessageBox.yesNo( |
2436 res = E5MessageBox.yesNo( |
2437 self.__ui, |
2437 self.__ui, |
2438 self.trUtf8("Create changegroup"), |
2438 self.tr("Create changegroup"), |
2439 self.trUtf8("<p>The Mercurial changegroup file <b>{0}</b> " |
2439 self.tr("<p>The Mercurial changegroup file <b>{0}</b> " |
2440 "already exists. Overwrite it?</p>") |
2440 "already exists. Overwrite it?</p>") |
2441 .format(fname), |
2441 .format(fname), |
2442 icon=E5MessageBox.Warning) |
2442 icon=E5MessageBox.Warning) |
2443 if not res: |
2443 if not res: |
2444 return |
2444 return |
2445 fname = Utilities.toNativeSeparators(fname) |
2445 fname = Utilities.toNativeSeparators(fname) |
2458 if compression: |
2458 if compression: |
2459 args.append("--type") |
2459 args.append("--type") |
2460 args.append(compression) |
2460 args.append(compression) |
2461 args.append(fname) |
2461 args.append(fname) |
2462 |
2462 |
2463 dia = HgDialog(self.trUtf8('Create changegroup'), self) |
2463 dia = HgDialog(self.tr('Create changegroup'), self) |
2464 res = dia.startProcess(args, repodir) |
2464 res = dia.startProcess(args, repodir) |
2465 if res: |
2465 if res: |
2466 dia.exec_() |
2466 dia.exec_() |
2467 |
2467 |
2468 def hgPreviewBundle(self, name): |
2468 def hgPreviewBundle(self, name): |
2481 if os.path.splitdrive(repodir)[1] == os.sep: |
2481 if os.path.splitdrive(repodir)[1] == os.sep: |
2482 return |
2482 return |
2483 |
2483 |
2484 file = E5FileDialog.getOpenFileName( |
2484 file = E5FileDialog.getOpenFileName( |
2485 None, |
2485 None, |
2486 self.trUtf8("Preview changegroup"), |
2486 self.tr("Preview changegroup"), |
2487 self.__lastChangeGroupPath or repodir, |
2487 self.__lastChangeGroupPath or repodir, |
2488 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2488 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2489 if file: |
2489 if file: |
2490 self.__lastChangeGroupPath = os.path.dirname(file) |
2490 self.__lastChangeGroupPath = os.path.dirname(file) |
2491 |
2491 |
2492 if self.getPlugin().getPreferences("UseLogBrowser"): |
2492 if self.getPlugin().getPreferences("UseLogBrowser"): |
2493 from .HgLogBrowserDialog import HgLogBrowserDialog |
2493 from .HgLogBrowserDialog import HgLogBrowserDialog |
2516 if os.path.splitdrive(repodir)[1] == os.sep: |
2516 if os.path.splitdrive(repodir)[1] == os.sep: |
2517 return |
2517 return |
2518 |
2518 |
2519 file = E5FileDialog.getOpenFileName( |
2519 file = E5FileDialog.getOpenFileName( |
2520 None, |
2520 None, |
2521 self.trUtf8("Preview changegroup"), |
2521 self.tr("Preview changegroup"), |
2522 self.__lastChangeGroupPath or repodir, |
2522 self.__lastChangeGroupPath or repodir, |
2523 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2523 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2524 if file: |
2524 if file: |
2525 self.__lastChangeGroupPath = os.path.dirname(file) |
2525 self.__lastChangeGroupPath = os.path.dirname(file) |
2526 |
2526 |
2527 args = [] |
2527 args = [] |
2528 args.append('identify') |
2528 args.append('identify') |
2529 args.append(file) |
2529 args.append(file) |
2530 |
2530 |
2531 dia = HgDialog(self.trUtf8('Identifying changegroup file'), self) |
2531 dia = HgDialog(self.tr('Identifying changegroup file'), self) |
2532 res = dia.startProcess(args, repodir, False) |
2532 res = dia.startProcess(args, repodir, False) |
2533 if res: |
2533 if res: |
2534 dia.exec_() |
2534 dia.exec_() |
2535 |
2535 |
2536 def hgUnbundle(self, name): |
2536 def hgUnbundle(self, name): |
2551 return |
2551 return |
2552 |
2552 |
2553 res = False |
2553 res = False |
2554 files = E5FileDialog.getOpenFileNames( |
2554 files = E5FileDialog.getOpenFileNames( |
2555 None, |
2555 None, |
2556 self.trUtf8("Apply changegroups"), |
2556 self.tr("Apply changegroups"), |
2557 self.__lastChangeGroupPath or repodir, |
2557 self.__lastChangeGroupPath or repodir, |
2558 self.trUtf8("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2558 self.tr("Mercurial Changegroup Files (*.hg);;All Files (*)")) |
2559 if files: |
2559 if files: |
2560 self.__lastChangeGroupPath = os.path.dirname(files[0]) |
2560 self.__lastChangeGroupPath = os.path.dirname(files[0]) |
2561 |
2561 |
2562 update = E5MessageBox.yesNo( |
2562 update = E5MessageBox.yesNo( |
2563 self.__ui, |
2563 self.__ui, |
2564 self.trUtf8("Apply changegroups"), |
2564 self.tr("Apply changegroups"), |
2565 self.trUtf8("""Shall the working directory be updated?"""), |
2565 self.tr("""Shall the working directory be updated?"""), |
2566 yesDefault=True) |
2566 yesDefault=True) |
2567 |
2567 |
2568 args = [] |
2568 args = [] |
2569 args.append('unbundle') |
2569 args.append('unbundle') |
2570 if update: |
2570 if update: |
2571 args.append("--update") |
2571 args.append("--update") |
2572 args.append("--verbose") |
2572 args.append("--verbose") |
2573 args.extend(files) |
2573 args.extend(files) |
2574 |
2574 |
2575 dia = HgDialog(self.trUtf8('Apply changegroups'), self) |
2575 dia = HgDialog(self.tr('Apply changegroups'), self) |
2576 res = dia.startProcess(args, repodir) |
2576 res = dia.startProcess(args, repodir) |
2577 if res: |
2577 if res: |
2578 dia.exec_() |
2578 dia.exec_() |
2579 res = dia.hasAddOrDelete() |
2579 res = dia.hasAddOrDelete() |
2580 self.checkVCSStatus() |
2580 self.checkVCSStatus() |
2589 'skip' or 'reset') |
2589 'skip' or 'reset') |
2590 @exception ValueError raised to indicate an invalid bisect subcommand |
2590 @exception ValueError raised to indicate an invalid bisect subcommand |
2591 """ |
2591 """ |
2592 if subcommand not in ("good", "bad", "skip", "reset"): |
2592 if subcommand not in ("good", "bad", "skip", "reset"): |
2593 raise ValueError( |
2593 raise ValueError( |
2594 self.trUtf8("Bisect subcommand ({0}) invalid.") |
2594 self.tr("Bisect subcommand ({0}) invalid.") |
2595 .format(subcommand)) |
2595 .format(subcommand)) |
2596 |
2596 |
2597 dname, fname = self.splitPath(name) |
2597 dname, fname = self.splitPath(name) |
2598 |
2598 |
2599 # find the root of the repo |
2599 # find the root of the repo |
2626 args.append("--{0}".format(subcommand)) |
2626 args.append("--{0}".format(subcommand)) |
2627 if rev: |
2627 if rev: |
2628 args.append(rev) |
2628 args.append(rev) |
2629 |
2629 |
2630 dia = HgDialog( |
2630 dia = HgDialog( |
2631 self.trUtf8('Mercurial Bisect ({0})').format(subcommand), self) |
2631 self.tr('Mercurial Bisect ({0})').format(subcommand), self) |
2632 res = dia.startProcess(args, repodir) |
2632 res = dia.startProcess(args, repodir) |
2633 if res: |
2633 if res: |
2634 dia.exec_() |
2634 dia.exec_() |
2635 |
2635 |
2636 def hgForget(self, name): |
2636 def hgForget(self, name): |
2660 repodir = os.path.dirname(repodir) |
2660 repodir = os.path.dirname(repodir) |
2661 if os.path.splitdrive(repodir)[1] == os.sep: |
2661 if os.path.splitdrive(repodir)[1] == os.sep: |
2662 return |
2662 return |
2663 |
2663 |
2664 dia = HgDialog( |
2664 dia = HgDialog( |
2665 self.trUtf8('Removing files from the Mercurial repository only'), |
2665 self.tr('Removing files from the Mercurial repository only'), |
2666 self) |
2666 self) |
2667 res = dia.startProcess(args, repodir) |
2667 res = dia.startProcess(args, repodir) |
2668 if res: |
2668 if res: |
2669 dia.exec_() |
2669 dia.exec_() |
2670 if isinstance(name, list): |
2670 if isinstance(name, list): |
2701 if dlg.exec_() == QDialog.Accepted: |
2701 if dlg.exec_() == QDialog.Accepted: |
2702 rev, merge, date, user, message = dlg.getParameters() |
2702 rev, merge, date, user, message = dlg.getParameters() |
2703 if not rev: |
2703 if not rev: |
2704 E5MessageBox.warning( |
2704 E5MessageBox.warning( |
2705 self.__ui, |
2705 self.__ui, |
2706 self.trUtf8("Backing out changeset"), |
2706 self.tr("Backing out changeset"), |
2707 self.trUtf8("""No revision given. Aborting...""")) |
2707 self.tr("""No revision given. Aborting...""")) |
2708 return |
2708 return |
2709 |
2709 |
2710 args = [] |
2710 args = [] |
2711 args.append('backout') |
2711 args.append('backout') |
2712 args.append('-v') |
2712 args.append('-v') |
2720 args.append(user) |
2720 args.append(user) |
2721 args.append('--message') |
2721 args.append('--message') |
2722 args.append(message) |
2722 args.append(message) |
2723 args.append(rev) |
2723 args.append(rev) |
2724 |
2724 |
2725 dia = HgDialog(self.trUtf8('Backing out changeset'), self) |
2725 dia = HgDialog(self.tr('Backing out changeset'), self) |
2726 res = dia.startProcess(args, repodir) |
2726 res = dia.startProcess(args, repodir) |
2727 if res: |
2727 if res: |
2728 dia.exec_() |
2728 dia.exec_() |
2729 |
2729 |
2730 def hgRollback(self, name): |
2730 def hgRollback(self, name): |
2742 if os.path.splitdrive(repodir)[1] == os.sep: |
2742 if os.path.splitdrive(repodir)[1] == os.sep: |
2743 return |
2743 return |
2744 |
2744 |
2745 res = E5MessageBox.yesNo( |
2745 res = E5MessageBox.yesNo( |
2746 None, |
2746 None, |
2747 self.trUtf8("Rollback last transaction"), |
2747 self.tr("Rollback last transaction"), |
2748 self.trUtf8("""Are you sure you want to rollback the last""" |
2748 self.tr("""Are you sure you want to rollback the last""" |
2749 """ transaction?"""), |
2749 """ transaction?"""), |
2750 icon=E5MessageBox.Warning) |
2750 icon=E5MessageBox.Warning) |
2751 if res: |
2751 if res: |
2752 dia = HgDialog(self.trUtf8('Rollback last transaction'), self) |
2752 dia = HgDialog(self.tr('Rollback last transaction'), self) |
2753 res = dia.startProcess(["rollback"], repodir) |
2753 res = dia.startProcess(["rollback"], repodir) |
2754 if res: |
2754 if res: |
2755 dia.exec_() |
2755 dia.exec_() |
2756 |
2756 |
2757 def hgServe(self, name): |
2757 def hgServe(self, name): |
2816 args.append(str(stripCount)) |
2816 args.append(str(stripCount)) |
2817 if force: |
2817 if force: |
2818 args.append("--force") |
2818 args.append("--force") |
2819 args.append(patchFile) |
2819 args.append(patchFile) |
2820 |
2820 |
2821 dia = HgDialog(self.trUtf8("Import Patch"), self) |
2821 dia = HgDialog(self.tr("Import Patch"), self) |
2822 res = dia.startProcess(args, repodir) |
2822 res = dia.startProcess(args, repodir) |
2823 if res: |
2823 if res: |
2824 dia.exec_() |
2824 dia.exec_() |
2825 res = dia.hasAddOrDelete() |
2825 res = dia.hasAddOrDelete() |
2826 self.checkVCSStatus() |
2826 self.checkVCSStatus() |
2864 if git: |
2864 if git: |
2865 args.append("--git") |
2865 args.append("--git") |
2866 for rev in revisions: |
2866 for rev in revisions: |
2867 args.append(rev) |
2867 args.append(rev) |
2868 |
2868 |
2869 dia = HgDialog(self.trUtf8("Export Patches"), self) |
2869 dia = HgDialog(self.tr("Export Patches"), self) |
2870 res = dia.startProcess(args, repodir) |
2870 res = dia.startProcess(args, repodir) |
2871 if res: |
2871 if res: |
2872 dia.exec_() |
2872 dia.exec_() |
2873 |
2873 |
2874 def hgPhase(self, name, data=None): |
2874 def hgPhase(self, name, data=None): |
2966 args.append("--log") |
2966 args.append("--log") |
2967 if dryrun: |
2967 if dryrun: |
2968 args.append("--dry-run") |
2968 args.append("--dry-run") |
2969 args.extend(revs) |
2969 args.extend(revs) |
2970 |
2970 |
2971 dia = HgDialog(self.trUtf8('Copy Changesets'), self) |
2971 dia = HgDialog(self.tr('Copy Changesets'), self) |
2972 res = dia.startProcess(args, repodir) |
2972 res = dia.startProcess(args, repodir) |
2973 if res: |
2973 if res: |
2974 dia.exec_() |
2974 dia.exec_() |
2975 res = dia.hasAddOrDelete() |
2975 res = dia.hasAddOrDelete() |
2976 self.checkVCSStatus() |
2976 self.checkVCSStatus() |
2993 args = [] |
2993 args = [] |
2994 args.append("graft") |
2994 args.append("graft") |
2995 args.append("--continue") |
2995 args.append("--continue") |
2996 args.append("--verbose") |
2996 args.append("--verbose") |
2997 |
2997 |
2998 dia = HgDialog(self.trUtf8('Copy Changesets (Continue)'), self) |
2998 dia = HgDialog(self.tr('Copy Changesets (Continue)'), self) |
2999 res = dia.startProcess(args, repodir) |
2999 res = dia.startProcess(args, repodir) |
3000 if res: |
3000 if res: |
3001 dia.exec_() |
3001 dia.exec_() |
3002 res = dia.hasAddOrDelete() |
3002 res = dia.hasAddOrDelete() |
3003 self.checkVCSStatus() |
3003 self.checkVCSStatus() |
3029 args.append(prefix) |
3029 args.append(prefix) |
3030 if subrepos: |
3030 if subrepos: |
3031 args.append("--subrepos") |
3031 args.append("--subrepos") |
3032 args.append(archive) |
3032 args.append(archive) |
3033 |
3033 |
3034 dia = HgDialog(self.trUtf8("Create Unversioned Archive"), self) |
3034 dia = HgDialog(self.tr("Create Unversioned Archive"), self) |
3035 res = dia.startProcess(args, repodir) |
3035 res = dia.startProcess(args, repodir) |
3036 if res: |
3036 if res: |
3037 dia.exec_() |
3037 dia.exec_() |
3038 |
3038 |
3039 ########################################################################### |
3039 ########################################################################### |
3084 contents = f.readlines() |
3084 contents = f.readlines() |
3085 f.close() |
3085 f.close() |
3086 except IOError as err: |
3086 except IOError as err: |
3087 E5MessageBox.critical( |
3087 E5MessageBox.critical( |
3088 self.__ui, |
3088 self.__ui, |
3089 self.trUtf8("Add Sub-repository"), |
3089 self.tr("Add Sub-repository"), |
3090 self.trUtf8( |
3090 self.tr( |
3091 """<p>The sub-repositories file .hgsub could not""" |
3091 """<p>The sub-repositories file .hgsub could not""" |
3092 """ be read.</p><p>Reason: {0}</p>""") |
3092 """ be read.</p><p>Reason: {0}</p>""") |
3093 .format(str(err))) |
3093 .format(str(err))) |
3094 return |
3094 return |
3095 |
3095 |
3096 if entry in contents: |
3096 if entry in contents: |
3097 E5MessageBox.critical( |
3097 E5MessageBox.critical( |
3098 self.__ui, |
3098 self.__ui, |
3099 self.trUtf8("Add Sub-repository"), |
3099 self.tr("Add Sub-repository"), |
3100 self.trUtf8( |
3100 self.tr( |
3101 """<p>The sub-repositories file .hgsub already""" |
3101 """<p>The sub-repositories file .hgsub already""" |
3102 """ contains an entry <b>{0}</b>.""" |
3102 """ contains an entry <b>{0}</b>.""" |
3103 """ Aborting...</p>""").format(entry)) |
3103 """ Aborting...</p>""").format(entry)) |
3104 return |
3104 return |
3105 else: |
3105 else: |
3113 f.writelines(contents) |
3113 f.writelines(contents) |
3114 f.close() |
3114 f.close() |
3115 except IOError as err: |
3115 except IOError as err: |
3116 E5MessageBox.critical( |
3116 E5MessageBox.critical( |
3117 self.__ui, |
3117 self.__ui, |
3118 self.trUtf8("Add Sub-repository"), |
3118 self.tr("Add Sub-repository"), |
3119 self.trUtf8( |
3119 self.tr( |
3120 """<p>The sub-repositories file .hgsub could not""" |
3120 """<p>The sub-repositories file .hgsub could not""" |
3121 """ be written to.</p><p>Reason: {0}</p>""") |
3121 """ be written to.</p><p>Reason: {0}</p>""") |
3122 .format(str(err))) |
3122 .format(str(err))) |
3123 return |
3123 return |
3124 |
3124 |
3134 |
3134 |
3135 subrepositories = [] |
3135 subrepositories = [] |
3136 if not os.path.isfile(hgsub): |
3136 if not os.path.isfile(hgsub): |
3137 E5MessageBox.critical( |
3137 E5MessageBox.critical( |
3138 self.__ui, |
3138 self.__ui, |
3139 self.trUtf8("Remove Sub-repositories"), |
3139 self.tr("Remove Sub-repositories"), |
3140 self.trUtf8("""<p>The sub-repositories file .hgsub does not""" |
3140 self.tr("""<p>The sub-repositories file .hgsub does not""" |
3141 """ exist. Aborting...</p>""")) |
3141 """ exist. Aborting...</p>""")) |
3142 return |
3142 return |
3143 |
3143 |
3144 try: |
3144 try: |
3145 f = open(hgsub, "r") |
3145 f = open(hgsub, "r") |
3146 subrepositories = [line.strip() for line in f.readlines()] |
3146 subrepositories = [line.strip() for line in f.readlines()] |
3147 f.close() |
3147 f.close() |
3148 except IOError as err: |
3148 except IOError as err: |
3149 E5MessageBox.critical( |
3149 E5MessageBox.critical( |
3150 self.__ui, |
3150 self.__ui, |
3151 self.trUtf8("Remove Sub-repositories"), |
3151 self.tr("Remove Sub-repositories"), |
3152 self.trUtf8("""<p>The sub-repositories file .hgsub could not""" |
3152 self.tr("""<p>The sub-repositories file .hgsub could not""" |
3153 """ be read.</p><p>Reason: {0}</p>""") |
3153 """ be read.</p><p>Reason: {0}</p>""") |
3154 .format(str(err))) |
3154 .format(str(err))) |
3155 return |
3155 return |
3156 |
3156 |
3157 from .HgRemoveSubrepositoriesDialog import \ |
3157 from .HgRemoveSubrepositoriesDialog import \ |
3158 HgRemoveSubrepositoriesDialog |
3158 HgRemoveSubrepositoriesDialog |
3165 f.write(contents) |
3165 f.write(contents) |
3166 f.close() |
3166 f.close() |
3167 except IOError as err: |
3167 except IOError as err: |
3168 E5MessageBox.critical( |
3168 E5MessageBox.critical( |
3169 self.__ui, |
3169 self.__ui, |
3170 self.trUtf8("Remove Sub-repositories"), |
3170 self.tr("Remove Sub-repositories"), |
3171 self.trUtf8( |
3171 self.tr( |
3172 """<p>The sub-repositories file .hgsub could not""" |
3172 """<p>The sub-repositories file .hgsub could not""" |
3173 """ be written to.</p><p>Reason: {0}</p>""") |
3173 """ be written to.</p><p>Reason: {0}</p>""") |
3174 .format(str(err))) |
3174 .format(str(err))) |
3175 return |
3175 return |
3176 |
3176 |
3196 if self.__client: |
3196 if self.__client: |
3197 ok, err = self.__client.restartServer() |
3197 ok, err = self.__client.restartServer() |
3198 if not ok: |
3198 if not ok: |
3199 E5MessageBox.warning( |
3199 E5MessageBox.warning( |
3200 None, |
3200 None, |
3201 self.trUtf8("Mercurial Command Server"), |
3201 self.tr("Mercurial Command Server"), |
3202 self.trUtf8( |
3202 self.tr( |
3203 """<p>The Mercurial Command Server could not be""" |
3203 """<p>The Mercurial Command Server could not be""" |
3204 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
3204 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
3205 self.__client = None |
3205 self.__client = None |
3206 |
3206 |
3207 def __monitorRepoIniFile(self, name): |
3207 def __monitorRepoIniFile(self, name): |
3334 if ok: |
3334 if ok: |
3335 self.__client = client |
3335 self.__client = client |
3336 else: |
3336 else: |
3337 E5MessageBox.warning( |
3337 E5MessageBox.warning( |
3338 None, |
3338 None, |
3339 self.trUtf8("Mercurial Command Server"), |
3339 self.tr("Mercurial Command Server"), |
3340 self.trUtf8( |
3340 self.tr( |
3341 """<p>The Mercurial Command Server could not be""" |
3341 """<p>The Mercurial Command Server could not be""" |
3342 """ started.</p><p>Reason: {0}</p>""").format(err)) |
3342 """ started.</p><p>Reason: {0}</p>""").format(err)) |
3343 |
3343 |
3344 return self.__projectHelper |
3344 return self.__projectHelper |
3345 |
3345 |