Moin Moin,

first to my fans at NMMN: cooool ;-)

Ok - a little more serious. It’s kind of a hobby or philosophy to find the best editor for hacking. Have you found your’s yet? I know that all the MAC users mostly use TextMate. And a lot of Linux users like eclipse. After having tested and used eclipse for about two years (and three versions and three times fuckups with upgrading) I am using Netbeans these days. I installed the PHP and Python version which is running well.

One point that made me go crazy all the time is the SVN implementation in eclipse and Netbeans. Well, the developers of Netbeans integrated svn assistance in the standard version. But it’s working so la la. So I decided to use svn from the shell. Since I use git for some stuff, this is even more familiar to me (I know that there are git clients - but hey come on! that’s not cool ;-) ).

In each project there are always files or directories which you don’t want to have in your svn repo. So you want to use the svn:ignore command. Here is a brief introduction of it’s usage.

svn property commands

Basically you can use these property commands with svn:

propdel (pdel, pd)
propedit (pedit, pe)
propget (pget, pg)
proplist (plist, pl)
propset (pset, ps)

This is part of the output when you type

$ svn help

For ignoring a file or a directory you use basically pl (proplist), pg (propget) and ps (propset).

Using svn:ignore

Let’s say we are in the working directory of our project. Because we use Netbeans, there is a folder called “nbprojects” with project settings in it. We don’t want this folder to be added to the svn repo. Also, there is a file called “info” with some reminding stuff. This file is also not needed in the svn repo. So let’s start by ignoring the folder:

$ ll
insgesamt 4
-rw-r--r-- 1 duke duke    0 2009-05-28 12:24 info
drwxr-xr-x 3 duke duke 4096 2009-05-28 12:18 nbproject
$ svn ps svn:ignore nbproject .
Eigenschaft »svn:ignore« für ».« gesetzt

The command line means, that we use the program svn and its command ps (propset) with the option svn:ignore to set the property for this folder ( . at the end) with ignoring the folder nbproject. Let’s see if this is correct:

$ svn pl
Eigenschaften zu ».«:
  svn:ignore

Ok - that means, we have set a svn property for the folder . (the actual folder). Now let’s examine what exactly is ignored:

$ svn pg svn:ignore
nbproject

Yep - that means, the folder nbproject is ognored for commits - as expected.

adding more files or folders to the svn:ignore list

This is importnat now. If you want to add more folders or files to the svn:ignore list, you have to keep in mind, that each usage of svn ps svn:ignore will overwrite the list for this folder. So you have to add the allready ignored files / folders and the new one again to the list. The first approach will not bring the expected result:

$ svn ps svn:ignore info .
Eigenschaft »svn:ignore« für ».« gesetzt
$ svn pg svn:ignore
info --> nbproject is lost

The better way:

$ svn ps svn:ignore nbproject,info .
Eigenschaft »svn:ignore« für ».« gesetzt
$ svn pg svn:ignore
nbproject,info

And there is another way to avoid overwriting allready set propertys. Use the command

$svn propedit svn:ignore .

This will call your standard editor and is giving you the possibility to write down all the files or folders to be ignored in the actual choosen folder. I recommend to use this way ‘cause it’s the safest.

That’s it.

Deleting a property

Sure we need also a possibility to delete a property. Therfore we use pd (propdel). Here is the usage:

$ svn pd svn:ignore .
Eigenschaft »svn:ignore« wurde von ».« gelöscht.

That means we deleted the property svn:ignore form the folder . . Using svn pg svn:ignore will now return no result.

So have fun using svn!

Andreas

P.S.: the online svn book is here