• Main Page
  • Namespaces
  • Classes
  • Files
  • File List

/home/mark/model/software/ScrumPy/ScrumPy/Util/SvnClient.py

00001 from  subprocess import Popen, PIPE  # replaces popen*()
00002                                      # see http://www.python.org/dev/peps/pep-0324/
00003 
00004 
00005 # svn bump 2
00006 Quote=lambda s: "'"+s+"'"
00007 
00008 SvnCmd = "/usr/bin/svn"
00009 UserFlag = "--username"
00010 MessageFlag = "-m"
00011 
00012 Cat = lambda l: " ".join(l)
00013 
00014 class SvnClient():
00015 
00016     def __init__(self, path, user=None):
00017         '''
00018         Pre: path = path to working copy
00019         '''
00020         
00021         self.path = path
00022         self.user = user
00023 
00024         self.out = ""
00025         self.err = ""
00026  
00027     def GetUserArg(self):
00028 
00029         rv = ""
00030         if self.user != None:
00031             rv = Cat[UserFlag,self.user]
00032         return rv
00033 
00034 
00035     def Exec(self, cmd, *cmdargs):
00036 
00037         cmd = [SvnCmd, cmd, self.path]
00038         cmd.extend(*cmdargs)
00039 
00040         print cmd
00041     
00042         p = Popen(cmd, stdout=PIPE, stderr=PIPE, close_fds=True)
00043         self.out = p.stdout.read()
00044         self.err = p.stderr.read()
00045 
00046     def Commit(self, message="no message"):
00047 
00048         args = [MessageFlag, message]
00049         self.Exec("commit",args)
00050 
00051 
00052     def Update(self):
00053 
00054         self.Exec("update")
00055 
00056         
00057    

Generated on Tue Sep 4 2012 15:38:02 for ScrumPy by  doxygen 1.7.1