svn:ignore property during import
Asked Answered
M

2

11

How do I apply an svn:ignore glob recursively while doing an import?

Meganmeganthropus answered 10/4, 2009 at 6:12 Comment(0)
L
9

I'm not sure what you mean by "applying svn:ignore recursively while importing".

If you want to exclude a set of files from being imported you can set the global-ignores property in ~/.subversion/config before importing. There's no command line option to do that on-the-fly.

Alternatively you may add the directory and delete the unwanted files before committing:

$ svn co --non-recursive <repository_url> repo_root
$ cp -R <project_to_import> repo_root
$ cd repo_root
$ svn add *
$ find . -regex ".*\.\(bak\|obj\)" | xargs svn --force del
$ svn ci

Although laborious I prefer the latter approach because I'm not a big fan of svn import (the svn del part is not common for me and I like to review the file list before committing).

Otherwise, if what you want is to set the svn:ignore property of every directory in the hierarchy before importing you must use the second method and do a svn propset (instead of svn del) before comitting:

$ svn propset -R -F ignore.txt svn:ignore .

(You may actually do a svn import followed by a svn propset, but not in a single commit.)

Laboy answered 10/4, 2009 at 14:22 Comment(0)
H
16

You can't do that with a regular import; you need an in-place import.

Hanford answered 10/4, 2009 at 14:54 Comment(1)
Thx for pointing me to in-place import. This solution is better than Romulo's suggestion.Herzen
L
9

I'm not sure what you mean by "applying svn:ignore recursively while importing".

If you want to exclude a set of files from being imported you can set the global-ignores property in ~/.subversion/config before importing. There's no command line option to do that on-the-fly.

Alternatively you may add the directory and delete the unwanted files before committing:

$ svn co --non-recursive <repository_url> repo_root
$ cp -R <project_to_import> repo_root
$ cd repo_root
$ svn add *
$ find . -regex ".*\.\(bak\|obj\)" | xargs svn --force del
$ svn ci

Although laborious I prefer the latter approach because I'm not a big fan of svn import (the svn del part is not common for me and I like to review the file list before committing).

Otherwise, if what you want is to set the svn:ignore property of every directory in the hierarchy before importing you must use the second method and do a svn propset (instead of svn del) before comitting:

$ svn propset -R -F ignore.txt svn:ignore .

(You may actually do a svn import followed by a svn propset, but not in a single commit.)

Laboy answered 10/4, 2009 at 14:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.