src/eric7/VCS/VersionControl.py

branch
eric7
changeset 10491
acabc60b19a2
parent 10475
ee41fab001f2
child 10683
779cda568acb
equal deleted inserted replaced
10490:527d47826e97 10491:acabc60b19a2
7 Module implementing an abstract base class to be subclassed by all specific 7 Module implementing an abstract base class to be subclassed by all specific
8 VCS interfaces. 8 VCS interfaces.
9 """ 9 """
10 10
11 import contextlib 11 import contextlib
12 import enum
12 import json 13 import json
13 import os 14 import os
14 15
15 from PyQt6.QtCore import ( 16 from PyQt6.QtCore import (
16 QCoreApplication, 17 QCoreApplication,
27 from eric7 import Preferences 28 from eric7 import Preferences
28 from eric7.EricWidgets import EricMessageBox 29 from eric7.EricWidgets import EricMessageBox
29 from eric7.EricWidgets.EricApplication import ericApp 30 from eric7.EricWidgets.EricApplication import ericApp
30 31
31 32
33 class VersionControlState(enum.Enum):
34 """
35 Class defining the global VCS states of files and directories.
36 """
37
38 Controlled = 0
39 Uncontrolled = 1
40
41
32 class VersionControl(QObject): 42 class VersionControl(QObject):
33 """ 43 """
34 Class implementing an abstract base class to be subclassed by all specific 44 Class implementing an abstract base class to be subclassed by all specific
35 VCS interfaces. 45 VCS interfaces.
36 46
53 vcsStatusMonitorData = pyqtSignal(list) 63 vcsStatusMonitorData = pyqtSignal(list)
54 vcsStatusMonitorAllData = pyqtSignal(dict) 64 vcsStatusMonitorAllData = pyqtSignal(dict)
55 vcsStatusMonitorStatus = pyqtSignal(str, str) 65 vcsStatusMonitorStatus = pyqtSignal(str, str)
56 vcsStatusMonitorInfo = pyqtSignal(str) 66 vcsStatusMonitorInfo = pyqtSignal(str)
57 vcsStatusChanged = pyqtSignal() 67 vcsStatusChanged = pyqtSignal()
58
59 # TODO: change this to an enum
60 canBeCommitted = 1 # Indicates that a file/directory is in the vcs.
61 canBeAdded = 2 # Indicates that a file/directory is not in vcs.
62 68
63 commitHistoryLock = "commitHistory.lock" 69 commitHistoryLock = "commitHistory.lock"
64 commitHistoryData = "commitHistory.json" 70 commitHistoryData = "commitHistory.json"
65 71
66 def __init__(self, parent=None, name=None): 72 def __init__(self, parent=None, name=None):
561 """ 567 """
562 Public method used to get the registered state of a file in the vcs. 568 Public method used to get the registered state of a file in the vcs.
563 569
564 @param name filename to check 570 @param name filename to check
565 @type str 571 @type str
566 @return registered state (one of canBeCommited and canBeAdded) 572 @return registered state
567 @rtype int 573 @rtype VersionControlState
568 @exception NotImplementedError to indicate that this method must be 574 @exception NotImplementedError to indicate that this method must be
569 implemented by a subclass 575 implemented by a subclass
570 """ 576 """
571 raise NotImplementedError("Not implemented") 577 raise NotImplementedError("Not implemented")
572 578
579 585
580 @param names dictionary with all filenames to be checked as keys 586 @param names dictionary with all filenames to be checked as keys
581 @type dict 587 @type dict
582 @param dname directory to check in 588 @param dname directory to check in
583 @type str 589 @type str
584 @return the received dictionary completed with a combination of 590 @return the received dictionary completed with the VCS state or None in
585 canBeCommited and canBeAdded or None in order to signal an error 591 order to signal an error
586 @rtype dict 592 @rtype dict
587 @exception NotImplementedError to indicate that this method must be 593 @exception NotImplementedError to indicate that this method must be
588 implemented by a subclass 594 implemented by a subclass
589 """ 595 """
590 raise NotImplementedError("Not implemented") 596 raise NotImplementedError("Not implemented")

eric ide

mercurial