26

There is a known issue with SVN repositories and the windows indexing service fighting over .svn metadata files. Here for more details.

How can we set it up so there are automatically no problems having subversion repositories indexed by windows (Vista/Win7). (We don't want to have to manually do something every time we add repo directory.)

One idea is to setup Windows to automatically not index folders named ".svn", however I can not find a way to do this.

I know you can disable certain extensions, but that doesn't seem to work since the svn metadata files are in a folder.

Note: The

6 Answers6

11

I was having the same problem and found a solution. All my code is stored under a single folder:

F:\projects\

Under that folder are trees of code and related project files that total over 2GB. I constantly need to search this tree and windows Indexing has actually been an extremely useful tool for doing fast searches, so turning it off was not an option. I want to exclude the SVN folders because they clutter up my search results, (2) unnecessary drag on my system, (3) SVN, Win7, and MS Security Essentials seem to not work nicely when doing large SVN operations.

Before you try the solution, reproduce the problem:

  1. In Windows Explorer, navigate to your indexed project root (F:\projects\ on my machine).
  2. Using the Search bar in the upper-right corner of the Explorer window, search for "svn" (w/o quotes)
  3. You should see a trillion useless SVN files & folders like ".svn", and "svn-base" showing up in the results.

Solution:

  1. Visit http://code.msdn.microsoft.com/windowssearch/
  2. Download CrawlScopeCommandLine.zip
  3. Extract to some place on your machine, and compile the project
  4. Open a Console window with administrative rights (Ctrl+Shift+Left-click on the "Command Prompt" item in the Start menu).
  5. Navigate to wherever you compiled the above project to.
  6. Execute the csmcmd.exe with the /add_rule param (use /? first for syntax).
  7. In my case I entered the following command: csmcmd.exe /add_rule file:///F:\projects\*\.svn\* /USER /EXCLUDE

I figured this out by first running the command: csmcmd.exe /enumerate_rules, to list all the existing ones. There were already some rules with asterix (*) wildcard's being used by Windows, so it was proof this was possible.

Now repeat the steps to reproduce the issue, and you should no longer see the SVN clutter in your search results. Give the computer sometime to update the indexes -- this took less than 5 minutes on my system. Sometimes restarting the Search service, kicking off a rebuild/reindex, or a reboot help move things along.

Update: Some of my SVN projects use ".svn", and some use "_svn", so I've added these two rules to every drive:

csmcmd.exe /add_rule file:///F:\*\.svn\* /DEFAULT /EXCLUDE csmcmd.exe /add_rule file:///F:\*\_svn\* /DEFAULT /EXCLUDE

5

AFAIK, Windows Indexing service on Windows 7 only looks within the Users folder as default (correct me if I am wrong). If you have your SVN repositories within your personal folder, you can:

a) Putting your SVN repositories elsewhere

b) By excluding those folders from the index. Here you will find how to exclude a folder.

4

The obvious fix would be to change Subversion to set this "don't index" flag whenever it creates a .svn directory. The problem is that this feature will be no longer needed when it's introduced.

The known problem will most likely go away in the Subversion versions that's currently being developed (version 1.7). There will be far less file operations inside the .svn directory, and also just 1 .svn directory per working copy.

This makes it less likely that the problem will occur, and also makes it far easier to disable indexing, because there's just a single .svn folder.

2

Brute force method

  1. do a search for all .svn directory
  2. select all (ctrl+a)
  3. right mouse click properties
  4. click "advance..."
  5. uncheck the "Index this folder for faster searching"
  6. apply the change

WDS Group Policy has an option for Prevent Indexing Certain Paths, but it isn't listed available for Windows Vista according to the feature chart.

Supported on: Windows XP, Windows Server 2003 with Windows Search 3.01, or any version of Microsoft Windows with Windows Search 4.0 or later.

Darren Hall
  • 8,001
1

If Darren Halls answer is the "Brute Force" approach, then my answer has to be the "Brute Force and Ignorance" approach. :)

This is something that has recently annoyed me as we use SVN for document and project management which can mean the Windows indexer is very useful when it comes to being able to search for obscure documents, but it catching all the svn storage files is just useless.

This is my (rather ugly) solution in a windows batch file:

 ATTRIB /S /D -H ".svn"

 ATTRIB /S /D +I ".svn"
 ATTRIB /S /D +I "all-wcprops"
 ATTRIB /S /D +I "entries"
 ATTRIB /S /D +I "tmp"
 ATTRIB /S /D +I "props"
 ATTRIB /S /D +I "text-base"
 ATTRIB /S /D +I "prop-base"
 ATTRIB /S /D +I "*.svn-base"

 ATTRIB /S /D +H ".svn"

The first and last lines are there because ATTRIB refuses to apply the +I switch to a hidden folder, at least it did for me. You'll need to copy this to a file like "svnNoIndex.bat" and run it in your SVN checkout directory, with a large repository it could take some time...

I'm currently testing this under Vista with the latest service pack, I would expect it to work on Windows 7. I don't know if the index needs to be rebuilt to take account of the files which are now marked as not indexed by doing this, but I need to rebuild mine anyway so that's what I'm doing as it's only a few days while the index rebuilds.

In order to make this "automatic" you could add the batch file as a post-update hook that gets run after an update... granted it is messy, but it might work.

Mokubai
  • 95,412
1

You can essentially tell Windows Search to ignore .svn folders by tweaking the registry.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\CrawlScopeManager\Windows\SystemIndex\DefaultRules\11]
"URL"="file:///*\\.svn\\*"
"Include"=dword:00000000
"Suppress"=dword:00000000
"Default"=dword:00000001
"Policy"=dword:00000000

The URL matches folders named ".svn" anywhere on your filesystem. (The number after default rules should be unique - i.e. if you already have a default rule 11, choose another number).

Grynn
  • 376