Manu
Manu

Reputation: 4500

Add every new file to svn, except those that are ignored

I'm new to subversion. I've created a repository, and I want to make the first commit.

There are some files and folders that should not be checked in, such as cache/ or log/. I've used svn propset svn:ignore -F svn_ignore.txt.

I want to have a simple way to add new files to svn. Is there a way to do this while respecting the svn:ignore setting ? The following commands add every file, even the ignored ones :

svn add --force .

alias svn_add_all='svn st|grep ^?|sed s/?//|xargs svn add $1'

EDIT Here's what I get :

$ svn status
?       web/images/test/film_super8.jpg
?       web/images/test/ea_dl_manager.jpg
?       web/images/test/minecraft_anaglyph.png
$ svn propget svn:ignore
cache/*
log/*
web/images/blog/*
web/images/test/*

Upvotes: 4

Views: 1702

Answers (2)

Julien N
Julien N

Reputation: 3920

The patterns are strictly for that directory—they do not carry recursively into subdirectories.

See SVN documentation

So you must apply your patterns on all the directories, or only on the directories where that ignore is necessary.

So the pattern shouldn't include directories like you do. web/images/blog/* won't work. You should go to the blog folder and set svn:ignore to *

Some clients have a "Apply recursively" feature that does that for you. I don't know if you can do that with the "default" client.
But in your case, it would be useless. It may be used when a specific file or pattern must be ignored everywhere (like *.suo files for Visual Studio projects)

Upvotes: 3

VonC
VonC

Reputation: 1329902

svn status should not display an ignored file.
But the issue might be in the way you do ignore a file: see "Command Line svn:ignore a file"

You don’t svn:ignore a file.

You put an svn:ignore property on the directory to ignore that filename pattern!

# Add just the single file to the current directories ignore list (like above)
# Note the dot at the end of the command is important
svn propset svn:ignore secret.txt .

# See that things worked
svn propget svn:ignore .    # Notice the single file was added to the list
svn status --no-ignore      # You should see an 'I' next to the ignored files

Upvotes: 2

Related Questions