SVN:ignore how-to and on what?

2019-06-17 05:15发布

问题:

It seems to me that adding the property svn:ignore on files like .classpath would be a good idea. I use both Windows (work, ugh) and Linux development environments and every time I sync with the repository it overwrites my .classpath from whichever machine I'm working on.

I tried right-clicking the .classpath file in the Team Sync perspective, but the svn:ignore option is greyed out.

Any ideas how I might: 1. get this item out of source control, 2. add it to an ignore list?

Any other files a smart addition to this list?

回答1:

At the command line:

svn rm --keep-local .classpath
svn pe svn:ignore .

The first command removes .classpath from SVN while keeping the file locally. The second command lets you edit svn:ignore. Add ".classpath" to the property.

The general rule is that any build output, machine-specific, or user-specific files should not be versioned and then be added to svn:ignore. I'm not familiar with Java or Eclipse specifically so I couldn't mention any files by name.



回答2:

To get svn:ignore, remember that svn:ignore is a property of a file system entry. That means you need to use svn propedit svn:ignore (to edit the property).

What should you ignore? Anything that's built from something else. All "lock files" that editors might put in place. All temporary files. Some configuration files that require differences between developer (however, you should check in a template with a slightly modified name, like config.template). Basically, anything that you don't want checked in.

It sounds like you are using a non-command line client. Maybe the client is configured to not allow you to modify this file (or it's properties). Maybe it's a different issue. I would recommend installing a command line client, as the errors will be more verbose (and not subject to interpretation like your "grey" color is).

Odds are good you will have to svn:delete the file first (make a copy of it or you'll lose your only copy), and commit the "deletion" back to the repository. Then propedit the directory where the .classpath file was to add ".classpath" to the svn:ignore list.