18 |
18 |
19 from eric7 import Preferences, Utilities |
19 from eric7 import Preferences, Utilities |
20 from eric7.EricWidgets import EricMessageBox |
20 from eric7.EricWidgets import EricMessageBox |
21 from eric7.EricWidgets.EricApplication import ericApp |
21 from eric7.EricWidgets.EricApplication import ericApp |
22 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
22 from eric7.UI.DeleteFilesConfirmationDialog import DeleteFilesConfirmationDialog |
23 from eric7.VCS.VersionControl import VersionControl |
23 from eric7.VCS.VersionControl import VersionControl, VersionControlState |
24 |
24 |
25 from .SvnDialog import SvnDialog |
25 from .SvnDialog import SvnDialog |
26 from .SvnUtilities import amendConfig, createDefaultConfig, getConfigPath |
26 from .SvnUtilities import amendConfig, createDefaultConfig, getConfigPath |
27 |
27 |
28 |
28 |
700 repodir = os.path.dirname(repodir) |
700 repodir = os.path.dirname(repodir) |
701 if os.path.splitdrive(repodir)[1] == os.sep: |
701 if os.path.splitdrive(repodir)[1] == os.sep: |
702 return # oops, project is not version controlled |
702 return # oops, project is not version controlled |
703 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
703 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
704 os.path.normcase(dname) not in self.statusCache |
704 os.path.normcase(dname) not in self.statusCache |
705 or self.statusCache[os.path.normcase(dname)] == self.canBeAdded |
705 or self.statusCache[os.path.normcase(dname)] |
|
706 == VersionControlState.Uncontrolled |
706 ): |
707 ): |
707 # add directories recursively, if they aren't in the |
708 # add directories recursively, if they aren't in the |
708 # repository already |
709 # repository already |
709 tree.insert(-1, dname) |
710 tree.insert(-1, dname) |
710 dname = os.path.dirname(dname) |
711 dname = os.path.dirname(dname) |
823 repodir = os.path.dirname(repodir) |
826 repodir = os.path.dirname(repodir) |
824 if os.path.splitdrive(repodir)[1] == os.sep: |
827 if os.path.splitdrive(repodir)[1] == os.sep: |
825 return # oops, project is not version controlled |
828 return # oops, project is not version controlled |
826 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
829 while os.path.normcase(dname) != os.path.normcase(repodir) and ( |
827 os.path.normcase(dname) not in self.statusCache |
830 os.path.normcase(dname) not in self.statusCache |
828 or self.statusCache[os.path.normcase(dname)] == self.canBeAdded |
831 or self.statusCache[os.path.normcase(dname)] |
|
832 == VersionControlState.Uncontrolled |
829 ): |
833 ): |
830 # add directories recursively, if they aren't in the |
834 # add directories recursively, if they aren't in the |
831 # repository already |
835 # repository already |
832 tree.insert(-1, dname) |
836 tree.insert(-1, dname) |
833 dname = os.path.dirname(dname) |
837 dname = os.path.dirname(dname) |
1332 This is the variant for subversion installations using the new |
1336 This is the variant for subversion installations using the new |
1333 working copy meta-data format. |
1337 working copy meta-data format. |
1334 |
1338 |
1335 @param name filename to check |
1339 @param name filename to check |
1336 @type str |
1340 @type str |
1337 @return registered state (one of canBeCommited and canBeAdded) |
1341 @return registered state |
1338 @rtype int |
1342 @rtype VersionControlState |
1339 """ |
1343 """ |
1340 if name.endswith(os.sep): |
1344 if name.endswith(os.sep): |
1341 name = name[:-1] |
1345 name = name[:-1] |
1342 name = os.path.normcase(name) |
1346 name = os.path.normcase(name) |
1343 dname, fname = self.splitPath(name) |
1347 dname, fname = self.splitPath(name) |
1344 |
1348 |
1345 if fname == "." and os.path.isdir(os.path.join(dname, self.adminDir)): |
1349 if fname == "." and os.path.isdir(os.path.join(dname, self.adminDir)): |
1346 return self.canBeCommitted |
1350 return VersionControlState.Controlled |
1347 |
1351 |
1348 if name in self.statusCache: |
1352 if name in self.statusCache: |
1349 return self.statusCache[name] |
1353 return self.statusCache[name] |
1350 |
1354 |
1351 name = os.path.normcase(name) |
1355 name = os.path.normcase(name) |
1352 states = {name: 0} |
1356 states = {name: 0} |
1353 states = self.vcsAllRegisteredStates(states, dname, False) |
1357 states = self.vcsAllRegisteredStates(states, dname, False) |
1354 if states[name] == self.canBeCommitted: |
1358 if states[name] == VersionControlState.Controlled: |
1355 return self.canBeCommitted |
1359 return VersionControlState.Controlled |
1356 else: |
1360 else: |
1357 return self.canBeAdded |
1361 return VersionControlState.Uncontrolled |
1358 |
1362 |
1359 def __vcsRegisteredState_wc(self, name): |
1363 def __vcsRegisteredState_wc(self, name): |
1360 """ |
1364 """ |
1361 Private method used to get the registered state of a file in the VCS. |
1365 Private method used to get the registered state of a file in the VCS. |
1362 |
1366 |
1363 This is the variant for subversion installations using the old working |
1367 This is the variant for subversion installations using the old working |
1364 copy meta-data format. |
1368 copy meta-data format. |
1365 |
1369 |
1366 @param name filename to check |
1370 @param name filename to check |
1367 @type str |
1371 @type str |
1368 @return registered state (one of canBeCommited and canBeAdded) |
1372 @return registered state |
1369 @rtype int |
1373 @rtype VersionControlState |
1370 """ |
1374 """ |
1371 dname, fname = self.splitPath(name) |
1375 dname, fname = self.splitPath(name) |
1372 |
1376 |
1373 if fname == ".": |
1377 if fname == ".": |
1374 if os.path.isdir(os.path.join(dname, self.adminDir)): |
1378 if os.path.isdir(os.path.join(dname, self.adminDir)): |
1375 return self.canBeCommitted |
1379 return VersionControlState.Controlled |
1376 else: |
1380 else: |
1377 return self.canBeAdded |
1381 return VersionControlState.Uncontrolled |
1378 |
1382 |
1379 name = os.path.normcase(name) |
1383 name = os.path.normcase(name) |
1380 states = {name: 0} |
1384 states = {name: 0} |
1381 states = self.vcsAllRegisteredStates(states, dname, False) |
1385 states = self.vcsAllRegisteredStates(states, dname, False) |
1382 if states[name] == self.canBeCommitted: |
1386 if states[name] == VersionControlState.Controlled: |
1383 return self.canBeCommitted |
1387 return VersionControlState.Controlled |
1384 else: |
1388 else: |
1385 return self.canBeAdded |
1389 return VersionControlState.Uncontrolled |
1386 |
1390 |
1387 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1391 def vcsAllRegisteredStates(self, names, dname, shortcut=True): |
1388 """ |
1392 """ |
1389 Public method used to get the registered states of a number of files |
1393 Public method used to get the registered states of a number of files |
1390 in the VCS. |
1394 in the VCS. |