views:

1789

answers:

8

As I understand it, the command to ignore the content of a directory using SVN is this:

svn propset svn:ignore "*" tmp/

This should set the ignore property on the content of the tmp directory, right? In other words, the wildcard is set to be the ignore value on the tmp directory. Trouble is, here's what is happening on my Windows box:

> svn propset svn:ignore "*" ./tmp
property 'svn:ignore' set on 'app'
property 'svn:ignore' set on 'config'
property 'svn:ignore' set on 'db'
property 'svn:ignore' set on 'doc'
property 'svn:ignore' set on 'lib'
property 'svn:ignore' set on 'log'
property 'svn:ignore' set on 'nbproject'
property 'svn:ignore' set on 'public'
[etc...]

That's not right. Am I doing something wrong (or perhaps going insane), or is my svn on Windows broken?

Some notes:

> svn --version
svn, version 1.5.2 (r32768)
compiled Aug 28 2008, 19:05:34


Update: I've have just tried this on a Windows XP machine and it works as expected. So either this is a Vista specific issue, or there is a problem with my Vista configuration. Is anyone else able to reproduce this problem on Vista? I have just spotted that Vista isn't listed as one of the supported platforms on the CollabNet downloads page.

A: 

Try it without the trailing slash. Also, the tmp directory itself has to be added to the repository.

MattW.
tmp directory is definitely added to the repo. Removing the trailing slash doesn't make any difference.
Charles Roper
+4  A: 

The command should be working as you expect.

The "*" is getting globbed, which it shouldn't be doing. So, you're running: svn propset svn:ignore [value] app config db doc lib log nbproject public ... tmp (since app was the first folder affected, I'm guessing there's another folder before it).

2 things you can try:

  1. Specify a list file: svn propset svn:ignore tmp -F .svnignore
  2. Just specify the path: svn propset svn:ignore tmp. This should open your default text editor (if configured) to allow you to write and save the list.


Reply to comment

Since you're now attempting to correct the setting, propedit and propdel would work fine -- especially if you have other changes within the directory.

But, if you don't have any other changes to worry about (check svn st), it'll be faster using svn revert -R and svn propset.

Jonathan Lonowski
For your point #2, shouldn't that be propedit, not propset?
Charles Roper
I've accepted this answer. Jonathan gives a clear explanation of what is going wrong (in part - see my own answer for the full explanation) and offers two solutions.
Charles Roper
Thanks Jonathan. Yes, I did LOTS of reverts while trying to troubleshoot this problem. :) Note that you've still got some typos in the first part of your reply.
Charles Roper
+3  A: 

This doesn't answer your svn question, but why are you trying to ignore all the contents of a directory? It seems to me that if you want a temporary directory at some point in the build, you should make the directory as part of the build instead of it being there from the repo.

Are you trying to ignore it because it's already there and you can't delete it?

Anyway, from my unix command line, this worked for me to ignore untracked file in a diretory called tmp

$ svn --version
svn, version 1.5.1 (r32289)
   compiled Aug 28 2008, 10:00:12

$  svn propset svn:ignore '*' tmp

Is Windows horking your quoting?

brian d foy
Yeah, that's a good point. I might well remove it from the repo at some point. It's a Rails app and it gets generated as standard when you create the app (some sub-dirs also get created in there).
Charles Roper
+3  A: 

It sounds to me like the svn.exe binary compiled for windows is doing built-in globbing, which is something that it wouldn't normally do on a unix build because the unix shell is expected to do globbing while constructing the command line. I would consider that unexpected behaviour, especially since you can't seem to work around the globbing.

As others have pointed out, you can supply the * using the -F option or interactively in a text editor.

However, I think you may not be going about this in the easiest way. For ignoring an entire subdirectory, I would do something like this:

svn propset svn:ignore tmp .

This sets the svn:ignore property on . (the current directory, the parent of tmp/) that tells it to ignore the tmp subdirectory and everything underneath it.

Greg Hewgill
+2  A: 

Which version of subversion are you using?

I tried 1.5.2 on Windows, and it only changed the property on the tmp directory:

[C:\Temp\temp] :svn propset svn:ignore "*" tmp/
property 'svn:ignore' set on 'tmp'

and:

[C:\Temp\temp] :svn proplist *
svn: Skipping argument: '.svn' ends in a reserved name
Properties on 'tmp':
  svn:ignore
Lasse V. Karlsen
See the original question for my svn version. Are you on the same version?
Charles Roper
Also, what version of Windows are you on?
Charles Roper
+4  A: 

It looks like Microsoft, in their infinite wisdom, have changed the behavior of wildcard expansion in Windows Vista:

So instead of an escaped wildcard being passed in, it gets expanded:

Under Win 95, 98, 2000, XP, the application runs as expected: it does wildcard expansion when parameters are like «*.txt» and it does NOT when parameters are like «"*.txt"». Under Windows Vista, wildcard expansion takes place always, or, said otherwise, double quotation marks DOES NOT suppress it.

There is further discussion on this issue on the Collabnet forum.

Charles Roper
A: 

It's reasonable to use a GUI SVN client (unless you're a masochist!). If you're on Windows TortoiseSVN should be you first port of call. Right click on the file you want to ignore then click "TortoiseSVN -> Properties". In the properties dialog you can ignore the entire directory by clicking on the drop down arrow for "Name" and selecting "svn:ignore". Then in the values box just type "*" for all. This is all without the quotes of course.

A: 

For a one-liner to use in shell scripts using the "-F" alternative, simply try this:

echo "*" > .svnignore && svn propset svn:ignore <path> -F .svnignore && rm .svnignore
Alexander Klimetschek