SVN ignore all sub-folders with a specified name
Asked Answered
S

2

10

I would like to ignore a specific named sub-folder from all current and future folders created going 1 level deep.

I have a folder that holds all of the templates I am using to generate files. This folder is itself a collection of folders with the actual templates in them. Something like the following

  • Templates
    • Create
      • magic.template
      • unicorn.template
    • Update
      • fairy.template
      • dust.template
    • ...

My build process iterates through all of the folders and converts the templates into actual files. These get placed into a sub-folder called GeneratedTemp. This results in the following structure.

  • Templates
    • Create
      • magic.template
      • unicorn.template
      • GeneratedTemp
        • magic.actual
        • unicorn.actual
    • Update
      • fairy.template
      • dust.template
      • GeneratedTemp
        • fairy.actual
        • dust.actual
    • ...

What I would like to do is ignore all sub-folders of Templates\XXX that are named GeneratedTemp. Is this possible? And how?

Sample answered 2/3, 2011 at 21:10 Comment(1)
Which SVN client are you using?Scupper
M
8

You can add svn property for folders containing GeneratedTemp. Change directory to /Templates and execute:

svn propset svn:ignore --depth=immediates GeneratedTemp .
svn ci "ignore */GeneratedTemp"

This will set svn:ignore property for all folders in /Templates folder. Note that it will clear all previous svn:ignore properties set for these folders if any (in this case you should use svn propedit).

Material answered 2/3, 2011 at 22:24 Comment(4)
This looks like the solution that I need. I'm trying to figure out how I can modify the properties file to include the depth parameter. As far as I can tell TortoiseSVN does not have a command line tool to add these properties.Sample
Right, in TortoiseSVN you'll need to do this all manually. I'd suggest install command line svn (SilkSvn) because usually it has more options and more flexible.Material
Can you help me to find out how to do same thing? What to download or which menus to follow to get folders ignored? And where to install (if SilkSvn really needed) and click?Fao
You can download command line subversion client which I use on Win: SlikSvn here: sliksvn.com/en/download . If TortoiseSVN is installed - right click on the file to ignore in the WC (files have special TortoiseSVN -specific icons), then TortoiseSVN menu -> Ignore By Extension or Ignore by Full nameMaterial
C
-10

It's never a good idea to have un-versioned files or folders inside folders that are versioned. Instead, try to find a directory structure where all generated files are placed somewhere outside the source tree.

Confederation answered 2/3, 2011 at 22:42 Comment(3)
I disagree; it's quite acceptable to do so; just add them to the ignore list; that's the purpose of it. That's not to say I disagree with your proposed strategy in general; I think it's probably acceptable in some environments; but it's not a requirement.Scupper
Agree @Noon Silk. Ignoring some working folders/files is common practice.Material
Oh, maybe "never" is a too strong word. However, if possible, it's better to have one, or a few, ignored directories containing logs and generated files, rather than spreading them across the versioned file tree.Confederation

© 2022 - 2024 — McMap. All rights reserved.