156 process.start('svn', ['--version']) |
156 process.start('svn', ['--version']) |
157 procStarted = process.waitForStarted(5000) |
157 procStarted = process.waitForStarted(5000) |
158 if procStarted: |
158 if procStarted: |
159 finished = process.waitForFinished(30000) |
159 finished = process.waitForFinished(30000) |
160 if finished and process.exitCode() == 0: |
160 if finished and process.exitCode() == 0: |
161 output = \ |
161 output = str(process.readAllStandardOutput(), |
162 str(process.readAllStandardOutput(), ioEncoding, 'replace') |
162 ioEncoding, |
|
163 'replace') |
163 self.versionStr = output.split()[2] |
164 self.versionStr = output.split()[2] |
164 v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?', self.versionStr) |
165 v = list(re.match(r'.*?(\d+)\.(\d+)\.?(\d+)?', self.versionStr) |
165 .groups()) |
166 .groups()) |
166 for i in range(3): |
167 for i in range(3): |
167 try: |
168 try: |
173 self.version = tuple(v) |
174 self.version = tuple(v) |
174 return True, errMsg |
175 return True, errMsg |
175 else: |
176 else: |
176 if finished: |
177 if finished: |
177 errMsg = self.tr( |
178 errMsg = self.tr( |
178 "The svn process finished with the exit code {0}")\ |
179 "The svn process finished with the exit code {0}" |
179 .format(process.exitCode()) |
180 ).format(process.exitCode()) |
180 else: |
181 else: |
181 errMsg = self.tr( |
182 errMsg = self.tr( |
182 "The svn process did not finish within 30s.") |
183 "The svn process did not finish within 30s.") |
183 else: |
184 else: |
184 errMsg = self.tr("Could not start the svn executable.") |
185 errMsg = self.tr("Could not start the svn executable.") |
352 |
353 |
353 if self.otherData["standardLayout"]: |
354 if self.otherData["standardLayout"]: |
354 if tag is None or tag == '': |
355 if tag is None or tag == '': |
355 svnUrl = '{0}/trunk'.format(vcsDir) |
356 svnUrl = '{0}/trunk'.format(vcsDir) |
356 else: |
357 else: |
357 if not tag.startswith('tags') and \ |
358 if ( |
358 not tag.startswith('branches'): |
359 not tag.startswith('tags') and |
|
360 not tag.startswith('branches') |
|
361 ): |
359 tagType, ok = QInputDialog.getItem( |
362 tagType, ok = QInputDialog.getItem( |
360 None, |
363 None, |
361 self.tr("Subversion Checkout"), |
364 self.tr("Subversion Checkout"), |
362 self.tr( |
365 self.tr( |
363 "The tag must be a normal tag (tags) or" |
366 "The tag must be a normal tag (tags) or" |
408 |
411 |
409 if self.otherData["standardLayout"]: |
412 if self.otherData["standardLayout"]: |
410 if tag is None or tag == '': |
413 if tag is None or tag == '': |
411 svnUrl = '{0}/trunk'.format(vcsDir) |
414 svnUrl = '{0}/trunk'.format(vcsDir) |
412 else: |
415 else: |
413 if not tag.startswith('tags') and \ |
416 if ( |
414 not tag.startswith('branches'): |
417 not tag.startswith('tags') and |
|
418 not tag.startswith('branches') |
|
419 ): |
415 tagType, ok = QInputDialog.getItem( |
420 tagType, ok = QInputDialog.getItem( |
416 None, |
421 None, |
417 self.tr("Subversion Export"), |
422 self.tr("Subversion Export"), |
418 self.tr( |
423 self.tr( |
419 "The tag must be a normal tag (tags) or" |
424 "The tag must be a normal tag (tags) or" |
489 for nam in nameList: |
494 for nam in nameList: |
490 # check for commit of the project |
495 # check for commit of the project |
491 if os.path.isdir(nam): |
496 if os.path.isdir(nam): |
492 project = e5App().getObject("Project") |
497 project = e5App().getObject("Project") |
493 if nam == project.getProjectPath(): |
498 if nam == project.getProjectPath(): |
494 ok &= project.checkAllScriptsDirty( |
499 ok &= ( |
495 reportSyntaxErrors=True) and \ |
500 project.checkAllScriptsDirty( |
|
501 reportSyntaxErrors=True) and |
496 project.checkDirty() |
502 project.checkDirty() |
|
503 ) |
497 continue |
504 continue |
498 elif os.path.isfile(nam): |
505 elif os.path.isfile(nam): |
499 editor = e5App().getObject("ViewManager")\ |
506 editor = e5App().getObject("ViewManager").getOpenEditor( |
500 .getOpenEditor(nam) |
507 nam) |
501 if editor: |
508 if editor: |
502 ok &= editor.checkDirty() |
509 ok &= editor.checkDirty() |
503 if not ok: |
510 if not ok: |
504 break |
511 break |
505 |
512 |
515 return |
522 return |
516 |
523 |
517 if self.__commitDialog is not None: |
524 if self.__commitDialog is not None: |
518 msg = self.__commitDialog.logMessage() |
525 msg = self.__commitDialog.logMessage() |
519 if self.__commitDialog.hasChangelists(): |
526 if self.__commitDialog.hasChangelists(): |
520 changelists, keepChangelists = \ |
527 changelists, keepChangelists = ( |
521 self.__commitDialog.changelistsData() |
528 self.__commitDialog.changelistsData() |
|
529 ) |
522 else: |
530 else: |
523 changelists, keepChangelists = [], False |
531 changelists, keepChangelists = [], False |
524 self.__commitDialog.deleteLater() |
532 self.__commitDialog.deleteLater() |
525 self.__commitDialog = None |
533 self.__commitDialog = None |
526 else: |
534 else: |
545 self.addArguments(args, fnames) |
553 self.addArguments(args, fnames) |
546 else: |
554 else: |
547 dname, fname = self.splitPath(name) |
555 dname, fname = self.splitPath(name) |
548 args.append(fname) |
556 args.append(fname) |
549 |
557 |
550 if self.svnGetReposName(dname).startswith('http') or \ |
558 if ( |
551 self.svnGetReposName(dname).startswith('svn'): |
559 self.svnGetReposName(dname).startswith('http') or |
|
560 self.svnGetReposName(dname).startswith('svn') |
|
561 ): |
552 noDialog = False |
562 noDialog = False |
553 |
563 |
554 if noDialog: |
564 if noDialog: |
555 self.startSynchronizedProcess(QProcess(), "svn", args, dname) |
565 self.startSynchronizedProcess(QProcess(), "svn", args, dname) |
556 else: |
566 else: |
633 repodir = dname |
643 repodir = dname |
634 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
644 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
635 repodir = os.path.dirname(repodir) |
645 repodir = os.path.dirname(repodir) |
636 if os.path.splitdrive(repodir)[1] == os.sep: |
646 if os.path.splitdrive(repodir)[1] == os.sep: |
637 return # oops, project is not version controlled |
647 return # oops, project is not version controlled |
638 while os.path.normcase(dname) != os.path.normcase(repodir) and \ |
648 while ( |
639 (os.path.normcase(dname) not in self.statusCache or |
649 os.path.normcase(dname) != os.path.normcase(repodir) and |
640 self.statusCache[os.path.normcase(dname)] == |
650 (os.path.normcase(dname) not in self.statusCache or |
641 self.canBeAdded): |
651 self.statusCache[os.path.normcase(dname)] == |
|
652 self.canBeAdded) |
|
653 ): |
642 # add directories recursively, if they aren't in the |
654 # add directories recursively, if they aren't in the |
643 # repository already |
655 # repository already |
644 tree.insert(-1, dname) |
656 tree.insert(-1, dname) |
645 dname = os.path.dirname(dname) |
657 dname = os.path.dirname(dname) |
646 wdir = dname |
658 wdir = dname |
662 while not os.path.isdir( |
674 while not os.path.isdir( |
663 os.path.join(repodir, self.adminDir)): |
675 os.path.join(repodir, self.adminDir)): |
664 repodir = os.path.dirname(repodir) |
676 repodir = os.path.dirname(repodir) |
665 if os.path.splitdrive(repodir)[1] == os.sep: |
677 if os.path.splitdrive(repodir)[1] == os.sep: |
666 return # oops, project is not version controlled |
678 return # oops, project is not version controlled |
667 while os.path.normcase(d) != \ |
679 while ( |
668 os.path.normcase(repodir) and \ |
680 os.path.normcase(d) != os.path.normcase(repodir) and |
669 (d not in tree2 + tree) and \ |
681 (d not in tree2 + tree) and |
670 (os.path.normcase(d) not in self.statusCache or |
682 (os.path.normcase(d) not in self.statusCache or |
671 self.statusCache[os.path.normcase(d)] == |
683 self.statusCache[os.path.normcase(d)] == |
672 self.canBeAdded): |
684 self.canBeAdded) |
|
685 ): |
673 tree2.append(d) |
686 tree2.append(d) |
674 d = os.path.dirname(d) |
687 d = os.path.dirname(d) |
675 else: |
688 else: |
676 while not os.path.exists(os.path.join(d, self.adminDir)): |
689 while not os.path.exists(os.path.join(d, self.adminDir)): |
677 if d in tree2 + tree: |
690 if d in tree2 + tree: |
727 while not os.path.isdir( |
740 while not os.path.isdir( |
728 os.path.join(repodir, self.adminDir)): |
741 os.path.join(repodir, self.adminDir)): |
729 repodir = os.path.dirname(repodir) |
742 repodir = os.path.dirname(repodir) |
730 if os.path.splitdrive(repodir)[1] == os.sep: |
743 if os.path.splitdrive(repodir)[1] == os.sep: |
731 return # oops, project is not version controlled |
744 return # oops, project is not version controlled |
732 while os.path.normcase(d) != \ |
745 while ( |
733 os.path.normcase(repodir) and \ |
746 os.path.normcase(d) != os.path.normcase(repodir) and |
734 (d not in tree) and \ |
747 (d not in tree) and |
735 (os.path.normcase(d) not in self.statusCache or |
748 (os.path.normcase(d) not in self.statusCache or |
736 self.statusCache[os.path.normcase(d)] == |
749 self.statusCache[os.path.normcase(d)] == |
737 self.canBeAdded): |
750 self.canBeAdded) |
|
751 ): |
738 tree.append(d) |
752 tree.append(d) |
739 d = os.path.dirname(d) |
753 d = os.path.dirname(d) |
740 else: |
754 else: |
741 while not os.path.exists(os.path.join(d, self.adminDir)): |
755 while not os.path.exists(os.path.join(d, self.adminDir)): |
742 # add directories recursively, |
756 # add directories recursively, |
752 repodir = dname |
766 repodir = dname |
753 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
767 while not os.path.isdir(os.path.join(repodir, self.adminDir)): |
754 repodir = os.path.dirname(repodir) |
768 repodir = os.path.dirname(repodir) |
755 if os.path.splitdrive(repodir)[1] == os.sep: |
769 if os.path.splitdrive(repodir)[1] == os.sep: |
756 return # oops, project is not version controlled |
770 return # oops, project is not version controlled |
757 while os.path.normcase(dname) != \ |
771 while ( |
758 os.path.normcase(repodir) and \ |
772 os.path.normcase(dname) != os.path.normcase(repodir) and |
759 (os.path.normcase(dname) not in self.statusCache or |
773 (os.path.normcase(dname) not in self.statusCache or |
760 self.statusCache[os.path.normcase(dname)] == |
774 self.statusCache[os.path.normcase(dname)] == |
761 self.canBeAdded): |
775 self.canBeAdded) |
|
776 ): |
762 # add directories recursively, if they aren't in the |
777 # add directories recursively, if they aren't in the |
763 # repository already |
778 # repository already |
764 tree.insert(-1, dname) |
779 tree.insert(-1, dname) |
765 dname = os.path.dirname(dname) |
780 dname = os.path.dirname(dname) |
766 else: |
781 else: |
1038 names = [name] |
1053 names = [name] |
1039 |
1054 |
1040 project = e5App().getObject("Project") |
1055 project = e5App().getObject("Project") |
1041 names = [project.getRelativePath(nam) for nam in names] |
1056 names = [project.getRelativePath(nam) for nam in names] |
1042 if names[0]: |
1057 if names[0]: |
1043 from UI.DeleteFilesConfirmationDialog import \ |
1058 from UI.DeleteFilesConfirmationDialog import ( |
1044 DeleteFilesConfirmationDialog |
1059 DeleteFilesConfirmationDialog |
|
1060 ) |
1045 dlg = DeleteFilesConfirmationDialog( |
1061 dlg = DeleteFilesConfirmationDialog( |
1046 self.parent(), |
1062 self.parent(), |
1047 self.tr("Revert changes"), |
1063 self.tr("Revert changes"), |
1048 self.tr("Do you really want to revert all changes to" |
1064 self.tr("Do you really want to revert all changes to" |
1049 " these files or directories?"), |
1065 " these files or directories?"), |
1569 info['revision'] = rev |
1585 info['revision'] = rev |
1570 entryFound = False |
1586 entryFound = False |
1571 elif commitFound: |
1587 elif commitFound: |
1572 info['committed-rev'] = rev |
1588 info['committed-rev'] = rev |
1573 elif line.startswith('<url>'): |
1589 elif line.startswith('<url>'): |
1574 info['url'] = \ |
1590 info['url'] = ( |
1575 line.replace('<url>', '').replace('</url>', '') |
1591 line.replace('<url>', '').replace('</url>', '') |
|
1592 ) |
1576 elif line.startswith('<author>'): |
1593 elif line.startswith('<author>'): |
1577 info['last-author'] = line.replace('<author>', '')\ |
1594 info['last-author'] = ( |
|
1595 line.replace('<author>', '') |
1578 .replace('</author>', '') |
1596 .replace('</author>', '') |
|
1597 ) |
1579 elif line.startswith('<date>'): |
1598 elif line.startswith('<date>'): |
1580 value = line.replace('<date>', '')\ |
1599 value = ( |
1581 .replace('</date>', '') |
1600 line.replace('<date>', '').replace('</date>', '') |
|
1601 ) |
1582 date, time = value.split('T') |
1602 date, time = value.split('T') |
1583 info['committed-date'] = date |
1603 info['committed-date'] = date |
1584 info['committed-time'] = "{0}{1}".format( |
1604 info['committed-time'] = "{0}{1}".format( |
1585 time.split('.')[0], time[-1]) |
1605 time.split('.')[0], time[-1]) |
1586 |
1606 |
1632 output = str(process.readAllStandardOutput(), ioEncoding, |
1652 output = str(process.readAllStandardOutput(), ioEncoding, |
1633 'replace') |
1653 'replace') |
1634 for line in output.splitlines(): |
1654 for line in output.splitlines(): |
1635 line = line.strip() |
1655 line = line.strip() |
1636 if line.startswith('<url>'): |
1656 if line.startswith('<url>'): |
1637 reposURL = line.replace('<url>', '')\ |
1657 reposURL = ( |
1638 .replace('</url>', '') |
1658 line.replace('<url>', '').replace('</url>', '') |
|
1659 ) |
1639 return reposURL |
1660 return reposURL |
1640 |
1661 |
1641 return "" |
1662 return "" |
1642 |
1663 |
1643 def svnResolve(self, name): |
1664 def svnResolve(self, name): |
1696 .format(name)) |
1717 .format(name)) |
1697 res = dia.startProcess(args) |
1718 res = dia.startProcess(args) |
1698 if res: |
1719 if res: |
1699 dia.exec_() |
1720 dia.exec_() |
1700 res = dia.normalExit() |
1721 res = dia.normalExit() |
1701 if res and \ |
1722 if ( |
1702 not rx_prot.exactMatch(target) and \ |
1723 res and |
1703 target.startswith(project.getProjectPath()): |
1724 not rx_prot.exactMatch(target) and |
|
1725 target.startswith(project.getProjectPath()) |
|
1726 ): |
1704 if os.path.isdir(name): |
1727 if os.path.isdir(name): |
1705 project.copyDirectory(name, target) |
1728 project.copyDirectory(name, target) |
1706 else: |
1729 else: |
1707 project.appendFile(target) |
1730 project.appendFile(target) |
1708 return res |
1731 return res |
2254 process.start('svn', args) |
2277 process.start('svn', args) |
2255 procStarted = process.waitForStarted(5000) |
2278 procStarted = process.waitForStarted(5000) |
2256 if procStarted: |
2279 if procStarted: |
2257 finished = process.waitForFinished(30000) |
2280 finished = process.waitForFinished(30000) |
2258 if finished and process.exitCode() == 0: |
2281 if finished and process.exitCode() == 0: |
2259 output = \ |
2282 output = str(process.readAllStandardOutput(), |
2260 str(process.readAllStandardOutput(), |
2283 Preferences.getSystem("IOEncoding"), |
2261 Preferences.getSystem("IOEncoding"), |
2284 'replace') |
2262 'replace') |
|
2263 if output: |
2285 if output: |
2264 for line in output.splitlines(): |
2286 for line in output.splitlines(): |
2265 if rx_changelist.exactMatch(line): |
2287 if rx_changelist.exactMatch(line): |
2266 changelist = rx_changelist.cap(1) |
2288 changelist = rx_changelist.cap(1) |
2267 if changelist not in changelists: |
2289 if changelist not in changelists: |
2360 @param project reference to the project object |
2382 @param project reference to the project object |
2361 @return the project helper object |
2383 @return the project helper object |
2362 """ |
2384 """ |
2363 helper = self.__plugin.getProjectHelper() |
2385 helper = self.__plugin.getProjectHelper() |
2364 helper.setObjects(self, project) |
2386 helper.setObjects(self, project) |
2365 self.__wcng = \ |
2387 self.__wcng = ( |
2366 os.path.exists( |
2388 os.path.exists( |
2367 os.path.join(project.getProjectPath(), ".svn", "format")) or \ |
2389 os.path.join(project.getProjectPath(), ".svn", "format")) or |
2368 os.path.exists( |
2390 os.path.exists( |
2369 os.path.join(project.getProjectPath(), "_svn", "format")) or \ |
2391 os.path.join(project.getProjectPath(), "_svn", "format")) or |
2370 os.path.exists( |
2392 os.path.exists( |
2371 os.path.join(project.getProjectPath(), ".svn", "wc.db")) or \ |
2393 os.path.join(project.getProjectPath(), ".svn", "wc.db")) or |
2372 os.path.exists( |
2394 os.path.exists( |
2373 os.path.join(project.getProjectPath(), "_svn", "wc.db")) |
2395 os.path.join(project.getProjectPath(), "_svn", "wc.db")) |
|
2396 ) |
2374 return helper |
2397 return helper |
2375 |
2398 |
2376 ########################################################################### |
2399 ########################################################################### |
2377 ## Status Monitor Thread methods |
2400 ## Status Monitor Thread methods |
2378 ########################################################################### |
2401 ########################################################################### |