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

Source Code for Module PyFoam.Basics.SvkInterface

 1  #  ICE Revision: $Id$ 
 2  """A VCS-interface to Mercurial""" 
 3   
 4  from PyFoam.Error import warning,error,notImplemented 
 5   
 6  from .GeneralVCSInterface import GeneralVCSInterface 
 7   
 8  from os import path as opath 
 9  import subprocess 
10  import os 
11   
12 -class SvkInterface(GeneralVCSInterface):
13 """\ 14 The interface class to svk 15 16 Only a partial implementation (As much as the BuildHelper needs)""" 17
18 - def __init__(self, 19 path, 20 init=False):
21 22 GeneralVCSInterface.__init__(self,path,init) 23 if init: 24 notImplemented(self,"__init__ (creation of a repository)")
25
26 - def getInfo(self,info):
27 output=self.doInPath(self.executeWithOuput,"svk info") 28 for l in output.split("\n"): 29 if l.find(info)==0: 30 return l[len(info)+2:] 31 32 return "nix"
33
34 - def getRevision(self):
35 return self.getInfo("Revision")
36
37 - def branchName(self):
38 # svk does not have branch names 39 return self.getInfo("Depot Path")
40
41 - def update(self, 42 timeout=None):
43 ok=self.doInPath(subprocess.call,["svk","pull"]) 44 return ok==0
45 46 # Should work with Python3 and Python2 47