VCS/__init__.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
6 """ 6 """
7 Module implementing the general part of the interface to version control systems. 7 Module implementing the general part of the interface to version control systems.
8 8
9 The general part of the VCS interface defines classes to implement common 9 The general part of the VCS interface defines classes to implement common
10 dialogs. These are a dialog to enter command options, a dialog to display 10 dialogs. These are a dialog to enter command options, a dialog to display
11 some repository information and an abstract base class. The individual 11 some repository information and an abstract base class. The individual
12 interfaces (i.e. CVS) have to be subclasses of this base class. 12 interfaces (i.e. CVS) have to be subclasses of this base class.
13 """ 13 """
14 14
15 from E5Gui.E5Application import e5App 15 from E5Gui.E5Application import e5App
16 16
17 ###################################################################### 17 ######################################################################
18 ## Below is the factory function to instantiate the appropriate 18 ## Below is the factory function to instantiate the appropriate
19 ## vcs object depending on the project settings. 19 ## vcs object depending on the project settings.
20 ###################################################################### 20 ######################################################################
21
21 22
22 def factory(vcs): 23 def factory(vcs):
23 """ 24 """
24 Modul factory function to generate the right vcs object. 25 Modul factory function to generate the right vcs object.
25 26
29 pluginManager = e5App().getObject("PluginManager") 30 pluginManager = e5App().getObject("PluginManager")
30 if pluginManager is None: 31 if pluginManager is None:
31 # that should not happen 32 # that should not happen
32 vc = None 33 vc = None
33 34
34 vc = pluginManager.getPluginObject("version_control", vcs, maybeActive = True) 35 vc = pluginManager.getPluginObject("version_control", vcs, maybeActive=True)
35 if vc is None: 36 if vc is None:
36 # try alternative vcs interfaces assuming, that there is a common 37 # try alternative vcs interfaces assuming, that there is a common
37 # indicator for the alternatives 38 # indicator for the alternatives
38 found = False 39 found = False
39 for indicator, vcsData in list(pluginManager.getVcsSystemIndicators().items()): 40 for indicator, vcsData in list(pluginManager.getVcsSystemIndicators().items()):
45 if found: 46 if found:
46 if len(vcsData) > 1: 47 if len(vcsData) > 1:
47 for vcsSystem, vcsSystemDisplay in vcsData: 48 for vcsSystem, vcsSystemDisplay in vcsData:
48 if vcsSystem != vcs: 49 if vcsSystem != vcs:
49 vc = pluginManager.getPluginObject( 50 vc = pluginManager.getPluginObject(
50 "version_control", vcsSystem, maybeActive = True) 51 "version_control", vcsSystem, maybeActive=True)
51 if vc is not None: 52 if vc is not None:
52 break 53 break
53 break 54 break
54 return vc 55 return vc

eric ide

mercurial