Created
May 24, 2013 09:48
-
-
Save cnsoft/5642477 to your computer and use it in GitHub Desktop.
export rev files only.. used to create hot fix..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#svn log -v -r 20146:20150 svn://192.168.1.230/tjspaces | |
#Author cnsoft 2011-09 | |
svncmd = "svn log -v -r %d:%d %s" | |
#Test | |
svnurl = "svn://192.168.1.230/tjspaces/" | |
# | |
outputpath = "d:\\packagetools" | |
svnbin = "svn" | |
import os | |
def getChangeFileList(r1,r2): | |
_cmdstr = svncmd%(r1,r2,svnurl) | |
changelist = os.popen(_cmdstr).readlines() | |
fullchangelist = [] | |
foundchangepath = False | |
for line in changelist: | |
print "Process >>",line | |
if line.find('Changed paths:')>=0: | |
foundchangepath = True | |
#print 'check paths',foundchangepath | |
continue | |
elif line =='\n': | |
foundchangepath = False | |
elif line.find('-----------------------------------')>=0: | |
foundchangepath = False | |
# | |
if foundchangepath: | |
#if not line.find('Changed paths:'): | |
tmplist = line.split(' ') | |
if len(tmplist) >=3: | |
#print 'got>>',tmplist | |
changetype = tmplist[3] | |
changefile = tmplist[4] | |
fullchangelist.append([changetype,changefile]) | |
print fullchangelist | |
return fullchangelist | |
def checkchangedfile(r2,ifile,outputdir=""): | |
#svn export -r 20150 svn://192.168.1.230/tjspaces/mysteam/res/spaces/XXX.chunk c:\xxx.chunk" | |
outputdir = outputdir.replace("\\/","//") | |
ifile = ifile.replace('\n','') | |
path1 = svnurl + ifile | |
filename = ifile[ifile.rfind("/")+1:] | |
filepath = ifile[0:ifile.rfind("/")] | |
filepath.replace(svnurl,"") | |
#create folder first. | |
#export the file in changelist. | |
outputdir = outputdir+'/r'+str(r2)+"/" + filepath +"/" | |
outputfile = outputdir + filename | |
#Posix Only | |
if not os.path.exists(outputdir): | |
r = os.makedirs(outputdir) | |
if r: | |
print 'Folder created' | |
else: | |
print 'Folder created failed' | |
cmdstr = "svn export -r %d %s %s"%(r2,path1,outputfile) | |
#print 'Todo exec cmdstr' | |
r=os.system(cmdstr) | |
if r: | |
print 'Export ok' | |
else: | |
print 'Export error %s'%cmdstr | |
def test(): | |
global svnurl | |
svnurl = "svn://192.168.1.12/xx4/"#/steam_packCB1_111011/" | |
outputpath = "D:\\Development\\xx4\\steam_hot_fix\\hotfix_19712" | |
r2 = 19712 | |
r1 = 19711 | |
fulllist = getChangeFileList(r1,r2) | |
print 'end...',fulllist | |
for el in fulllist: | |
#checkchangedfile(r1,el[1],"d:\\packageTools") | |
if el[1].rfind('.') < 0:#if is folder ignore. | |
continue | |
checkchangedfile(r2,el[1],outputpath) | |
#break | |
#os.system("svn export -r 20149 svn://192.168.1.230/tjspaces//mysteam/res/spaces/000discovery/fffd0004o.chunk \ | |
# d:/packageTools/r20149/fffd0004o.chunk") | |
test() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment