14

I make some changes to a file but realize that I need to modify it in other way - this requires me to temporary save my current changes elsewhere and apply it later. How can I do this in svn/subversion tool, e.g. TortoiseSVN?

The feature I'm mentioning is very similar to making shelveset and unshelving it in TFS.

Please help if you know how to. Thank you!

4 Answers 4

17

AntonyW's answer works, but it might be overkill, especially if you've got a lot of code !

I'm not familiar with TFS' shelveset but svn gives you the svn diff command to do just what you're looking for: making a diff and saving it so you can apply it later. Just take svn diff's output and save it in a .patch or .diff file.

svn diff myfile > myfile.patch

Since you're using TortoiseSVN, this is even easier to do.

4

You can also create branch with your changes. It could be even better than storing diff on disk.


Edit: So you have different kind of changes in working copy? Files that you want to keep and files that you want to save to diff? In this case maybe creating patch from TortoiseSVN is better.

But if you want to put in patch all changes from working copy it is better in my opinion to create branch. This is really easy in Tortoise:

  1. Create Branch/Tag and mark Working Copy as source of branch (do not check to switch to new branch).
  2. After Tortoise creates branch revert all local changes
  3. Make your another changes
  4. Commit to trunk
  5. Switch to branch and merge changes from trunk
  6. Reintegrate branch to trunk

For shure it works for me most of the time, patches are good for code review, not for creating local toolset of not finished changes ;)

1
  • Creating a branch for a diff/shelveset? I don't support this way. Thank you anyway Krzychkula.
    – Nam G VU
    Jun 18, 2011 at 19:12
1

Regarding the above answers that are given, I (personally) disagree with them (bulk etc...). As for me (and I am using it as well), this is one of the good features that currently is supported only by team foundation and can be used across a network. This helps a lot in the following situation:

  1. First and most prominent is that you can have a review from another person without having a checked in (and incomplete) code in main source code.
  2. In case you have multiple solutions, you can have multiple shelvesets that you can test in your application.
  3. If another person requires a certain shelveset of yours for partial testing purposes prior to his check in, it's available.

I searched for this feature and found that most of the other products (SVN, mercurial) are going to introduce this feature in the future, but it's not available yet.

...it's always better to ask for forgiveness rather than permission....

0

I usually do a checkout to a new location, make the changes there then commit.

Later, I do an update on the original location to merge the changes into my previously modified version.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.