Domanda

I have a repository with some files ending in .scc

There is one of these files in just about every subfolder of the repo and they are all committed.

I'm using:
TortoiseSVN 1.6.15, Build 21042 - 64 Bit
Subversion 1.6.16

With TortoiseSVN I can go into each folder and right-click on the file and select "Delete and add to ignore list" but that's a pain to do that in each and every folder. So I am basically looking for an easy way to recursively do exactly the same as TortoiseSVN's "Delete and add to ignore list". Either through TortoiseSVN or the command line.

È stato utile?

Soluzione

To add a file to the ignore list, you can update your %USERPROFILE%\local data\.subversion\config file. (I'm not 100% sure where it's located, but it should be under the .subversion directory somewhere under your %USERPROFILE% directory. Unix and Macs, it would be under $HOME/.subversion/config.

In that file, there's a global-ignores= parameter. You can remove the # in the front of it (if it's not already removed), and add .ssc to it. It's around like #90 in my version of this file.

Now, you'll have to figure out a way to delete all of these .scc files. All you have to do is this:

  $ find . -name `*.scc -exec svn del {} \;`

Wait, you're using Windows. That's harder. I don't have a Windows machine in front of me, but I know you can find all of thes *.scc files by doing this:

 C:> dir *.scc /s/b

You might be able to pipe this into a for loop of some sort, and pass it to a svn del statement. Even if I had a Windows machine, it can take me a while to work out the syntax. Since I don't have a Windows machine in front of me, it's even more difficult.

Easiest way would be to redirect the output to a file, and then edit the file using a good program editor (by which I mean not notepad.exe):

 C:> dir *.scc /s/b > delete_me.bat
 C:> notpadplusplus delete_me.bat

Now, you can use Notepad++ to edit your file and quickly prefix each line with a svn del. Run this delete_me.bat file, and it will remove all of your *.scc files. (I personally prefer Vim, but then I'm a masochist).

The big question is how to prevent adding these files back. Ignores set up as I showed you are client specific. You could setup a svn:ignore property in each directory. This is a more global version that affects everyone, but it still won't prevent someone from adding them because the files will still show up in Windows Explorer.

I have a pre-commit hook that can be setup, so no one will ever be able to add in these .scc files again. You could also set it up not to include the other types of files that VisualStudio puts in too.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top