Package moap :: Package vcs :: Module git_svn
[hide private]
[frames] | no frames]

Source Code for Module moap.vcs.git_svn

 1  # -*- Mode: Python; test-case-name: moap.test.test_vcs_git_svn -*- 
 2  # vi:si:et:sw=4:sts=4:ts=4 
 3   
 4  """ 
 5  git-svn functionality. 
 6  """ 
 7   
 8  import os 
 9  import commands 
10  import re 
11   
12  from moap.util import util, log 
13  from moap.vcs import vcs, git 
14   
15 -def detect(path):
16 """ 17 Detect if the given source tree is using git-svn. 18 19 @return: True if the given path looks like a git-svn tree. 20 """ 21 while path and path != '/': 22 if (os.path.exists(os.path.join(path, '.git')) 23 and os.path.exists(os.path.join(path, '.git', 'description')) 24 and os.path.exists(os.path.join(path, '.git', 'svn'))): 25 return True 26 path = os.path.dirname(path) 27 return False
28
29 -class GitSvn(git.Git):
30 name = 'git-svn' 31
32 - def getUnknown(self, path):
33 return git.Git.getUnknown(self, path)
34
35 - def update(self, path):
36 oldPath = os.getcwd() 37 os.chdir(self.path) 38 39 status, output = commands.getstatusoutput("git svn fetch") 40 if status != 0: 41 raise vcs.VCSException(output) 42 43 status, output = commands.getstatusoutput("git merge remotes/git-svn") 44 if status != 0: 45 raise vcs.VCSException(output) 46 47 status, output = commands.getstatusoutput("git svn show-ignore >> .git/info/exclude") 48 if status != 0: 49 raise vcs.VCSException(output) 50 51 os.chdir(oldPath) 52 return output
53 54 VCSClass = GitSvn 55