Simple script to List the modified files or new files in local SVN Repository

In our office we use svn for project management. Almost everyone uses eclipse for working. In that case checking the modified files or new files become easy process with an in-built file browser with eclipse.

In my case, my desktop is very slow and working with big software like eclipse makes my system to hang. So I just begin liking to playing around in linux’s terminal these days.

Just for listing the Modified files or New files that I have created, I wrote a simple Script/Command: svn-rajiv-list


if [ $# -eq 0 ]; then
	echo "+----------------------HELP-----------------------+"
	echo "| Usage: svn-rajiv-list [option] [file-extension] |"
	echo "|                                                 |"
	echo "| Options:                                        |"
	echo "|   M  -  Modified files                          |"
	echo "|   ?  -  New files                               |"
	echo "+-------------------------------------------------+"
	if [ $# -eq 1 ]; then
		svn st | grep '^'$1' .*[.][phjc][yst][osm]*[nl]*$'
	if [ $# -eq 2 ]; then
		svn st | grep '^'$1' .*[.]'$2'$'

Usage :

Copy the above code and save it with filename “svn-rajiv-list” in your /bin/ directory

Give the execute permission to the file with sudo chmod a+x /bin/svn-rajiv-list

rajiv@rajiv-desktop:~/workspace/project$ svn-rajiv-list
| Usage: svn-rajiv-list [option] [file-extension] |
|                                                 |
| Options:                                        |
|   M  -  Modified files                          |
|   ?  -  New files                               |

The HELP page

rajiv@rajiv-desktop:~/workspace/project$ svn-rajiv-list M
M       project/
M       project/
M       project/
M       usermgmt/
M       usermgmt/
M       usermgmt/

Listing All Modified files (By default will list files with extensions .py .js .html .css .json)

rajiv@rajiv-desktop:~/workspace/project$ svn-rajiv-list ?
?       static/js/notify.js
?       static/js/user_notification.js
?       static/ui/css/jquery.addfriend.css
?       static/ui/css/modified-jquery.tagit.css
?       static/ui/js/add-friend.js
?       static/ui/js/modified-tag-it.js
?       usermgmt/
?       usermgmt/

Listing All New files

rajiv@rajiv-desktop:~/workspace/project$ svn-rajiv-list ? py
?       usermgmt/
?       usermgmt/

Listing the New files which are having py extension

~ Rajiv M


5 thoughts on “Simple script to List the modified files or new files in local SVN Repository

  1. But when $svn status gives you those details, why would you need to take pain in running this script ? :P
    anyways .. good initiative :) keep it up..
    BTW, use /usr/bin for custom scripts like this.

    1. Yeah!! Brother, But the actual syntax for Listing Only the File-names of the modified files is like this ↓

      $ svn status | grep ‘^M .*[.][phjc][yst][osm]*[nl]*$’

      I thought this command looks too messy and we cannot type this syntax every time in terminal…
      In those busy situation I believe this script will step in for helping us….

      1. No way brother, I’m not going to Give-up :P

        Ok lets take your first option $ svn st | grep “?”
        This command will display not only the New files but also the Modified files with “?” in its File-name or anywhere in its Path
        Similarly $ svn st | grep “A” or the command $ svn st | grep “M” will display all the files which are having the letter
        “A” or “M” in its File-name or anywhere in its Path
        And also your case will display the files like “.pyc” “.class” or something else that we doesn’t want in our list…

        Whilst coming to my script, you will get only the New files if you give “?” as option or the Modified files if your option is “M”
        And It will display “.html” “.py” “.json” “.css” and “.js” files only as default and you can add your own extension if you need
        Also you can specify the second argument with extension like “html”, then it will list only the html files alone for you…

Share your blooming thoughts here . . .

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s