23 from eric7 import Preferences, Utilities |
23 from eric7 import Preferences, Utilities |
24 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
24 from eric7.EricUtilities.EricMutexLocker import EricMutexLocker |
25 from eric7.EricWidgets import EricMessageBox |
25 from eric7.EricWidgets import EricMessageBox |
26 from eric7.EricWidgets.EricApplication import ericApp |
26 from eric7.EricWidgets.EricApplication import ericApp |
27 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
27 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
28 from eric7.VCS.VersionControl import VersionControl |
28 from eric7.VCS.VersionControl import VersionControl, VersionControlState |
29 |
29 |
30 from .SvnDialog import SvnDialog |
30 from .SvnDialog import SvnDialog |
31 from .SvnUtilities import amendConfig, createDefaultConfig, getConfigPath |
31 from .SvnUtilities import amendConfig, createDefaultConfig, getConfigPath |
32 |
32 |
33 |
33 |
752 repodir = os.path.dirname(repodir) |
752 repodir = os.path.dirname(repodir) |
753 if os.path.splitdrive(repodir)[1] == os.sep: |
753 if os.path.splitdrive(repodir)[1] == os.sep: |
754 return # oops, project is not version controlled |
754 return # oops, project is not version controlled |
755 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
755 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
756 os.path.normcase(dname) not in self.statusCache |
756 os.path.normcase(dname) not in self.statusCache |
757 or self.statusCache[os.path.normcase(dname)] == self.canBeAdded |
757 or self.statusCache[os.path.normcase(dname)] |
|
758 == VersionControlState.Uncontrolled |
758 ): |
759 ): |
759 # add directories recursively, if they aren't in the |
760 # add directories recursively, if they aren't in the |
760 # repository already |
761 # repository already |
761 tree.insert(-1, dname) |
762 tree.insert(-1, dname) |
762 dname = os.path.dirname(dname) |
763 dname = os.path.dirname(dname) |
889 repodir = os.path.dirname(repodir) |
892 repodir = os.path.dirname(repodir) |
890 if os.path.splitdrive(repodir)[1] == os.sep: |
893 if os.path.splitdrive(repodir)[1] == os.sep: |
891 return # oops, project is not version controlled |
894 return # oops, project is not version controlled |
892 while (os.path.normcase(dname) != os.path.normcase(repodir)) and ( |
895 while (os.path.normcase(dname) != os.path.normcase(repodir)) and ( |
893 os.path.normcase(dname) not in self.statusCache |
896 os.path.normcase(dname) not in self.statusCache |
894 or self.statusCache[os.path.normcase(dname)] == self.canBeAdded |
897 or self.statusCache[os.path.normcase(dname)] |
|
898 == VersionControlState.Uncontrolled |
895 ): |
899 ): |
896 # add directories recursively, if they aren't in the |
900 # add directories recursively, if they aren't in the |
897 # repository already |
901 # repository already |
898 tree.insert(-1, dname) |
902 tree.insert(-1, dname) |
899 dname = os.path.dirname(dname) |
903 dname = os.path.dirname(dname) |
1498 This is the variant for subversion installations using the new |
1502 This is the variant for subversion installations using the new |
1499 working copy meta-data format. |
1503 working copy meta-data format. |
1500 |
1504 |
1501 @param name filename to check |
1505 @param name filename to check |
1502 @type str |
1506 @type str |
1503 @return registered state (one of canBeCommited and canBeAdded) |
1507 @return registered state |
1504 @rtype int |
1508 @rtype VersionControlState |
1505 """ |
1509 """ |
1506 if name.endswith(os.sep): |
1510 if name.endswith(os.sep): |
1507 name = name[:-1] |
1511 name = name[:-1] |
1508 name = os.path.normcase(name) |
1512 name = os.path.normcase(name) |
1509 dname, fname = self.splitPath(name) |
1513 dname, fname = self.splitPath(name) |
1510 |
1514 |
1511 if fname == "." and os.path.isdir(os.path.join(dname, self.adminDir)): |
1515 if fname == "." and os.path.isdir(os.path.join(dname, self.adminDir)): |
1512 return self.canBeCommitted |
1516 return VersionControlState.Controlled |
1513 |
1517 |
1514 if name in self.statusCache: |
1518 if name in self.statusCache: |
1515 return self.statusCache[name] |
1519 return self.statusCache[name] |
1516 |
1520 |
1517 name = os.path.normcase(name) |
1521 name = os.path.normcase(name) |
1518 states = {name: 0} |
1522 states = {name: 0} |
1519 states = self.vcsAllRegisteredStates(states, dname, False) |
1523 states = self.vcsAllRegisteredStates(states, dname, False) |
1520 if states[name] == self.canBeCommitted: |
1524 if states[name] == VersionControlState.Controlled: |
1521 return self.canBeCommitted |
1525 return VersionControlState.Controlled |
1522 else: |
1526 else: |
1523 return self.canBeAdded |
1527 return VersionControlState.Uncontrolled |
1524 |
1528 |
1525 def __vcsRegisteredState_wc(self, name): |
1529 def __vcsRegisteredState_wc(self, name): |
1526 """ |
1530 """ |
1527 Private method used to get the registered state of a file in the vcs. |
1531 Private method used to get the registered state of a file in the vcs. |
1528 |
1532 |
1529 This is the variant for subversion installations using the old working |
1533 This is the variant for subversion installations using the old working |
1530 copy meta-data format. |
1534 copy meta-data format. |
1531 |
1535 |
1532 @param name filename to check |
1536 @param name filename to check |
1533 @type str |
1537 @type str |
1534 @return registered state (one of canBeCommited and canBeAdded) |
1538 @return registered state |
1535 @rtype int |
1539 @rtype VersionControlState |
1536 """ |
1540 """ |
1537 dname, fname = self.splitPath(name) |
1541 dname, fname = self.splitPath(name) |
1538 |
1542 |
1539 if fname == ".": |
1543 if fname == ".": |
1540 if os.path.isdir(os.path.join(dname, self.adminDir)): |
1544 if os.path.isdir(os.path.join(dname, self.adminDir)): |
1541 return self.canBeCommitted |
1545 return VersionControlState.Controlled |
1542 else: |
1546 else: |
1543 return self.canBeAdded |
1547 return VersionControlState.Uncontrolled |
1544 |
1548 |
1545 name = os.path.normcase(name) |
1549 name = os.path.normcase(name) |
1546 states = {name: 0} |
1550 states = {name: 0} |
1547 states = self.vcsAllRegisteredStates(states, dname, False) |
1551 states = self.vcsAllRegisteredStates(states, dname, False) |
1548 if states[name] == self.canBeCommitted: |
1552 if states[name] == VersionControlState.Controlled: |
1549 return self.canBeCommitted |
1553 return VersionControlState.Controlled |
1550 else: |
1554 else: |
1551 return self.canBeAdded |
1555 return VersionControlState.Uncontrolled |
1552 |
1556 |
1553 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1557 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1554 """ |
1558 """ |
1555 Public method used to get the registered states of a number of files |
1559 Public method used to get the registered states of a number of files |
1556 in the vcs. |
1560 in the vcs. |
1631 dirs = [x for x in names if os.path.isdir(x)] |
1635 dirs = [x for x in names if os.path.isdir(x)] |
1632 for file in allFiles: |
1636 for file in allFiles: |
1633 name = os.path.normcase(file.path) |
1637 name = os.path.normcase(file.path) |
1634 if self.__isVersioned(file): |
1638 if self.__isVersioned(file): |
1635 if name in names: |
1639 if name in names: |
1636 names[name] = self.canBeCommitted |
1640 names[name] = VersionControlState.Controlled |
1637 dn = name |
1641 dn = name |
1638 while os.path.splitdrive(dn)[1] != os.sep and dn != repodir: |
1642 while os.path.splitdrive(dn)[1] != os.sep and dn != repodir: |
1639 dn = os.path.dirname(dn) |
1643 dn = os.path.dirname(dn) |
1640 if ( |
1644 if ( |
1641 dn in self.statusCache |
1645 dn in self.statusCache |
1642 and self.statusCache[dn] == self.canBeCommitted |
1646 and self.statusCache[dn] |
|
1647 == VersionControlState.Controlled |
1643 ): |
1648 ): |
1644 break |
1649 break |
1645 self.statusCache[dn] = self.canBeCommitted |
1650 self.statusCache[dn] = VersionControlState.Controlled |
1646 self.statusCache[name] = self.canBeCommitted |
1651 self.statusCache[name] = VersionControlState.Controlled |
1647 if dirs: |
1652 if dirs: |
1648 for d in dirs: |
1653 for d in dirs: |
1649 if name.startswith(d): |
1654 if name.startswith(d): |
1650 names[d] = self.canBeCommitted |
1655 names[d] = VersionControlState.Controlled |
1651 self.statusCache[d] = self.canBeCommitted |
1656 self.statusCache[d] = VersionControlState.Controlled |
1652 dirs.remove(d) |
1657 dirs.remove(d) |
1653 break |
1658 break |
1654 else: |
1659 else: |
1655 self.statusCache[name] = self.canBeAdded |
1660 self.statusCache[name] = VersionControlState.Uncontrolled |
1656 |
1661 |
1657 return names |
1662 return names |
1658 |
1663 |
1659 def __vcsAllRegisteredStates_wc(self, names, dname, shortcut=True): |
1664 def __vcsAllRegisteredStates_wc(self, names, dname, shortcut=True): |
1660 """ |
1665 """ |