Sunday, April 3, 2011

svn:ignore property during import

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

From stackoverflow
  • 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.)

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

0 comments:

Post a Comment