Oct 31 2005
svn add Recursively
Here is a little helpful hint if you ever wanted to add files to the svn repository recursively. I grabbed this from the TextDrive Community Forum
Add all new file to svn repository at once
svn status | grep "^?" | awk '{print $2}' | xargs svn add
You can add this to your .bash_profile as well:
svn_add_all(){
svn status | grep "^?" | awk '{print $2}' | xargs svn add
}
1 comment
Your use of grep and xargs replicates one of AWK's strengths as a pattern-action language. So you can save a few characters of typing and an extra process and pipe by doing it like this:
svn status | awk '/^\?/ {print $2}' | xargs svn add
But then you don't really need xargs either, you can further refine it:
svn status | awk '/^\?/ {f=f" "$2} END {system("svn add"f)}'
I believe that all of these commands suffer from the deficiency that they don't work properly on file names with spaces in them.
This post has 11 feedbacks awaiting moderation...
Leave a comment