Child: [0f528b] (diff)

Download this file

svn.py    47 lines (36 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import logging
from pymongo import bson
from forgescm import model as M
from .command import Command
from . import hg
log = logging.getLogger(__name__)
class init(Command):
base='svnadmin create svn_repo'
class sync(Command):
base = 'svnsync'
class rebase(Command):
base='hg rebase --svn'
def cwd(self):
return Command.cwd(self) + '/hg_repo'
class scm_log(Command):
base='git svn log'
def cwd(self):
return Command.cwd(self) + '/git'
def svn_clone(remote):
'''Clone one svn repo using svnsync'''
# Create the svn repo
cmd = init()
cmd.clean_dir()
cmd.run_exc()
# Allow svnsync to change revprops
revprop_hook = os.path.join(
cmd.cwd(),
'svn_repo/hooks/pre-revprop-change')
# os.remove(revprop_hook)
os.symlink('/bin/true', revprop_hook)
# Use svnsync to clone svn=>svn
sync('init', 'file://%s/svn_repo' % cmd.cwd(), remote).run_exc()
sync('sync', 'file://%s/svn_repo' % cmd.cwd()).run_exc()
# Use hgsubversion to clone svn=>hg
hg.clone('file://%s/svn_repo' % cmd.cwd(), 'hg_repo').run_exc()