Is there some way to commit a file "partially" in TortoiseSVN?

I'd like to commit just a part of a file using TortoiseSVN, is there some way to do that?

I'll give an example to make it clearer why I want to do that.

I have a file with some defines that are replaced in the build process, something like this:

#define SOME_PATH "[SOME_PATH]"

This [SOME_PATH] tag is replaced in the build process but when I'm coding I have to change it so the actual path in my machine.

So each time I commit I need to backup some lines, revert them, commit and then restore the backup, and this is kinda annoying.

Is there some way to tell TortoiseSVN to "ignore" some changes in, say, Lines X,Y and Z?


Solution 1:

The top voted answer is out-of-date.

From the tortoiseSVN website: http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-commit.html

Commit only parts of files

Sometimes you want to only commit parts of the changes you made to a file. Such a situation usually happens when you're working on something but then an urgent fix needs to be committed, and that fix happens to be in the same file you're working on.

right click on the file and use Context Menu → Restore after commit. This will create a copy of the file as it is. Then you can edit the file, e.g. in TortoiseMerge and undo all the changes you don't want to commit. After saving those changes you can commit the file.

After the commit is done, the copy of the file is restored automatically, and you have the file with all your modifications that were not committed back.

Solution 2:

No. Subversion works at the file level.

Solution 3:

No.

The best way to do that is to check in some file like "build_paths.h.default", then on each build platform, copy it to build_paths.h, modify it to suit, then tell SVN to IGNORE build_paths.h. And finally #include "buiild_paths.h" within your program.