M
Matt Mitchell
Hi,
I wrote a python script that uses pysvn to export projects from an svn
repo I have. The repo has hundreds of projects in it with a directory
structure that is pretty uniform however it's not exactly uniform
because of the capitalization. I.e.:
\root
\project English
\Stuff
\Stuff 2
\Project Spanish
\Stuff 3
\Stuff 4
My svn repo is case sensitive so if I try to get \root\project
Spanish\Stuff 3 I get an error. Fixing the capitalization is not an
option for me. My initial idea was to make a list of all the different
ways "project" has been capitalized in my repo and try each one. The
code looks like this:
import pysvn
def getstuff(stuffiwant, languageiwantitin):
projects = ("project %s/", "Project %s/", "pRojects %s/")
c = pysvn.Client()
for p in projects:
exportme = p % languageiwantitin
exportme = "http://localhost/" + exportme + stuffiwant
try:
c.export(exportme, "C:\\temp\\")
break
except pysvn.ClientError:
print "Not the right capitalization."
# do the rest of the stuff I need to do.
This works, but to me it seems like there has to be a better way of
doing it. Any feedback or suggestions would be appreciated.
Thanks,
Matt
I wrote a python script that uses pysvn to export projects from an svn
repo I have. The repo has hundreds of projects in it with a directory
structure that is pretty uniform however it's not exactly uniform
because of the capitalization. I.e.:
\root
\project English
\Stuff
\Stuff 2
\Project Spanish
\Stuff 3
\Stuff 4
My svn repo is case sensitive so if I try to get \root\project
Spanish\Stuff 3 I get an error. Fixing the capitalization is not an
option for me. My initial idea was to make a list of all the different
ways "project" has been capitalized in my repo and try each one. The
code looks like this:
import pysvn
def getstuff(stuffiwant, languageiwantitin):
projects = ("project %s/", "Project %s/", "pRojects %s/")
c = pysvn.Client()
for p in projects:
exportme = p % languageiwantitin
exportme = "http://localhost/" + exportme + stuffiwant
try:
c.export(exportme, "C:\\temp\\")
break
except pysvn.ClientError:
print "Not the right capitalization."
# do the rest of the stuff I need to do.
This works, but to me it seems like there has to be a better way of
doing it. Any feedback or suggestions would be appreciated.
Thanks,
Matt