959 project = e5App().getObject("Project") |
961 project = e5App().getObject("Project") |
960 names = [project.getRelativePath(nam) for nam in names] |
962 names = [project.getRelativePath(nam) for nam in names] |
961 if names[0]: |
963 if names[0]: |
962 from UI.DeleteFilesConfirmationDialog import \ |
964 from UI.DeleteFilesConfirmationDialog import \ |
963 DeleteFilesConfirmationDialog |
965 DeleteFilesConfirmationDialog |
964 dlg = DeleteFilesConfirmationDialog(self.parent(), |
966 dlg = DeleteFilesConfirmationDialog( |
|
967 self.parent(), |
965 self.trUtf8("Revert changes"), |
968 self.trUtf8("Revert changes"), |
966 self.trUtf8( |
969 self.trUtf8( |
967 "Do you really want to revert all changes to these files" |
970 "Do you really want to revert all changes to these files" |
968 " or directories?"), |
971 " or directories?"), |
969 names) |
972 names) |
970 yes = dlg.exec_() == QDialog.Accepted |
973 yes = dlg.exec_() == QDialog.Accepted |
971 else: |
974 else: |
972 yes = E5MessageBox.yesNo(None, |
975 yes = E5MessageBox.yesNo( |
|
976 None, |
973 self.trUtf8("Revert changes"), |
977 self.trUtf8("Revert changes"), |
974 self.trUtf8("""Do you really want to revert all changes of""" |
978 self.trUtf8("""Do you really want to revert all changes of""" |
975 """ the project?""")) |
979 """ the project?""")) |
976 if yes: |
980 if yes: |
977 dia = HgDialog(self.trUtf8('Reverting changes'), self) |
981 dia = HgDialog(self.trUtf8('Reverting changes'), self) |
1176 process.start('hg', args) |
1180 process.start('hg', args) |
1177 procStarted = process.waitForStarted(5000) |
1181 procStarted = process.waitForStarted(5000) |
1178 if procStarted: |
1182 if procStarted: |
1179 finished = process.waitForFinished(30000) |
1183 finished = process.waitForFinished(30000) |
1180 if finished and process.exitCode() == 0: |
1184 if finished and process.exitCode() == 0: |
1181 output = \ |
1185 output = str( |
1182 str(process.readAllStandardOutput(), |
1186 process.readAllStandardOutput(), |
1183 Preferences.getSystem("IOEncoding"), |
1187 Preferences.getSystem("IOEncoding"), |
1184 'replace') |
1188 'replace') |
1185 else: |
1189 else: |
1186 output, error = self.__client.runcommand(args) |
1190 output, error = self.__client.runcommand(args) |
1187 |
1191 |
1338 process.start('hg', args) |
1342 process.start('hg', args) |
1339 procStarted = process.waitForStarted(5000) |
1343 procStarted = process.waitForStarted(5000) |
1340 if procStarted: |
1344 if procStarted: |
1341 finished = process.waitForFinished(30000) |
1345 finished = process.waitForFinished(30000) |
1342 if finished and process.exitCode() == 0: |
1346 if finished and process.exitCode() == 0: |
1343 output = str(process.readAllStandardOutput(), |
1347 output = str( |
|
1348 process.readAllStandardOutput(), |
1344 Preferences.getSystem("IOEncoding"), 'replace') |
1349 Preferences.getSystem("IOEncoding"), 'replace') |
1345 else: |
1350 else: |
1346 output, error = self.__client.runcommand(args) |
1351 output, error = self.__client.runcommand(args) |
1347 |
1352 |
1348 infoBlock = [] |
1353 infoBlock = [] |
1352 index += 1 |
1357 index += 1 |
1353 changeset, tags, author, date, branches, bookmarks = \ |
1358 changeset, tags, author, date, branches, bookmarks = \ |
1354 line.split("@@@") |
1359 line.split("@@@") |
1355 cdate, ctime = date.split()[:2] |
1360 cdate, ctime = date.split()[:2] |
1356 info = [] |
1361 info = [] |
1357 info.append(QApplication.translate("mercurial", |
1362 info.append(QApplication.translate( |
|
1363 "mercurial", |
1358 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1364 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1359 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
1365 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
1360 .format(index, changeset)) |
1366 .format(index, changeset)) |
1361 if tags: |
1367 if tags: |
1362 info.append(QApplication.translate("mercurial", |
1368 info.append(QApplication.translate( |
|
1369 "mercurial", |
1363 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1370 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1364 .format('<br/>'.join(tags.split()))) |
1371 .format('<br/>'.join(tags.split()))) |
1365 if bookmarks: |
1372 if bookmarks: |
1366 info.append(QApplication.translate("mercurial", |
1373 info.append(QApplication.translate( |
|
1374 "mercurial", |
1367 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
1375 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
1368 .format('<br/>'.join(bookmarks.split()))) |
1376 .format('<br/>'.join(bookmarks.split()))) |
1369 if branches: |
1377 if branches: |
1370 info.append(QApplication.translate("mercurial", |
1378 info.append(QApplication.translate( |
|
1379 "mercurial", |
1371 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1380 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
1372 .format('<br/>'.join(branches.split()))) |
1381 .format('<br/>'.join(branches.split()))) |
1373 info.append(QApplication.translate("mercurial", |
1382 info.append(QApplication.translate( |
|
1383 "mercurial", |
1374 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1384 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1375 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1385 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1376 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
1386 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
1377 .format(author, cdate, ctime)) |
1387 .format(author, cdate, ctime)) |
1378 infoBlock.append("\n".join(info)) |
1388 infoBlock.append("\n".join(info)) |
1392 process.start('hg', args) |
1402 process.start('hg', args) |
1393 procStarted = process.waitForStarted(5000) |
1403 procStarted = process.waitForStarted(5000) |
1394 if procStarted: |
1404 if procStarted: |
1395 finished = process.waitForFinished(30000) |
1405 finished = process.waitForFinished(30000) |
1396 if finished and process.exitCode() == 0: |
1406 if finished and process.exitCode() == 0: |
1397 output = str(process.readAllStandardOutput(), |
1407 output = str( |
|
1408 process.readAllStandardOutput(), |
1398 Preferences.getSystem("IOEncoding"), 'replace') |
1409 Preferences.getSystem("IOEncoding"), 'replace') |
1399 else: |
1410 else: |
1400 output, error = self.__client.runcommand(args) |
1411 output, error = self.__client.runcommand(args) |
1401 |
1412 |
1402 if output: |
1413 if output: |
1403 url = output.splitlines()[0].strip() |
1414 url = output.splitlines()[0].strip() |
1404 else: |
1415 else: |
1405 url = "" |
1416 url = "" |
1406 |
1417 |
1407 return QApplication.translate('mercurial', |
1418 return QApplication.translate( |
|
1419 'mercurial', |
1408 """<h3>Repository information</h3>\n""" |
1420 """<h3>Repository information</h3>\n""" |
1409 """<p><table>\n""" |
1421 """<p><table>\n""" |
1410 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n""" |
1422 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n""" |
1411 """<tr></tr>\n""" |
1423 """<tr></tr>\n""" |
1412 """<tr><td><b>URL</b></td><td>{1}</td></tr>\n""" |
1424 """<tr><td><b>URL</b></td><td>{1}</td></tr>\n""" |
1718 procStarted = process.waitForStarted(5000) |
1730 procStarted = process.waitForStarted(5000) |
1719 if procStarted: |
1731 if procStarted: |
1720 finished = process.waitForFinished(30000) |
1732 finished = process.waitForFinished(30000) |
1721 if finished: |
1733 if finished: |
1722 if process.exitCode() == 0: |
1734 if process.exitCode() == 0: |
1723 output = str(process.readAllStandardOutput(), |
1735 output = str( |
|
1736 process.readAllStandardOutput(), |
1724 Preferences.getSystem("IOEncoding"), 'replace') |
1737 Preferences.getSystem("IOEncoding"), 'replace') |
1725 else: |
1738 else: |
1726 error = str(process.readAllStandardError(), |
1739 error = str( |
|
1740 process.readAllStandardError(), |
1727 Preferences.getSystem("IOEncoding"), 'replace') |
1741 Preferences.getSystem("IOEncoding"), 'replace') |
1728 else: |
1742 else: |
1729 error = self.trUtf8( |
1743 error = self.trUtf8( |
1730 "The hg process did not finish within 30s.") |
1744 "The hg process did not finish within 30s.") |
1731 else: |
1745 else: |
1732 error = self.trUtf8('The process {0} could not be started. ' |
1746 error = self.trUtf8( |
|
1747 'The process {0} could not be started. ' |
1733 'Ensure, that it is in the search path.').format('hg') |
1748 'Ensure, that it is in the search path.').format('hg') |
1734 else: |
1749 else: |
1735 output, error = self.__client.runcommand(args) |
1750 output, error = self.__client.runcommand(args) |
1736 |
1751 |
1737 return output, error |
1752 return output, error |
1775 else: |
1790 else: |
1776 rev1, rev2 = "", "" |
1791 rev1, rev2 = "", "" |
1777 |
1792 |
1778 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1793 output1, error = self.__hgGetFileForRevision(name, rev=rev1) |
1779 if error: |
1794 if error: |
1780 E5MessageBox.critical(self.__ui, |
1795 E5MessageBox.critical( |
|
1796 self.__ui, |
1781 self.trUtf8("Mercurial Side-by-Side Difference"), |
1797 self.trUtf8("Mercurial Side-by-Side Difference"), |
1782 error) |
1798 error) |
1783 return |
1799 return |
1784 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1800 name1 = "{0} (rev. {1})".format(name, rev1 and rev1 or ".") |
1785 |
1801 |
1786 if rev2: |
1802 if rev2: |
1787 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1803 output2, error = self.__hgGetFileForRevision(name, rev=rev2) |
1788 if error: |
1804 if error: |
1789 E5MessageBox.critical(self.__ui, |
1805 E5MessageBox.critical( |
|
1806 self.__ui, |
1790 self.trUtf8("Mercurial Side-by-Side Difference"), |
1807 self.trUtf8("Mercurial Side-by-Side Difference"), |
1791 error) |
1808 error) |
1792 return |
1809 return |
1793 name2 = "{0} (rev. {1})".format(name, rev2) |
1810 name2 = "{0} (rev. {1})".format(name, rev2) |
1794 else: |
1811 else: |
1970 process.start('hg', args) |
1988 process.start('hg', args) |
1971 procStarted = process.waitForStarted(5000) |
1989 procStarted = process.waitForStarted(5000) |
1972 if procStarted: |
1990 if procStarted: |
1973 finished = process.waitForFinished(30000) |
1991 finished = process.waitForFinished(30000) |
1974 if finished and process.exitCode() == 0: |
1992 if finished and process.exitCode() == 0: |
1975 output = str(process.readAllStandardOutput(), |
1993 output = str( |
|
1994 process.readAllStandardOutput(), |
1976 Preferences.getSystem("IOEncoding"), 'replace') |
1995 Preferences.getSystem("IOEncoding"), 'replace') |
1977 else: |
1996 else: |
1978 output, error = self.__client.runcommand(args) |
1997 output, error = self.__client.runcommand(args) |
1979 |
1998 |
1980 if output: |
1999 if output: |
1984 changeset, tags, author, date, branches, parents, bookmarks = \ |
2003 changeset, tags, author, date, branches, parents, bookmarks = \ |
1985 line.split("@@@") |
2004 line.split("@@@") |
1986 cdate, ctime = date.split()[:2] |
2005 cdate, ctime = date.split()[:2] |
1987 info.append("""<p><table>""") |
2006 info.append("""<p><table>""") |
1988 if mode == "heads": |
2007 if mode == "heads": |
1989 info.append(QApplication.translate("mercurial", |
2008 info.append(QApplication.translate( |
|
2009 "mercurial", |
1990 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
2010 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
1991 .format(index, changeset))) |
2011 .format(index, changeset))) |
1992 elif mode == "parents": |
2012 elif mode == "parents": |
1993 info.append(QApplication.translate("mercurial", |
2013 info.append(QApplication.translate( |
|
2014 "mercurial", |
1994 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
2015 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1995 .format(index, changeset))) |
2016 .format(index, changeset))) |
1996 elif mode == "tip": |
2017 elif mode == "tip": |
1997 info.append(QApplication.translate("mercurial", |
2018 info.append(QApplication.translate( |
|
2019 "mercurial", |
1998 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
2020 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
1999 info.append(QApplication.translate("mercurial", |
2021 info.append(QApplication.translate( |
|
2022 "mercurial", |
2000 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
2023 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
2001 .format(changeset)) |
2024 .format(changeset)) |
2002 if tags: |
2025 if tags: |
2003 info.append(QApplication.translate("mercurial", |
2026 info.append(QApplication.translate( |
|
2027 "mercurial", |
2004 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
2028 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
2005 .format('<br/>'.join(tags.split()))) |
2029 .format('<br/>'.join(tags.split()))) |
2006 if bookmarks: |
2030 if bookmarks: |
2007 info.append(QApplication.translate("mercurial", |
2031 info.append(QApplication.translate( |
|
2032 "mercurial", |
2008 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
2033 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
2009 .format('<br/>'.join(bookmarks.split()))) |
2034 .format('<br/>'.join(bookmarks.split()))) |
2010 if branches: |
2035 if branches: |
2011 info.append(QApplication.translate("mercurial", |
2036 info.append(QApplication.translate( |
|
2037 "mercurial", |
2012 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
2038 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
2013 .format('<br/>'.join(branches.split()))) |
2039 .format('<br/>'.join(branches.split()))) |
2014 if parents: |
2040 if parents: |
2015 info.append(QApplication.translate("mercurial", |
2041 info.append(QApplication.translate( |
|
2042 "mercurial", |
2016 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
2043 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
2017 .format('<br/>'.join(parents.split()))) |
2044 .format('<br/>'.join(parents.split()))) |
2018 info.append(QApplication.translate("mercurial", |
2045 info.append(QApplication.translate( |
|
2046 "mercurial", |
2019 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
2047 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
2020 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
2048 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
2021 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
2049 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
2022 """</table></p>""")\ |
2050 """</table></p>""")\ |
2023 .format(author, cdate, ctime)) |
2051 .format(author, cdate, ctime)) |
2309 "glob:**.DS_Store", |
2337 "glob:**.DS_Store", |
2310 ] |
2338 ] |
2311 |
2339 |
2312 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2340 ignoreName = os.path.join(name, Hg.IgnoreFileName) |
2313 if os.path.exists(ignoreName): |
2341 if os.path.exists(ignoreName): |
2314 res = E5MessageBox.yesNo(self.__ui, |
2342 res = E5MessageBox.yesNo( |
|
2343 self.__ui, |
2315 self.trUtf8("Create .hgignore file"), |
2344 self.trUtf8("Create .hgignore file"), |
2316 self.trUtf8("""<p>The file <b>{0}</b> exists already.""" |
2345 self.trUtf8("""<p>The file <b>{0}</b> exists already.""" |
2317 """ Overwrite it?</p>""").format(ignoreName), |
2346 """ Overwrite it?</p>""").format(ignoreName), |
2318 icon=E5MessageBox.Warning) |
2347 icon=E5MessageBox.Warning) |
2319 else: |
2348 else: |
2645 self.hgGetBranchesList(repodir), |
2676 self.hgGetBranchesList(repodir), |
2646 bookmarksList) |
2677 bookmarksList) |
2647 if dlg.exec_() == QDialog.Accepted: |
2678 if dlg.exec_() == QDialog.Accepted: |
2648 rev, merge, date, user, message = dlg.getParameters() |
2679 rev, merge, date, user, message = dlg.getParameters() |
2649 if not rev: |
2680 if not rev: |
2650 E5MessageBox.warning(self.__ui, |
2681 E5MessageBox.warning( |
|
2682 self.__ui, |
2651 self.trUtf8("Backing out changeset"), |
2683 self.trUtf8("Backing out changeset"), |
2652 self.trUtf8("""No revision given. Aborting...""")) |
2684 self.trUtf8("""No revision given. Aborting...""")) |
2653 return |
2685 return |
2654 |
2686 |
2655 args = [] |
2687 args = [] |
3027 try: |
3059 try: |
3028 f = open(hgsub, "r") |
3060 f = open(hgsub, "r") |
3029 contents = f.readlines() |
3061 contents = f.readlines() |
3030 f.close() |
3062 f.close() |
3031 except IOError as err: |
3063 except IOError as err: |
3032 E5MessageBox.critical(self.__ui, |
3064 E5MessageBox.critical( |
|
3065 self.__ui, |
3033 self.trUtf8("Add Sub-repository"), |
3066 self.trUtf8("Add Sub-repository"), |
3034 self.trUtf8( |
3067 self.trUtf8( |
3035 """<p>The sub-repositories file .hgsub could not""" |
3068 """<p>The sub-repositories file .hgsub could not""" |
3036 """ be read.</p><p>Reason: {0}</p>""") |
3069 """ be read.</p><p>Reason: {0}</p>""") |
3037 .format(str(err))) |
3070 .format(str(err))) |
3038 return |
3071 return |
3039 |
3072 |
3040 if entry in contents: |
3073 if entry in contents: |
3041 E5MessageBox.critical(self.__ui, |
3074 E5MessageBox.critical( |
|
3075 self.__ui, |
3042 self.trUtf8("Add Sub-repository"), |
3076 self.trUtf8("Add Sub-repository"), |
3043 self.trUtf8( |
3077 self.trUtf8( |
3044 """<p>The sub-repositories file .hgsub already""" |
3078 """<p>The sub-repositories file .hgsub already""" |
3045 """ contains an entry <b>{0}</b>.""" |
3079 """ contains an entry <b>{0}</b>.""" |
3046 """ Aborting...</p>""").format(entry)) |
3080 """ Aborting...</p>""").format(entry)) |
3074 """ |
3109 """ |
3075 hgsub = self.getHgSubPath() |
3110 hgsub = self.getHgSubPath() |
3076 |
3111 |
3077 subrepositories = [] |
3112 subrepositories = [] |
3078 if not os.path.isfile(hgsub): |
3113 if not os.path.isfile(hgsub): |
3079 E5MessageBox.critical(self.__ui, |
3114 E5MessageBox.critical( |
|
3115 self.__ui, |
3080 self.trUtf8("Remove Sub-repositories"), |
3116 self.trUtf8("Remove Sub-repositories"), |
3081 self.trUtf8("""<p>The sub-repositories file .hgsub does not""" |
3117 self.trUtf8("""<p>The sub-repositories file .hgsub does not""" |
3082 """ exist. Aborting...</p>""")) |
3118 """ exist. Aborting...</p>""")) |
3083 return |
3119 return |
3084 |
3120 |
3085 try: |
3121 try: |
3086 f = open(hgsub, "r") |
3122 f = open(hgsub, "r") |
3087 subrepositories = [line.strip() for line in f.readlines()] |
3123 subrepositories = [line.strip() for line in f.readlines()] |
3088 f.close() |
3124 f.close() |
3089 except IOError as err: |
3125 except IOError as err: |
3090 E5MessageBox.critical(self.__ui, |
3126 E5MessageBox.critical( |
|
3127 self.__ui, |
3091 self.trUtf8("Remove Sub-repositories"), |
3128 self.trUtf8("Remove Sub-repositories"), |
3092 self.trUtf8("""<p>The sub-repositories file .hgsub could not""" |
3129 self.trUtf8("""<p>The sub-repositories file .hgsub could not""" |
3093 """ be read.</p><p>Reason: {0}</p>""") |
3130 """ be read.</p><p>Reason: {0}</p>""") |
3094 .format(str(err))) |
3131 .format(str(err))) |
3095 return |
3132 return |
3179 process.start('hg', args) |
3218 process.start('hg', args) |
3180 procStarted = process.waitForStarted(5000) |
3219 procStarted = process.waitForStarted(5000) |
3181 if procStarted: |
3220 if procStarted: |
3182 finished = process.waitForFinished(30000) |
3221 finished = process.waitForFinished(30000) |
3183 if finished and process.exitCode() == 0: |
3222 if finished and process.exitCode() == 0: |
3184 output = str(process.readAllStandardOutput(), |
3223 output = str( |
|
3224 process.readAllStandardOutput(), |
3185 Preferences.getSystem("IOEncoding"), 'replace') |
3225 Preferences.getSystem("IOEncoding"), 'replace') |
3186 else: |
3226 else: |
3187 output, error = self.__client.runcommand(args) |
3227 output, error = self.__client.runcommand(args) |
3188 |
3228 |
3189 if output: |
3229 if output: |
3269 client = HgClient(repodir, "utf-8", self) |
3309 client = HgClient(repodir, "utf-8", self) |
3270 ok, err = client.startServer() |
3310 ok, err = client.startServer() |
3271 if ok: |
3311 if ok: |
3272 self.__client = client |
3312 self.__client = client |
3273 else: |
3313 else: |
3274 E5MessageBox.warning(None, |
3314 E5MessageBox.warning( |
|
3315 None, |
3275 self.trUtf8("Mercurial Command Server"), |
3316 self.trUtf8("Mercurial Command Server"), |
3276 self.trUtf8( |
3317 self.trUtf8( |
3277 """<p>The Mercurial Command Server could not be""" |
3318 """<p>The Mercurial Command Server could not be""" |
3278 """ started.</p><p>Reason: {0}</p>""").format(err)) |
3319 """ started.</p><p>Reason: {0}</p>""").format(err)) |
3279 |
3320 |