16

I have an svn server that I checkout the repository in my computer.

The main repositiry has about 2k files

  • 3rd party
  • generic code classes
  • custom classes

I have made changes to lots of files (mainly php) and I want to make sure they are all valid before I commit.

svn commit -m "i fix the bug #293"

How can I check all the files at once to make sure they are valid and no php errors so I dont have to manually check all these files.

2
  • 3
    Do you mean you modified the code without being able to run it on your developer machine? Bad practice.... Nov 21, 2011 at 13:48
  • 7
    Run your Unit Tests before commiting.
    – Gordon
    Nov 21, 2011 at 13:48

1 Answer 1

27
+100

This bash oneliner will the modified php files and filter the ones that have no syntax errors:

for i in $(svn status | grep -v ^? | grep php | awk '{print $2}') ; do php -l $i ; done | grep 'Parse error'
1
  • 2
    for i in $(svn status|grep -v ^?|grep php|awk '{print $2}') ; do php -l $i ; done | grep 'Parse error'
    – jmz
    Nov 21, 2011 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.