881 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
920 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
882 repodir = os.path.dirname(repodir) |
921 repodir = os.path.dirname(repodir) |
883 if repodir == os.sep: |
922 if repodir == os.sep: |
884 return 0 |
923 return 0 |
885 |
924 |
886 ioEncoding = Preferences.getSystem("IOEncoding") |
|
887 process = QProcess() |
|
888 args = [] |
925 args = [] |
889 args.append('status') |
926 args.append('status') |
890 args.append('--all') |
927 args.append('--all') |
891 args.append('--noninteractive') |
928 args.append('--noninteractive') |
892 process.setWorkingDirectory(repodir) |
929 |
893 process.start('hg', args) |
930 output = "" |
894 procStarted = process.waitForStarted() |
931 if self.__client is None: |
895 if procStarted: |
932 process = QProcess() |
896 finished = process.waitForFinished(30000) |
933 process.setWorkingDirectory(repodir) |
897 if finished and process.exitCode() == 0: |
934 process.start('hg', args) |
898 output = \ |
935 procStarted = process.waitForStarted() |
899 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
936 if procStarted: |
900 for line in output.splitlines(): |
937 finished = process.waitForFinished(30000) |
901 flag, path = line.split(" ", 1) |
938 if finished and process.exitCode() == 0: |
902 absname = os.path.join(repodir, os.path.normcase(path)) |
939 output = \ |
903 if flag not in "?I": |
940 str(process.readAllStandardOutput(), |
904 if fname == '.': |
941 Preferences.getSystem("IOEncoding"), |
905 if absname.startswith(dname + os.path.sep): |
942 'replace') |
906 return self.canBeCommitted |
943 else: |
907 if absname == dname: |
944 output, error = self.__client.runcommand(args) |
908 return self.canBeCommitted |
945 |
909 else: |
946 if output: |
910 if absname == name: |
947 for line in output.splitlines(): |
911 return self.canBeCommitted |
948 flag, path = line.split(" ", 1) |
|
949 absname = os.path.join(repodir, os.path.normcase(path)) |
|
950 if flag not in "?I": |
|
951 if fname == '.': |
|
952 if absname.startswith(dname + os.path.sep): |
|
953 return self.canBeCommitted |
|
954 if absname == dname: |
|
955 return self.canBeCommitted |
|
956 else: |
|
957 if absname == name: |
|
958 return self.canBeCommitted |
912 |
959 |
913 return self.canBeAdded |
960 return self.canBeAdded |
914 |
961 |
915 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
962 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
916 """ |
963 """ |
942 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
989 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
943 repodir = os.path.dirname(repodir) |
990 repodir = os.path.dirname(repodir) |
944 if repodir == os.sep: |
991 if repodir == os.sep: |
945 return names |
992 return names |
946 |
993 |
947 ioEncoding = Preferences.getSystem("IOEncoding") |
|
948 process = QProcess() |
|
949 args = [] |
994 args = [] |
950 args.append('status') |
995 args.append('status') |
951 args.append('--all') |
996 args.append('--all') |
952 args.append('--noninteractive') |
997 args.append('--noninteractive') |
953 process.setWorkingDirectory(dname) |
998 |
954 process.start('hg', args) |
999 output = "" |
955 procStarted = process.waitForStarted() |
1000 if self.__client is None: |
956 if procStarted: |
1001 process = QProcess() |
957 finished = process.waitForFinished(30000) |
1002 process.setWorkingDirectory(dname) |
958 if finished and process.exitCode() == 0: |
1003 process.start('hg', args) |
959 dirs = [x for x in names.keys() if os.path.isdir(x)] |
1004 procStarted = process.waitForStarted() |
960 output = \ |
1005 if procStarted: |
961 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
1006 finished = process.waitForFinished(30000) |
962 for line in output.splitlines(): |
1007 if finished and process.exitCode() == 0: |
963 flag, path = line.split(" ", 1) |
1008 output = \ |
964 name = os.path.normcase(os.path.join(repodir, path)) |
1009 str(process.readAllStandardOutput(), |
965 dirName = os.path.dirname(name) |
1010 Preferences.getSystem("IOEncoding"), |
966 if name.startswith(dname): |
1011 'replace') |
967 if flag not in "?I": |
1012 else: |
968 if name in names: |
1013 output, error = self.__client.runcommand(args) |
969 names[name] = self.canBeCommitted |
1014 |
970 if dirName in names: |
1015 if output: |
971 names[dirName] = self.canBeCommitted |
1016 dirs = [x for x in names.keys() if os.path.isdir(x)] |
972 if dirs: |
1017 for line in output.splitlines(): |
973 for d in dirs: |
1018 flag, path = line.split(" ", 1) |
974 if name.startswith(d): |
1019 name = os.path.normcase(os.path.join(repodir, path)) |
975 names[d] = self.canBeCommitted |
1020 dirName = os.path.dirname(name) |
976 dirs.remove(d) |
1021 if name.startswith(dname): |
977 break |
|
978 if flag not in "?I": |
1022 if flag not in "?I": |
979 self.statusCache[name] = self.canBeCommitted |
1023 if name in names: |
980 self.statusCache[dirName] = self.canBeCommitted |
1024 names[name] = self.canBeCommitted |
981 else: |
1025 if dirName in names: |
982 self.statusCache[name] = self.canBeAdded |
1026 names[dirName] = self.canBeCommitted |
983 if dirName not in self.statusCache: |
1027 if dirs: |
984 self.statusCache[dirName] = self.canBeAdded |
1028 for d in dirs: |
|
1029 if name.startswith(d): |
|
1030 names[d] = self.canBeCommitted |
|
1031 dirs.remove(d) |
|
1032 break |
|
1033 if flag not in "?I": |
|
1034 self.statusCache[name] = self.canBeCommitted |
|
1035 self.statusCache[dirName] = self.canBeCommitted |
|
1036 else: |
|
1037 self.statusCache[name] = self.canBeAdded |
|
1038 if dirName not in self.statusCache: |
|
1039 self.statusCache[dirName] = self.canBeAdded |
985 |
1040 |
986 return names |
1041 return names |
987 |
1042 |
988 def clearStatusCache(self): |
1043 def clearStatusCache(self): |
989 """ |
1044 """ |
1075 @param ppath local path to get the repository infos (string) |
1130 @param ppath local path to get the repository infos (string) |
1076 @return string with ready formated info for display (string) |
1131 @return string with ready formated info for display (string) |
1077 """ |
1132 """ |
1078 info = [] |
1133 info = [] |
1079 |
1134 |
1080 process = QProcess() |
|
1081 args = [] |
1135 args = [] |
1082 args.append('parents') |
1136 args.append('parents') |
1083 args.append('--template') |
1137 args.append('--template') |
1084 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1138 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1085 '{date|isodate}@@@{branches}@@@{bookmarks}\n') |
1139 '{date|isodate}@@@{branches}@@@{bookmarks}\n') |
1086 process.setWorkingDirectory(ppath) |
1140 |
1087 process.start('hg', args) |
1141 output = "" |
1088 procStarted = process.waitForStarted() |
1142 if self.__client is None: |
1089 if procStarted: |
1143 process = QProcess() |
1090 finished = process.waitForFinished(30000) |
1144 process.setWorkingDirectory(ppath) |
1091 if finished and process.exitCode() == 0: |
1145 process.start('hg', args) |
1092 output = str(process.readAllStandardOutput(), |
1146 procStarted = process.waitForStarted() |
1093 Preferences.getSystem("IOEncoding"), 'replace') |
1147 if procStarted: |
1094 index = 0 |
1148 finished = process.waitForFinished(30000) |
1095 for line in output.splitlines(): |
1149 if finished and process.exitCode() == 0: |
1096 index += 1 |
1150 output = str(process.readAllStandardOutput(), |
1097 changeset, tags, author, date, branches, bookmarks = line.split("@@@") |
1151 Preferences.getSystem("IOEncoding"), 'replace') |
1098 cdate, ctime = date.split()[:2] |
1152 else: |
1099 info.append("""<p><table>""") |
1153 output, error = self.__client.runcommand(args) |
|
1154 |
|
1155 if output: |
|
1156 index = 0 |
|
1157 for line in output.splitlines(): |
|
1158 index += 1 |
|
1159 changeset, tags, author, date, branches, bookmarks = line.split("@@@") |
|
1160 cdate, ctime = date.split()[:2] |
|
1161 info.append("""<p><table>""") |
|
1162 info.append(QApplication.translate("mercurial", |
|
1163 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
|
1164 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
|
1165 .format(index, changeset)) |
|
1166 if tags: |
1100 info.append(QApplication.translate("mercurial", |
1167 info.append(QApplication.translate("mercurial", |
1101 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1168 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
1102 """<tr><td><b>Changeset</b></td><td>{1}</td></tr>""")\ |
1169 .format('<br/>'.join(tags.split()))) |
1103 .format(index, changeset)) |
1170 if bookmarks: |
1104 if tags: |
|
1105 info.append(QApplication.translate("mercurial", |
|
1106 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
|
1107 .format('<br/>'.join(tags.split()))) |
|
1108 if bookmarks: |
|
1109 info.append(QApplication.translate("mercurial", |
|
1110 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
|
1111 .format('<br/>'.join(bookmarks.split()))) |
|
1112 if branches: |
|
1113 info.append(QApplication.translate("mercurial", |
|
1114 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
|
1115 .format('<br/>'.join(branches.split()))) |
|
1116 info.append(QApplication.translate("mercurial", |
1171 info.append(QApplication.translate("mercurial", |
1117 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1172 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
1118 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1173 .format('<br/>'.join(bookmarks.split()))) |
1119 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
1174 if branches: |
1120 .format(author, cdate, ctime)) |
1175 info.append(QApplication.translate("mercurial", |
1121 info.append("""</table></p>""") |
1176 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
|
1177 .format('<br/>'.join(branches.split()))) |
|
1178 info.append(QApplication.translate("mercurial", |
|
1179 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
|
1180 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
|
1181 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>""")\ |
|
1182 .format(author, cdate, ctime)) |
|
1183 info.append("""</table></p>""") |
1122 |
1184 |
1123 url = "" |
1185 url = "" |
1124 args = [] |
1186 args = [] |
1125 args.append('showconfig') |
1187 args.append('showconfig') |
1126 args.append('paths.default') |
1188 args.append('paths.default') |
1127 process.setWorkingDirectory(ppath) |
1189 |
1128 process.start('hg', args) |
1190 output = "" |
1129 procStarted = process.waitForStarted() |
1191 if self.__client is None: |
1130 if procStarted: |
1192 process.setWorkingDirectory(ppath) |
1131 finished = process.waitForFinished(30000) |
1193 process.start('hg', args) |
1132 if finished and process.exitCode() == 0: |
1194 procStarted = process.waitForStarted() |
1133 output = str(process.readAllStandardOutput(), |
1195 if procStarted: |
1134 Preferences.getSystem("IOEncoding"), 'replace') |
1196 finished = process.waitForFinished(30000) |
1135 if output: |
1197 if finished and process.exitCode() == 0: |
1136 url = output.splitlines()[0].strip() |
1198 output = str(process.readAllStandardOutput(), |
1137 else: |
1199 Preferences.getSystem("IOEncoding"), 'replace') |
1138 url = "" |
1200 else: |
|
1201 output, error = self.__client.runcommand(args) |
|
1202 |
|
1203 if output: |
|
1204 url = output.splitlines()[0].strip() |
|
1205 else: |
|
1206 url = "" |
1139 |
1207 |
1140 return QApplication.translate('mercurial', |
1208 return QApplication.translate('mercurial', |
1141 """<h3>Repository information</h3>\n""" |
1209 """<h3>Repository information</h3>\n""" |
1142 """<p><table>\n""" |
1210 """<p><table>\n""" |
1143 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n""" |
1211 """<tr><td><b>Mercurial V.</b></td><td>{0}</td></tr>\n""" |
1240 Public method to get the list of tags. |
1308 Public method to get the list of tags. |
1241 |
1309 |
1242 @param repodir directory name of the repository (string) |
1310 @param repodir directory name of the repository (string) |
1243 @return list of tags (list of string) |
1311 @return list of tags (list of string) |
1244 """ |
1312 """ |
1245 ioEncoding = Preferences.getSystem("IOEncoding") |
|
1246 process = QProcess() |
|
1247 args = [] |
1313 args = [] |
1248 args.append('tags') |
1314 args.append('tags') |
1249 args.append('--verbose') |
1315 args.append('--verbose') |
1250 process.setWorkingDirectory(repodir) |
1316 |
1251 process.start('hg', args) |
1317 output = "" |
1252 procStarted = process.waitForStarted() |
1318 if self.__client is None: |
1253 if procStarted: |
1319 process = QProcess() |
1254 finished = process.waitForFinished(30000) |
1320 process.setWorkingDirectory(repodir) |
1255 if finished and process.exitCode() == 0: |
1321 process.start('hg', args) |
1256 self.tagsList = [] |
1322 procStarted = process.waitForStarted() |
1257 output = \ |
1323 if procStarted: |
1258 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
1324 finished = process.waitForFinished(30000) |
1259 for line in output.splitlines(): |
1325 if finished and process.exitCode() == 0: |
1260 l = line.strip().split() |
1326 output = \ |
1261 if l[-1][0] in "1234567890": |
1327 str(process.readAllStandardOutput(), |
1262 # last element is a rev:changeset |
1328 Preferences.getSystem("IOEncoding"), |
1263 del l[-1] |
1329 'replace') |
1264 else: |
1330 else: |
1265 del l[-2:] |
1331 output, error = self.__client.runcommand(args) |
1266 name = " ".join(l) |
1332 |
1267 if name not in ["tip", "default"]: |
1333 if output: |
1268 self.tagsList.append(name) |
1334 self.tagsList = [] |
|
1335 for line in output.splitlines(): |
|
1336 l = line.strip().split() |
|
1337 if l[-1][0] in "1234567890": |
|
1338 # last element is a rev:changeset |
|
1339 del l[-1] |
|
1340 else: |
|
1341 del l[-2:] |
|
1342 name = " ".join(l) |
|
1343 if name not in ["tip", "default"]: |
|
1344 self.tagsList.append(name) |
1269 |
1345 |
1270 return self.tagsList[:] |
1346 return self.tagsList[:] |
1271 |
1347 |
1272 def hgGetBranchesList(self, repodir): |
1348 def hgGetBranchesList(self, repodir): |
1273 """ |
1349 """ |
1274 Public method to get the list of branches. |
1350 Public method to get the list of branches. |
1275 |
1351 |
1276 @param repodir directory name of the repository (string) |
1352 @param repodir directory name of the repository (string) |
1277 @return list of branches (list of string) |
1353 @return list of branches (list of string) |
1278 """ |
1354 """ |
1279 ioEncoding = Preferences.getSystem("IOEncoding") |
|
1280 process = QProcess() |
|
1281 args = [] |
1355 args = [] |
1282 args.append('branches') |
1356 args.append('branches') |
1283 args.append('--closed') |
1357 args.append('--closed') |
1284 process.setWorkingDirectory(repodir) |
1358 |
1285 process.start('hg', args) |
1359 output = "" |
1286 procStarted = process.waitForStarted() |
1360 if self.__client is None: |
1287 if procStarted: |
1361 process = QProcess() |
1288 finished = process.waitForFinished(30000) |
1362 process.setWorkingDirectory(repodir) |
1289 if finished and process.exitCode() == 0: |
1363 process.start('hg', args) |
1290 self.branchesList = [] |
1364 procStarted = process.waitForStarted() |
1291 output = \ |
1365 if procStarted: |
1292 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
1366 finished = process.waitForFinished(30000) |
1293 for line in output.splitlines(): |
1367 if finished and process.exitCode() == 0: |
1294 l = line.strip().split() |
1368 output = \ |
1295 if l[-1][0] in "1234567890": |
1369 str(process.readAllStandardOutput(), |
1296 # last element is a rev:changeset |
1370 Preferences.getSystem("IOEncoding"), |
1297 del l[-1] |
1371 'replace') |
1298 else: |
1372 else: |
1299 del l[-2:] |
1373 output, error = self.__client.runcommand(args) |
1300 name = " ".join(l) |
1374 |
1301 if name not in ["tip", "default"]: |
1375 if output: |
1302 self.branchesList.append(name) |
1376 self.branchesList = [] |
|
1377 for line in output.splitlines(): |
|
1378 l = line.strip().split() |
|
1379 if l[-1][0] in "1234567890": |
|
1380 # last element is a rev:changeset |
|
1381 del l[-1] |
|
1382 else: |
|
1383 del l[-2:] |
|
1384 name = " ".join(l) |
|
1385 if name not in ["tip", "default"]: |
|
1386 self.branchesList.append(name) |
1303 |
1387 |
1304 return self.branchesList[:] |
1388 return self.branchesList[:] |
1305 |
1389 |
1306 def hgListTagBranch(self, path, tags=True): |
1390 def hgListTagBranch(self, path, tags=True): |
1307 """ |
1391 """ |
1523 if mode not in ("heads", "parents", "tip"): |
1607 if mode not in ("heads", "parents", "tip"): |
1524 mode = "heads" |
1608 mode = "heads" |
1525 |
1609 |
1526 info = [] |
1610 info = [] |
1527 |
1611 |
1528 # find the root of the repo |
|
1529 repodir = self.splitPath(ppath)[0] |
|
1530 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
1531 repodir = os.path.dirname(repodir) |
|
1532 if repodir == os.sep: |
|
1533 return |
|
1534 |
|
1535 process = QProcess() |
|
1536 args = [] |
1612 args = [] |
1537 args.append(mode) |
1613 args.append(mode) |
1538 args.append('--template') |
1614 args.append('--template') |
1539 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1615 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1540 '{date|isodate}@@@{branches}@@@{parents}@@@{bookmarks}\n') |
1616 '{date|isodate}@@@{branches}@@@{parents}@@@{bookmarks}\n') |
1541 |
1617 |
1542 process.setWorkingDirectory(repodir) |
1618 output = "" |
1543 process.start('hg', args) |
1619 if self.__client is None: |
1544 procStarted = process.waitForStarted() |
1620 # find the root of the repo |
1545 if procStarted: |
1621 repodir = self.splitPath(ppath)[0] |
1546 finished = process.waitForFinished(30000) |
1622 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
1547 if finished and process.exitCode() == 0: |
1623 repodir = os.path.dirname(repodir) |
1548 output = str(process.readAllStandardOutput(), |
1624 if repodir == os.sep: |
1549 Preferences.getSystem("IOEncoding"), 'replace') |
1625 return |
1550 index = 0 |
1626 |
1551 for line in output.splitlines(): |
1627 process = QProcess() |
1552 index += 1 |
1628 process.setWorkingDirectory(repodir) |
1553 changeset, tags, author, date, branches, parents, bookmarks = \ |
1629 process.start('hg', args) |
1554 line.split("@@@") |
1630 procStarted = process.waitForStarted() |
1555 cdate, ctime = date.split()[:2] |
1631 if procStarted: |
1556 info.append("""<p><table>""") |
1632 finished = process.waitForFinished(30000) |
1557 if mode == "heads": |
1633 if finished and process.exitCode() == 0: |
1558 info.append(QApplication.translate("mercurial", |
1634 output = str(process.readAllStandardOutput(), |
1559 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
1635 Preferences.getSystem("IOEncoding"), 'replace') |
1560 .format(index, changeset))) |
1636 else: |
1561 elif mode == "parents": |
1637 output, error = self.__client.runcommand(args) |
1562 info.append(QApplication.translate("mercurial", |
1638 |
1563 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1639 if output: |
1564 .format(index, changeset))) |
1640 index = 0 |
1565 elif mode == "tip": |
1641 for line in output.splitlines(): |
1566 info.append(QApplication.translate("mercurial", |
1642 index += 1 |
1567 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
1643 changeset, tags, author, date, branches, parents, bookmarks = \ |
|
1644 line.split("@@@") |
|
1645 cdate, ctime = date.split()[:2] |
|
1646 info.append("""<p><table>""") |
|
1647 if mode == "heads": |
1568 info.append(QApplication.translate("mercurial", |
1648 info.append(QApplication.translate("mercurial", |
1569 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
1649 """<tr><td><b>Head #{0}</b></td><td></td></tr>\n""" |
1570 .format(changeset)) |
1650 .format(index, changeset))) |
1571 if tags: |
1651 elif mode == "parents": |
1572 info.append(QApplication.translate("mercurial", |
|
1573 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
|
1574 .format('<br/>'.join(tags.split()))) |
|
1575 if bookmarks: |
|
1576 info.append(QApplication.translate("mercurial", |
|
1577 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
|
1578 .format('<br/>'.join(bookmarks.split()))) |
|
1579 if branches: |
|
1580 info.append(QApplication.translate("mercurial", |
|
1581 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
|
1582 .format('<br/>'.join(branches.split()))) |
|
1583 if parents: |
|
1584 info.append(QApplication.translate("mercurial", |
|
1585 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
|
1586 .format('<br/>'.join(parents.split()))) |
|
1587 info.append(QApplication.translate("mercurial", |
1652 info.append(QApplication.translate("mercurial", |
1588 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
1653 """<tr><td><b>Parent #{0}</b></td><td></td></tr>\n""" |
1589 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
1654 .format(index, changeset))) |
1590 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
1655 elif mode == "tip": |
1591 """</table></p>""")\ |
1656 info.append(QApplication.translate("mercurial", |
1592 .format(author, cdate, ctime)) |
1657 """<tr><td><b>Tip</b></td><td></td></tr>\n""")) |
1593 |
1658 info.append(QApplication.translate("mercurial", |
1594 dlg = VcsRepositoryInfoDialog(None, "\n".join(info)) |
1659 """<tr><td><b>Changeset</b></td><td>{0}</td></tr>""")\ |
1595 dlg.exec_() |
1660 .format(changeset)) |
1596 |
1661 if tags: |
|
1662 info.append(QApplication.translate("mercurial", |
|
1663 """<tr><td><b>Tags</b></td><td>{0}</td></tr>""")\ |
|
1664 .format('<br/>'.join(tags.split()))) |
|
1665 if bookmarks: |
|
1666 info.append(QApplication.translate("mercurial", |
|
1667 """<tr><td><b>Bookmarks</b></td><td>{0}</td></tr>""")\ |
|
1668 .format('<br/>'.join(bookmarks.split()))) |
|
1669 if branches: |
|
1670 info.append(QApplication.translate("mercurial", |
|
1671 """<tr><td><b>Branches</b></td><td>{0}</td></tr>""")\ |
|
1672 .format('<br/>'.join(branches.split()))) |
|
1673 if parents: |
|
1674 info.append(QApplication.translate("mercurial", |
|
1675 """<tr><td><b>Parents</b></td><td>{0}</td></tr>""")\ |
|
1676 .format('<br/>'.join(parents.split()))) |
|
1677 info.append(QApplication.translate("mercurial", |
|
1678 """<tr><td><b>Last author</b></td><td>{0}</td></tr>\n""" |
|
1679 """<tr><td><b>Committed date</b></td><td>{1}</td></tr>\n""" |
|
1680 """<tr><td><b>Committed time</b></td><td>{2}</td></tr>\n""" |
|
1681 """</table></p>""")\ |
|
1682 .format(author, cdate, ctime)) |
|
1683 |
|
1684 dlg = VcsRepositoryInfoDialog(None, "\n".join(info)) |
|
1685 dlg.exec_() |
1597 |
1686 |
1598 def hgResolve(self, name): |
1687 def hgResolve(self, name): |
1599 """ |
1688 """ |
1600 Public method used to resolve conflicts of a file/directory. |
1689 Public method used to resolve conflicts of a file/directory. |
1601 |
1690 |
2267 Private method to get the active extensions from Mercurial. |
2366 Private method to get the active extensions from Mercurial. |
2268 """ |
2367 """ |
2269 activeExtensions = sorted(self.__activeExtensions) |
2368 activeExtensions = sorted(self.__activeExtensions) |
2270 self.__activeExtensions = [] |
2369 self.__activeExtensions = [] |
2271 |
2370 |
2272 process = QProcess() |
|
2273 args = [] |
2371 args = [] |
2274 args.append('showconfig') |
2372 args.append('showconfig') |
2275 args.append('extensions') |
2373 args.append('extensions') |
2276 process.start('hg', args) |
2374 |
2277 procStarted = process.waitForStarted() |
2375 if self.__client is None: |
2278 if procStarted: |
2376 process = QProcess() |
2279 finished = process.waitForFinished(30000) |
2377 process.start('hg', args) |
2280 if finished and process.exitCode() == 0: |
2378 procStarted = process.waitForStarted() |
2281 output = str(process.readAllStandardOutput(), |
2379 if procStarted: |
2282 Preferences.getSystem("IOEncoding"), 'replace') |
2380 finished = process.waitForFinished(30000) |
2283 for line in output.splitlines(): |
2381 if finished and process.exitCode() == 0: |
2284 extensionName = line.split("=", 1)[0].strip().split(".")[-1].strip() |
2382 output = str(process.readAllStandardOutput(), |
2285 self.__activeExtensions.append(extensionName) |
2383 Preferences.getSystem("IOEncoding"), 'replace') |
|
2384 else: |
|
2385 output, error = self.__client.runcommand(args) |
|
2386 |
|
2387 if output: |
|
2388 for line in output.splitlines(): |
|
2389 extensionName = line.split("=", 1)[0].strip().split(".")[-1].strip() |
|
2390 self.__activeExtensions.append(extensionName) |
2286 |
2391 |
2287 if self.versionStr >= "1.8": |
2392 if self.versionStr >= "1.8": |
2288 if "bookmarks" not in self.__activeExtensions: |
2393 if "bookmarks" not in self.__activeExtensions: |
2289 self.__activeExtensions.append("bookmarks") |
2394 self.__activeExtensions.append("bookmarks") |
2290 |
2395 |
2332 @param project reference to the project object |
2437 @param project reference to the project object |
2333 @return the project helper object |
2438 @return the project helper object |
2334 """ |
2439 """ |
2335 self.__projectHelper = self.__plugin.getProjectHelper() |
2440 self.__projectHelper = self.__plugin.getProjectHelper() |
2336 self.__projectHelper.setObjects(self, project) |
2441 self.__projectHelper.setObjects(self, project) |
2337 self.__monitorRepoIniFile(project.ppath) |
2442 self.__monitorRepoIniFile(project.getProjectPath()) |
|
2443 |
|
2444 if self.versionStr >= "1.9": |
|
2445 client = HgClient(project.getProjectPath(), "utf-8", self) |
|
2446 ok, err = client.startServer() |
|
2447 if ok: |
|
2448 self.__client = client |
|
2449 else: |
|
2450 E5MessageBox.warning(None, |
|
2451 self.trUtf8("Mercurial Command Server"), |
|
2452 self.trUtf8("""<p>The Mercurial Command Server could not be""" |
|
2453 """ started.</p><p>Reason: {0}</p>""").format(err)) |
|
2454 |
2338 return self.__projectHelper |
2455 return self.__projectHelper |
2339 |
2456 |
2340 ############################################################################ |
2457 ############################################################################ |
2341 ## Status Monitor Thread methods |
2458 ## Status Monitor Thread methods |
2342 ############################################################################ |
2459 ############################################################################ |