I'm trying to write a program that will list all subversion repository
directories, then issue a command using each directory as an argument, then
parse those results. So far, I'm able to get a list of the directories...and
that's it!
Here's what I've got so far:
=========================================
#!/usr/bin/env python
 
import commands as c
 
lsout = c.getoutput('ls -d /home/svn/repository/*/').split('\n')
results = file("results.txt", "w")
for row in lsout:
  results.write(c.getoutput('svnadmin lslocks ' + eval(row)))
=========================================
lsout is a list of repository directories, like I wanted.
(['/home/svn/repository/projecta/', '/home/svn/repository/projectb/',
'/home/svn/repository/projectc/']
The next 3 lines are probably totally wrong. I want to perform the following
bash command for each directory...
==================================
svnadmin lslocks /home/svn/repository/projecta
==================================
...and then parse the results. I just don't know where/how to store the
results from each svnadmin command. When I run the program in its current
form, I get the following error:
===========================================
Traceback (most recent call last):
  File "checklocks.py", line 8, in ?
    results.write(c.getoutput('svnadmin lslocks ' + eval(row)))
  File "<string>", line 1
    /home/svn/repository/projecta/
    ^
SyntaxError: invalid syntax
===========================================
 
Any advice would be much appreciated. Thanks!
 
-Justin Cardinal
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to