1
2
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
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
30 name = 'git-svn'
31
34
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