125 cfgFile = getConfigPath() |
125 cfgFile = getConfigPath() |
126 if os.path.exists(cfgFile): |
126 if os.path.exists(cfgFile): |
127 self.__iniWatcher.addPath(cfgFile) |
127 self.__iniWatcher.addPath(cfgFile) |
128 |
128 |
129 self.__client = None |
129 self.__client = None |
|
130 self.__createClient() |
130 self.__projectHelper = None |
131 self.__projectHelper = None |
131 |
132 |
132 self.__repoDir = "" |
133 self.__repoDir = "" |
133 self.__repoIniFile = "" |
134 self.__repoIniFile = "" |
134 self.__defaultConfigured = False |
135 self.__defaultConfigured = False |
219 extension.shutdown() |
220 extension.shutdown() |
220 |
221 |
221 # shut down the client |
222 # shut down the client |
222 self.__client and self.__client.stopServer() |
223 self.__client and self.__client.stopServer() |
223 |
224 |
224 def getClient(self): |
|
225 """ |
|
226 Public method to get a reference to the command server interface. |
|
227 |
|
228 @return reference to the client (HgClient) |
|
229 """ |
|
230 return self.__client |
|
231 |
|
232 def initCommand(self, command): |
225 def initCommand(self, command): |
233 """ |
226 """ |
234 Public method to initialize a command arguments list. |
227 Public method to initialize a command arguments list. |
235 |
228 |
236 @param command command name (string) |
229 @param command command name (string) |
369 args.append("--all-largefiles") |
362 args.append("--all-largefiles") |
370 args.append(vcsUrl) |
363 args.append(vcsUrl) |
371 args.append(projectDir) |
364 args.append(projectDir) |
372 |
365 |
373 if noDialog: |
366 if noDialog: |
374 if self.__client is None: |
367 out, err = self.__client.runcommand(args) |
375 return self.startSynchronizedProcess(QProcess(), 'hg', args) |
368 return err == "" |
376 else: |
|
377 out, err = self.__client.runcommand(args) |
|
378 return err == "" |
|
379 else: |
369 else: |
380 dia = HgDialog( |
370 dia = HgDialog( |
381 self.tr('Cloning project from a Mercurial repository'), |
371 self.tr('Cloning project from a Mercurial repository'), |
382 self) |
372 self) |
383 res = dia.startProcess(args) |
373 res = dia.startProcess(args) |
542 args.append("--date") |
532 args.append("--date") |
543 args.append(dateTime) |
533 args.append(dateTime) |
544 if msg: |
534 if msg: |
545 args.append("--message") |
535 args.append("--message") |
546 args.append(msg) |
536 args.append(msg) |
547 if self.__client: |
537 if isinstance(name, list): |
548 if isinstance(name, list): |
538 self.addArguments(args, name) |
549 self.addArguments(args, name) |
539 else: |
550 else: |
540 if dname != repodir or fname != ".": |
551 if dname != repodir or fname != ".": |
541 args.append(name) |
552 args.append(name) |
542 |
553 else: |
543 dia = HgDialog( |
554 if isinstance(name, list): |
544 self.tr('Committing changes to Mercurial repository'), |
555 self.addArguments(args, fnames) |
545 self) |
556 else: |
546 res = dia.startProcess(args, dname) |
557 if dname != repodir or fname != ".": |
547 if res: |
558 args.append(fname) |
548 dia.exec_() |
559 |
|
560 if noDialog: |
|
561 self.startSynchronizedProcess(QProcess(), "hg", args, dname) |
|
562 else: |
|
563 dia = HgDialog( |
|
564 self.tr('Committing changes to Mercurial repository'), |
|
565 self) |
|
566 res = dia.startProcess(args, dname) |
|
567 if res: |
|
568 dia.exec_() |
|
569 self.committed.emit() |
549 self.committed.emit() |
570 if self.__forgotNames: |
550 if self.__forgotNames: |
571 model = e5App().getObject("Project").getModel() |
551 model = e5App().getObject("Project").getModel() |
572 for name in self.__forgotNames: |
552 for name in self.__forgotNames: |
573 model.updateVCSStatus(name) |
553 model.updateVCSStatus(name) |
590 args.append("--rev") |
570 args.append("--rev") |
591 args.append(".") |
571 args.append(".") |
592 args.append('--template') |
572 args.append('--template') |
593 args.append('{desc}') |
573 args.append('{desc}') |
594 |
574 |
595 output = "" |
575 output, error = self.__client.runcommand(args) |
596 if self.__client is None: |
|
597 process = QProcess() |
|
598 process.setWorkingDirectory(repodir) |
|
599 process.start('hg', args) |
|
600 procStarted = process.waitForStarted(5000) |
|
601 if procStarted: |
|
602 finished = process.waitForFinished(30000) |
|
603 if finished and process.exitCode() == 0: |
|
604 output = str(process.readAllStandardOutput(), |
|
605 self.getEncoding(), 'replace') |
|
606 else: |
|
607 output, error = self.__client.runcommand(args) |
|
608 |
576 |
609 return output |
577 return output |
610 |
578 |
611 def vcsUpdate(self, name, noDialog=False, revision=None): |
579 def vcsUpdate(self, name, noDialog=False, revision=None): |
612 """ |
580 """ |
638 repodir = os.path.dirname(repodir) |
606 repodir = os.path.dirname(repodir) |
639 if os.path.splitdrive(repodir)[1] == os.sep: |
607 if os.path.splitdrive(repodir)[1] == os.sep: |
640 return False |
608 return False |
641 |
609 |
642 if noDialog: |
610 if noDialog: |
643 if self.__client is None: |
611 out, err = self.__client.runcommand(args) |
644 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
|
645 else: |
|
646 out, err = self.__client.runcommand(args) |
|
647 res = False |
612 res = False |
648 else: |
613 else: |
649 dia = HgDialog(self.tr( |
614 dia = HgDialog(self.tr( |
650 'Synchronizing with the Mercurial repository'), |
615 'Synchronizing with the Mercurial repository'), |
651 self) |
616 self) |
689 self.addArguments(args, name) |
654 self.addArguments(args, name) |
690 else: |
655 else: |
691 args.append(name) |
656 args.append(name) |
692 |
657 |
693 if noDialog: |
658 if noDialog: |
694 if self.__client is None: |
659 out, err = self.__client.runcommand(args) |
695 self.startSynchronizedProcess(QProcess(), 'hg', args, repodir) |
|
696 else: |
|
697 out, err = self.__client.runcommand(args) |
|
698 else: |
660 else: |
699 dia = HgDialog( |
661 dia = HgDialog( |
700 self.tr( |
662 self.tr( |
701 'Adding files/directories to the Mercurial repository'), |
663 'Adding files/directories to the Mercurial repository'), |
702 self) |
664 self) |
756 repodir = os.path.dirname(repodir) |
718 repodir = os.path.dirname(repodir) |
757 if os.path.splitdrive(repodir)[1] == os.sep: |
719 if os.path.splitdrive(repodir)[1] == os.sep: |
758 return False |
720 return False |
759 |
721 |
760 if noDialog: |
722 if noDialog: |
761 if self.__client is None: |
723 out, err = self.__client.runcommand(args) |
762 res = self.startSynchronizedProcess( |
724 res = err == "" |
763 QProcess(), 'hg', args, repodir) |
|
764 else: |
|
765 out, err = self.__client.runcommand(args) |
|
766 res = err == "" |
|
767 else: |
725 else: |
768 dia = HgDialog( |
726 dia = HgDialog( |
769 self.tr( |
727 self.tr( |
770 'Removing files/directories from the Mercurial' |
728 'Removing files/directories from the Mercurial' |
771 ' repository'), |
729 ' repository'), |
817 repodir = os.path.dirname(repodir) |
775 repodir = os.path.dirname(repodir) |
818 if os.path.splitdrive(repodir)[1] == os.sep: |
776 if os.path.splitdrive(repodir)[1] == os.sep: |
819 return False |
777 return False |
820 |
778 |
821 if noDialog: |
779 if noDialog: |
822 if self.__client is None: |
780 out, err = self.__client.runcommand(args) |
823 res = self.startSynchronizedProcess( |
781 res = err == "" |
824 QProcess(), 'hg', args, repodir) |
|
825 else: |
|
826 out, err = self.__client.runcommand(args) |
|
827 res = err == "" |
|
828 else: |
782 else: |
829 dia = HgDialog(self.tr('Renaming {0}').format(name), self) |
783 dia = HgDialog(self.tr('Renaming {0}').format(name), self) |
830 res = dia.startProcess(args, repodir) |
784 res = dia.startProcess(args, repodir) |
831 if res: |
785 if res: |
832 dia.exec_() |
786 dia.exec_() |
1181 |
1135 |
1182 args = self.initCommand("status") |
1136 args = self.initCommand("status") |
1183 args.append('--all') |
1137 args.append('--all') |
1184 args.append('--noninteractive') |
1138 args.append('--noninteractive') |
1185 |
1139 |
1186 output = "" |
1140 output, error = self.__client.runcommand(args) |
1187 if self.__client is None: |
|
1188 process = QProcess() |
|
1189 process.setWorkingDirectory(repodir) |
|
1190 process.start('hg', args) |
|
1191 procStarted = process.waitForStarted(5000) |
|
1192 if procStarted: |
|
1193 finished = process.waitForFinished(30000) |
|
1194 if finished and process.exitCode() == 0: |
|
1195 output = str(process.readAllStandardOutput(), |
|
1196 self.getEncoding(), 'replace') |
|
1197 else: |
|
1198 output, error = self.__client.runcommand(args) |
|
1199 |
1141 |
1200 if output: |
1142 if output: |
1201 for line in output.splitlines(): |
1143 for line in output.splitlines(): |
1202 if len(line) > 2 and line[0] in "MARC!?I" and line[1] == " ": |
1144 if len(line) > 2 and line[0] in "MARC!?I" and line[1] == " ": |
1203 flag, path = line.split(" ", 1) |
1145 flag, path = line.split(" ", 1) |
1249 |
1191 |
1250 args = self.initCommand("status") |
1192 args = self.initCommand("status") |
1251 args.append('--all') |
1193 args.append('--all') |
1252 args.append('--noninteractive') |
1194 args.append('--noninteractive') |
1253 |
1195 |
1254 output = "" |
1196 output, error = self.__client.runcommand(args) |
1255 if self.__client is None: |
|
1256 process = QProcess() |
|
1257 process.setWorkingDirectory(dname) |
|
1258 process.start('hg', args) |
|
1259 procStarted = process.waitForStarted(5000) |
|
1260 if procStarted: |
|
1261 finished = process.waitForFinished(30000) |
|
1262 if finished and process.exitCode() == 0: |
|
1263 output = str(process.readAllStandardOutput(), |
|
1264 self.getEncoding(), 'replace') |
|
1265 else: |
|
1266 output, error = self.__client.runcommand(args) |
|
1267 |
1197 |
1268 if output: |
1198 if output: |
1269 dirs = [x for x in names.keys() if os.path.isdir(x)] |
1199 dirs = [x for x in names.keys() if os.path.isdir(x)] |
1270 for line in output.splitlines(): |
1200 for line in output.splitlines(): |
1271 if line and line[0] in "MARC!?I": |
1201 if line and line[0] in "MARC!?I": |
1409 args = self.initCommand("parents") |
1339 args = self.initCommand("parents") |
1410 args.append('--template') |
1340 args.append('--template') |
1411 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1341 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1412 '{date|isodate}@@@{branches}@@@{bookmarks}\n') |
1342 '{date|isodate}@@@{branches}@@@{bookmarks}\n') |
1413 |
1343 |
1414 output = "" |
1344 output, error = self.__client.runcommand(args) |
1415 if self.__client is None: |
|
1416 process = QProcess() |
|
1417 process.setWorkingDirectory(ppath) |
|
1418 process.start('hg', args) |
|
1419 procStarted = process.waitForStarted(5000) |
|
1420 if procStarted: |
|
1421 finished = process.waitForFinished(30000) |
|
1422 if finished and process.exitCode() == 0: |
|
1423 output = str(process.readAllStandardOutput(), |
|
1424 self.getEncoding(), 'replace') |
|
1425 else: |
|
1426 output, error = self.__client.runcommand(args) |
|
1427 |
1345 |
1428 infoBlock = [] |
1346 infoBlock = [] |
1429 if output: |
1347 if output: |
1430 index = 0 |
1348 index = 0 |
1431 for line in output.splitlines(): |
1349 for line in output.splitlines(): |
1468 |
1386 |
1469 url = "" |
1387 url = "" |
1470 args = self.initCommand("showconfig") |
1388 args = self.initCommand("showconfig") |
1471 args.append('paths.default') |
1389 args.append('paths.default') |
1472 |
1390 |
1473 output = "" |
1391 output, error = self.__client.runcommand(args) |
1474 if self.__client is None: |
|
1475 process.setWorkingDirectory(ppath) |
|
1476 process.start('hg', args) |
|
1477 procStarted = process.waitForStarted(5000) |
|
1478 if procStarted: |
|
1479 finished = process.waitForFinished(30000) |
|
1480 if finished and process.exitCode() == 0: |
|
1481 output = str(process.readAllStandardOutput(), |
|
1482 self.getEncoding(), 'replace') |
|
1483 else: |
|
1484 output, error = self.__client.runcommand(args) |
|
1485 |
1392 |
1486 if output: |
1393 if output: |
1487 url = output.splitlines()[0].strip() |
1394 url = output.splitlines()[0].strip() |
1488 else: |
1395 else: |
1489 url = "" |
1396 url = "" |
1579 and boolean), if withType is True |
1486 and boolean), if withType is True |
1580 """ |
1487 """ |
1581 args = self.initCommand("tags") |
1488 args = self.initCommand("tags") |
1582 args.append('--verbose') |
1489 args.append('--verbose') |
1583 |
1490 |
1584 output = "" |
1491 output, error = self.__client.runcommand(args) |
1585 if self.__client is None: |
|
1586 process = QProcess() |
|
1587 process.setWorkingDirectory(repodir) |
|
1588 process.start('hg', args) |
|
1589 procStarted = process.waitForStarted(5000) |
|
1590 if procStarted: |
|
1591 finished = process.waitForFinished(30000) |
|
1592 if finished and process.exitCode() == 0: |
|
1593 output = str(process.readAllStandardOutput(), |
|
1594 self.getEncoding(), 'replace') |
|
1595 else: |
|
1596 output, error = self.__client.runcommand(args) |
|
1597 |
1492 |
1598 tagsList = [] |
1493 tagsList = [] |
1599 if output: |
1494 if output: |
1600 for line in output.splitlines(): |
1495 for line in output.splitlines(): |
1601 li = line.strip().split() |
1496 li = line.strip().split() |
1628 @return list of branches (list of string) |
1523 @return list of branches (list of string) |
1629 """ |
1524 """ |
1630 args = self.initCommand("branches") |
1525 args = self.initCommand("branches") |
1631 args.append('--closed') |
1526 args.append('--closed') |
1632 |
1527 |
1633 output = "" |
1528 output, error = self.__client.runcommand(args) |
1634 if self.__client is None: |
|
1635 process = QProcess() |
|
1636 process.setWorkingDirectory(repodir) |
|
1637 process.start('hg', args) |
|
1638 procStarted = process.waitForStarted(5000) |
|
1639 if procStarted: |
|
1640 finished = process.waitForFinished(30000) |
|
1641 if finished and process.exitCode() == 0: |
|
1642 output = str(process.readAllStandardOutput(), |
|
1643 self.getEncoding(), 'replace') |
|
1644 else: |
|
1645 output, error = self.__client.runcommand(args) |
|
1646 |
1529 |
1647 if output: |
1530 if output: |
1648 self.branchesList = [] |
1531 self.branchesList = [] |
1649 for line in output.splitlines(): |
1532 for line in output.splitlines(): |
1650 li = line.strip().split() |
1533 li = line.strip().split() |
1766 if rev: |
1649 if rev: |
1767 args.append("--rev") |
1650 args.append("--rev") |
1768 args.append(rev) |
1651 args.append(rev) |
1769 args.append(name) |
1652 args.append(name) |
1770 |
1653 |
1771 if self.__client is None: |
1654 output, error = self.__client.runcommand(args) |
1772 output = "" |
|
1773 error = "" |
|
1774 |
|
1775 # find the root of the repo |
|
1776 repodir = self.splitPath(name)[0] |
|
1777 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
1778 repodir = os.path.dirname(repodir) |
|
1779 if os.path.splitdrive(repodir)[1] == os.sep: |
|
1780 return "", "" |
|
1781 |
|
1782 process = QProcess() |
|
1783 process.setWorkingDirectory(repodir) |
|
1784 process.start('hg', args) |
|
1785 procStarted = process.waitForStarted(5000) |
|
1786 if procStarted: |
|
1787 finished = process.waitForFinished(30000) |
|
1788 if finished: |
|
1789 if process.exitCode() == 0: |
|
1790 output = str(process.readAllStandardOutput(), |
|
1791 self.getEncoding(), 'replace') |
|
1792 else: |
|
1793 error = str(process.readAllStandardError(), |
|
1794 self.getEncoding(), 'replace') |
|
1795 else: |
|
1796 error = self.tr( |
|
1797 "The hg process did not finish within 30s.") |
|
1798 else: |
|
1799 error = self.tr( |
|
1800 'The process {0} could not be started. ' |
|
1801 'Ensure, that it is in the search path.').format('hg') |
|
1802 else: |
|
1803 output, error = self.__client.runcommand(args) |
|
1804 |
1655 |
1805 # return file contents with 'universal newlines' |
1656 # return file contents with 'universal newlines' |
1806 return output.replace('\r\n', '\n').replace('\r', '\n'), error |
1657 return output.replace('\r\n', '\n').replace('\r', '\n'), error |
1807 |
1658 |
1808 def hgSbsDiff(self, name, extended=False, revisions=None): |
1659 def hgSbsDiff(self, name, extended=False, revisions=None): |
2030 args = self.initCommand(mode) |
1881 args = self.initCommand(mode) |
2031 args.append('--template') |
1882 args.append('--template') |
2032 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
1883 args.append('{rev}:{node|short}@@@{tags}@@@{author|xmlescape}@@@' |
2033 '{date|isodate}@@@{branches}@@@{parents}@@@{bookmarks}\n') |
1884 '{date|isodate}@@@{branches}@@@{parents}@@@{bookmarks}\n') |
2034 |
1885 |
2035 output = "" |
1886 output, error = self.__client.runcommand(args) |
2036 if self.__client is None: |
|
2037 # find the root of the repo |
|
2038 repodir = self.splitPath(ppath)[0] |
|
2039 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
|
2040 repodir = os.path.dirname(repodir) |
|
2041 if os.path.splitdrive(repodir)[1] == os.sep: |
|
2042 return |
|
2043 |
|
2044 process = QProcess() |
|
2045 process.setWorkingDirectory(repodir) |
|
2046 process.start('hg', args) |
|
2047 procStarted = process.waitForStarted(5000) |
|
2048 if procStarted: |
|
2049 finished = process.waitForFinished(30000) |
|
2050 if finished and process.exitCode() == 0: |
|
2051 output = str(process.readAllStandardOutput(), |
|
2052 self.getEncoding(), 'replace') |
|
2053 else: |
|
2054 output, error = self.__client.runcommand(args) |
|
2055 |
1887 |
2056 if output: |
1888 if output: |
2057 index = 0 |
1889 index = 0 |
2058 for line in output.splitlines(): |
1890 for line in output.splitlines(): |
2059 index += 1 |
1891 index += 1 |
2261 @return name of the current branch |
2093 @return name of the current branch |
2262 @rtype str |
2094 @rtype str |
2263 """ |
2095 """ |
2264 args = self.initCommand("branch") |
2096 args = self.initCommand("branch") |
2265 |
2097 |
2266 output = "" |
2098 output, error = self.__client.runcommand(args) |
2267 if self.__client is None: |
|
2268 process = QProcess() |
|
2269 process.setWorkingDirectory(repodir) |
|
2270 process.start('hg', args) |
|
2271 procStarted = process.waitForStarted(5000) |
|
2272 if procStarted: |
|
2273 finished = process.waitForFinished(30000) |
|
2274 if finished and process.exitCode() == 0: |
|
2275 output = str(process.readAllStandardOutput(), |
|
2276 self.getEncoding(), 'replace') |
|
2277 else: |
|
2278 output, error = self.__client.runcommand(args) |
|
2279 |
2099 |
2280 return output.strip() |
2100 return output.strip() |
2281 |
2101 |
2282 def hgEditUserConfig(self): |
2102 def hgEditUserConfig(self): |
2283 """ |
2103 """ |
3354 have been configured. |
3174 have been configured. |
3355 """ |
3175 """ |
3356 args = self.initCommand("showconfig") |
3176 args = self.initCommand("showconfig") |
3357 args.append('paths') |
3177 args.append('paths') |
3358 |
3178 |
3359 output = "" |
3179 output, error = self.__client.runcommand(args) |
3360 if self.__client is None: |
|
3361 process = QProcess() |
|
3362 self.__repoDir and process.setWorkingDirectory(self.__repoDir) |
|
3363 process.start('hg', args) |
|
3364 procStarted = process.waitForStarted(5000) |
|
3365 if procStarted: |
|
3366 finished = process.waitForFinished(30000) |
|
3367 if finished and process.exitCode() == 0: |
|
3368 output = str(process.readAllStandardOutput(), |
|
3369 self.getEncoding(), 'replace') |
|
3370 else: |
|
3371 output, error = self.__client.runcommand(args) |
|
3372 |
3180 |
3373 self.__defaultConfigured = False |
3181 self.__defaultConfigured = False |
3374 self.__defaultPushConfigured = False |
3182 self.__defaultPushConfigured = False |
3375 if output: |
3183 if output: |
3376 for line in output.splitlines(): |
3184 for line in output.splitlines(): |
3404 if os.path.splitdrive(repodir)[1] == os.sep: |
3212 if os.path.splitdrive(repodir)[1] == os.sep: |
3405 return False |
3213 return False |
3406 |
3214 |
3407 args = self.initCommand("identify") |
3215 args = self.initCommand("identify") |
3408 |
3216 |
3409 output = "" |
3217 output, error = self.__client.runcommand(args) |
3410 if self.__client is None: |
|
3411 process = QProcess() |
|
3412 process.setWorkingDirectory(repodir) |
|
3413 process.start('hg', args) |
|
3414 procStarted = process.waitForStarted(5000) |
|
3415 if procStarted: |
|
3416 finished = process.waitForFinished(30000) |
|
3417 if finished and process.exitCode() == 0: |
|
3418 output = str(process.readAllStandardOutput(), |
|
3419 self.getEncoding(), 'replace') |
|
3420 else: |
|
3421 output, error = self.__client.runcommand(args) |
|
3422 |
3218 |
3423 return output.count('+') == 2 |
3219 return output.count('+') == 2 |
3424 |
3220 |
3425 def canPull(self): |
3221 def canPull(self): |
3426 """ |
3222 """ |
3451 None, |
3247 None, |
3452 self.tr("Mercurial Command Server"), |
3248 self.tr("Mercurial Command Server"), |
3453 self.tr( |
3249 self.tr( |
3454 """<p>The Mercurial Command Server could not be""" |
3250 """<p>The Mercurial Command Server could not be""" |
3455 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
3251 """ restarted.</p><p>Reason: {0}</p>""").format(err)) |
3456 self.__client = None |
|
3457 |
3252 |
3458 self.__getExtensionsInfo() |
3253 self.__getExtensionsInfo() |
3459 |
3254 |
3460 if self.__repoIniFile and path == self.__repoIniFile: |
3255 if self.__repoIniFile and path == self.__repoIniFile: |
3461 self.__checkDefaults() |
3256 self.__checkDefaults() |
3496 self.__activeExtensions = [] |
3291 self.__activeExtensions = [] |
3497 |
3292 |
3498 args = self.initCommand("showconfig") |
3293 args = self.initCommand("showconfig") |
3499 args.append('extensions') |
3294 args.append('extensions') |
3500 |
3295 |
3501 output = "" |
3296 output, error = self.__client.runcommand(args) |
3502 if self.__client is None: |
|
3503 process = QProcess() |
|
3504 self.__repoDir and process.setWorkingDirectory(self.__repoDir) |
|
3505 process.start('hg', args) |
|
3506 procStarted = process.waitForStarted(5000) |
|
3507 if procStarted: |
|
3508 finished = process.waitForFinished(30000) |
|
3509 if finished and process.exitCode() == 0: |
|
3510 output = str(process.readAllStandardOutput(), |
|
3511 self.getEncoding(), 'replace') |
|
3512 else: |
|
3513 output, error = self.__client.runcommand(args) |
|
3514 |
3297 |
3515 if output: |
3298 if output: |
3516 for line in output.splitlines(): |
3299 for line in output.splitlines(): |
3517 extensionName = ( |
3300 extensionName = ( |
3518 line.split("=", 1)[0].strip().split(".")[-1].strip() |
3301 line.split("=", 1)[0].strip().split(".")[-1].strip() |
3585 self.__projectHelper = self.__plugin.getProjectHelper() |
3368 self.__projectHelper = self.__plugin.getProjectHelper() |
3586 self.__projectHelper.setObjects(self, project) |
3369 self.__projectHelper.setObjects(self, project) |
3587 self.__monitorRepoIniFile(project.getProjectPath()) |
3370 self.__monitorRepoIniFile(project.getProjectPath()) |
3588 |
3371 |
3589 if repodir: |
3372 if repodir: |
3590 from .HgClient import HgClient |
3373 self.__createClient(repodir) |
3591 client = HgClient(repodir, "utf-8", self) |
|
3592 ok, err = client.startServer() |
|
3593 if ok: |
|
3594 self.__client = client |
|
3595 else: |
|
3596 E5MessageBox.warning( |
|
3597 None, |
|
3598 self.tr("Mercurial Command Server"), |
|
3599 self.tr( |
|
3600 """<p>The Mercurial Command Server could not be""" |
|
3601 """ started.</p><p>Reason: {0}</p>""").format(err)) |
|
3602 |
3374 |
3603 return self.__projectHelper |
3375 return self.__projectHelper |
3604 |
3376 |
|
3377 ########################################################################### |
|
3378 ## Methods to handle the Mercurial command server are below. |
|
3379 ########################################################################### |
|
3380 |
|
3381 def __createClient(self, repodir=""): |
|
3382 """ |
|
3383 Private method to create a Mercurial command server client. |
|
3384 |
|
3385 @param repodir path of the local repository |
|
3386 @type str |
|
3387 """ |
|
3388 if self.__client is not None: |
|
3389 self.__client.stopServer() |
|
3390 self.__client = None |
|
3391 |
|
3392 self.__client = HgClient(repodir, "utf-8", self) |
|
3393 ok, err = self.__client.startServer() |
|
3394 if not ok: |
|
3395 E5MessageBox.warning( |
|
3396 None, |
|
3397 self.tr("Mercurial Command Server"), |
|
3398 self.tr( |
|
3399 """<p>The Mercurial Command Server could not be""" |
|
3400 """ started.</p><p>Reason: {0}</p>""").format(err)) |
|
3401 |
|
3402 def getClient(self): |
|
3403 """ |
|
3404 Public method to get a reference to the command server interface. |
|
3405 |
|
3406 @return reference to the client (HgClient) |
|
3407 """ |
|
3408 if self.__client is None: |
|
3409 self.__createClient(self.__repoDir) |
|
3410 |
|
3411 return self.__client |
|
3412 |
3605 ########################################################################### |
3413 ########################################################################### |
3606 ## Status Monitor Thread methods |
3414 ## Status Monitor Thread methods |
3607 ########################################################################### |
3415 ########################################################################### |
3608 |
3416 |
3609 def _createStatusMonitorThread(self, interval, project): |
3417 def _createStatusMonitorThread(self, interval, project): |