Package PyFoam :: Package Basics :: Module GeneralVCSInterface
[hide private]
[frames] | no frames]

Source Code for Module PyFoam.Basics.GeneralVCSInterface

 1  #  ICE Revision: $Id: /local/openfoam/Python/PyFoam/PyFoam/Basics/GeneralVCSInterface.py 7239 2011-02-23T17:26:11.661549Z bgschaid  $  
 2  """General interface to VCS implementations""" 
 3   
 4  from PyFoam.Error import notImplemented,error 
 5   
6 -class GeneralVCSInterface(object):
7 """This is an abstract class that implements an interface to general VCS operations""" 8
9 - def __init__(self, 10 path, 11 init=False):
12 """@param path: path which is supposed to be under version control 13 @param init: initialize the version control system here""" 14 15 self.path=path
16
17 - def commit(self, 18 msg):
19 """Commit the current state 20 @param msg: Commit message""" 21 22 notImplemented(self,"commit")
23
24 - def addPath(self, 25 path, 26 rules=[]):
27 """Add the path to the repository (no commit) 28 @param path: the path (directory or file) to commit 29 @param rules: a list of tuples: first is whether to include or exclude 30 the regular expression that is the second member of the tuple""" 31 32 notImplemented(self,"addPath")
33
34 - def clone(self, 35 dest):
36 """Clone the repository 37 @param dest: the path that should be clones to""" 38 39 notImplemented(self,"clone")
40
41 - def addRegexpToIgnore(self, 42 expr):
43 """Add to the ignore-facility of the current VCS 44 @param expr: a regular expression""" 45 46 notImplemented(self,"addRegexpToIgnore")
47
48 - def addGlobToIgnore(self, 49 expr):
50 """Add to the ignore-facility of the current VCS 51 @param expr: a glob expression""" 52 53 notImplemented(self,"addGlobToIgnore")
54
55 - def addStandardIgnores(self):
56 """Add the usual ignores""" 57 self.addGlobToIgnore("*.gz") 58 self.addRegexpToIgnore(".*\\.logfile")
59
60 -def getVCS(vcs, 61 path, 62 init=False):
63 """Factory to create a proper VCS-interface 64 @param vcs: name of the VCS-implementation 65 @param path: path which is under version control 66 @param init: whether the Version-control should be initialized here""" 67 68 table = { "hg" : "HgInterface" } 69 70 if vcs not in table: 71 error("Unknown VCS",vcs,". Known are",table.keys()) 72 73 modName=table[vcs] 74 75 exec "from "+modName+" import "+modName 76 77 return eval(modName+"(path,init)")
78