Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
717 views
in Technique[技术] by (71.8m points)

svn ignore a file but include it in checkout

I have a project in a repository. People will soon start checking it out, working on it, then committing their changes back. But there is one file within that project (an elaborate configuration file of my own design) that everyone simply must have a copy of, but they will make changes to it that should never ever be checked back in (that is never should they be sent via update back to the repository).

So, I want each user who checks out the project to receive this config file, but then I want it ignored on all commits.

What I've read so far makes me feel this is not going to be possible. It seems that once I've imported the project with this config file it is under version control and there is no way anymore to ignore it other than removing it.

I hope I just misunderstood and the solution is an easy one.

Can anyone help?

Oh, I need a command line solution please if possible. A lot of the work is done on headless linux boxes with ssh-only connections.

Thanks!

EDIT: I went with cdhowie's answer. In addition to creating a template config file (for example app.config.template) as he suggests, I also use the "svn propedit svn:ignore" to have the real config file name (for example app.config) ignored on commits.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Usually the way you do this is by providing a template file that the user or a script will copy to where it belongs. That file will then be ignored.

For example, say you have app.config as the config file. You would commit yours as app.config.template or something similar. Users would have to copy and rename the file to begin development. app.config would be ignored in SVN.

This doesn't work cleanly for updates, but it's about the best you can get. Another option would be to set access restrictions in the repository so that app.config cannot be changed by anyone else.

EDIT: I said that this doesn't work cleanly for updates, but on second thought, if the developers are changing this file a lot anyway, they probably don't want updates from you clobbering their own settings. Using a template file will actually be easier on your developers, since they can pick which changes to merge in themselves.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...