SVN源码同步到CVS
时间:2010-07-16 来源:dixian
svn2cvs.py
#!/usr/bin/env python
import os, sys, cn.dixian.checkoutsvn as checkoutsvn, cn.dixian.checkoutcvs as checkoutcvs
tags = 'all'
if len(sys.argv) < 2:
tags = 'all'
else :
tags = sys.argv[1]
checkoutcvs.cocvs(tags)
checkoutsvn.cosvn(tags)
os.chdir('/var/opt/payCVS/')
#os.system('rsync -azvptCH --delete /var/opt/paySVN/* ./ > /var/opt/log.dat')
os.system('rsync -azvptCH /var/opt/paySVN/* ./ > /var/opt/log.dat')
checkoutcvs.commit(tags)
// ----------------------------------------------------------------------------------------------------
cn/dixian/checkoutsvn.py
#! /usr/bin/env python
#coding=utf-8
import os
def cosvn(tags):
os.chdir('/var/opt/paySVN')
if tags == 'paymanage':
os.system('rm -rf paymanage')
os.system('svn co --username dx --password dx1234 http://192.168.1.xxx:8000/svn/paymanage')
elif tags == 'payment':
os.system('rm -rf payment')
src = 'svn co --username dx --password dx1234 http://192.168.1.xxx:8000/svn/pay/aaaaa'
payCmd = '%s/payment payment/payment' % src
os.system(payCmd)
ejbCmd = '%s/paymentEJB payment/paymentEJB' % src
os.system(ejbCmd)
webCmd = '%s/paymentWeb payment/paymentWeb' % src
os.system(webCmd)
else :
os.system('rm -rf *')
os.system('svn co --username dx --password dx1234 http://192.168.1.xxx:8000/svn/paymanage')
src = 'svn co --username dx --password dx1234 http://192.168.1.xxx:8000/svn/pay/aaaaa'
payCmd = '%s/payment payment/payment' % src
os.system(payCmd)
ejbCmd = '%s/paymentEJB payment/paymentEJB' % src
os.system(ejbCmd)
webCmd = '%s/paymentWeb payment/paymentWeb' % src
os.system(webCmd)
// ----------------------------------------------------------------------------------------------------
cn/dixian/checkoutcvs.py
#! /usr/bin/env python
#coding=utf-8
import os, datetime
def cocvs(tags):
os.chdir('/var/opt/payCVS/')
if tags == 'paymanage':
os.system('rm -rf paymanage')
if not os.path.exists('/var/opt/payCVS/paymanage') : os.mkdir('/var/opt/payCVS/paymanage')
os.system('cvs -d :pserver:[email protected]:/SourceCode update -CPd paymanage')
elif tags == 'payment':
os.system('rm -rf payment')
if not os.path.exists('/var/opt/payCVS/payment') : os.mkdir('/var/opt/payCVS/payment')
os.system('cvs -d :pserver:[email protected]:/SourceCode update -CPd payment')
else:
os.system('rm -rf *')
if not os.path.exists('/var/opt/payCVS/paymanage') : os.mkdir('/var/opt/payCVS/paymanage')
if not os.path.exists('/var/opt/payCVS/payment') : os.mkdir('/var/opt/payCVS/payment')
os.system('cvs -d :pserver:[email protected]:/SourceCode update -CPd paymanage')
os.system('cvs -d :pserver:[email protected]:/SourceCode update -CPd payment')
def commit(tags):
os.chdir('/var/opt/payCVS/')
t = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
if tags == 'paymanage':
paymanageCmd = "cvs -d :pserver:[email protected]:/SourceCode commit -m '%s' paymanage" % t
os.system(paymanageCmd)
elif tags == 'payment':
paymentCmd = "cvs -d :pserver:[email protected]:/SourceCode commit -m '%s' payment" % t
os.system(paymentCmd)
else :
paymanageCmd = "cvs -d :pserver:[email protected]:/SourceCode commit -m '%s' paymanage" % t
os.system(paymanageCmd)
paymentCmd = "cvs -d :pserver:[email protected]:/SourceCode commit -m '%s' payment" % t
os.system(paymentCmd)