Shelve in TortoiseSVN?
Asked Answered
S

8

59

I've moved from TFS to SVN (TortoiseSVN) with my current company. I really miss the "Shelve" feature of TFS. I've read various articles on how to "Shelve" with SVN, but I've read nothing that gives a very simple experience to "shelve" work.

Ideally, I'd like extra items added to the TortoiseSVN context menu - "Shelve" & "Unshelve". "Shelve" would remove the current shelve-set, and upload the working directory under a suitable path defined by user options. "Unshelve" would merge the set with the working copy.

Does something like this exist? Can anyone suggest any ways to "hack" this feature in the GUI?

Note: The following link doesn't really achieve the user experience I was looking for:

Shelving Subversion

One of the greatest things about TFS Shelve is how easy it is to use...

Stereotomy answered 12/8, 2008 at 5:25 Comment(0)
C
21

Shelving in SVN is starting to roll out with version 1.10, see Release Notes

Communicative answered 3/4, 2018 at 11:52 Comment(1)
Loosing local changes for Updating to latest is time waste. I dont know if Git also works same way. TFS is best in this caseLoraleeloralie
C
32

I don't believe that SVN has this feature built into the server product. I also don't believe anything like this emulated in any clients that I have used, including TortoiseSVN.

To get around this problem, I have resorted to using a DVCS such as Git or Mercurial, to allow me to branch/merge/shelve locally before pushing the content back to SVN. It's arguably a bit of a kludge, but it works really well.

Conroy answered 12/8, 2008 at 5:30 Comment(7)
I don't think it's a kludge L-) I've used a separate personal VCS for years when working with teams where we had strict control over checkins (and particularly with locking based VCS like SourceSafe).Recto
You're right, it's not a kludge. To be honest I don't know why I said it, probably a bit of a disclaimer to avoid being lambasted :) I'm very happy with using DVCS for local shelving before pushing to a standard CVCS.Conroy
See: How to use mercurial and svn together #4606168Pullulate
SVN Patch feature has pretty much the desired behavior as pointed in some answers below.Strawboard
Time-ignorant downvotes for the win! Stackoverflow really is a ghetto sometimes.Conroy
Outdated answers probably should be down-voted. That said, this answer provides a host of additional benefits, so +1 from me.Unruh
But how do you share code with other developers this way? One of the advantages of shelve-sets is that my colleague developer can put the code somewhere I can access for code review before he commits it.Jade
C
21

Shelving in SVN is starting to roll out with version 1.10, see Release Notes

Communicative answered 3/4, 2018 at 11:52 Comment(1)
Loosing local changes for Updating to latest is time waste. I dont know if Git also works same way. TFS is best in this caseLoraleeloralie
N
16

If you understand how SVN branches work, emulating Shelve in SVN is a no-brainer:

  1. Create a branch in the repository (on the server)
  2. Switch your local copy to it
  3. Commit your changes to the new branch
  4. Switch your local copy back to the trunk

When you are ready to get back to your shelved changes ("unshelve"), simply merge the shelf branch back to your local copy.

If you don't know command-line SVN nor Tortoise SVN well enough to do the above, here's a super detailed step-by-step instruction on how to do it in Tortoise SVN:

  1. Do "SVN Update" to update your working copy to the latest version of the trunk. This way the only differences between your local copy and the trunk are your changes.
  2. From the context menu select "Branch / Tag"
  3. "HEAD version in the repository" option is selected by default. Keep that.
  4. Change the "To Url" to specify branch name, e.g. http://server/repository/project1/branches/shelf1
  5. Check the "Switch working copy to new branch/tag" box
  6. Click Ok to create the branch and switch to it
  7. Do "SVN Commit..." and commit your changes to the newly created branch
  8. From the context menu select "Switch..."
  9. Change the "To URL" to the trunk URL e.g. http://server/repository/project1/trunk
  10. Click Ok to switch back to the trunk

See this link for even more details and the command-line equivalent of the above:
Shelves in Subversion

Neuter answered 1/6, 2011 at 14:39 Comment(4)
On big repositories, this is a painfully slow (and error prone if there are deletes here and there) processLazar
@Samaursa, which step is slow? Also, deletes were never a problem for me, unless there are unversioned items in the working copy (which you should clean before switching, read this: (subversion.apache.org/faq.html#switch-problems)Neuter
The switch to a new branch or even the trunk. Very very slow on the repository where I work (it is quite big) and even on some of the my projects which were increasing in complexity (I switched to mercurial for personal projects). And yes, the unversioned items problem. Once switching to mercurial, I could not believe how easy everything was all of a sudden. Too bad they don't use it at work. A shelving option would have been great in SVN.Lazar
All the switching seems like a kludge, imho svn is starting to fall behind while many scm tools (e.g. Perforce, TFS, Mercurial <by way of an extension>) have this feature to easily save temporary code on the server and revert back easily, etc, etcPrestissimo
S
11

TortoiseSVN 1.10 now supports shelving: https://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-shelving.html

Sherronsherry answered 24/4, 2018 at 7:29 Comment(3)
I'm wondering if it's a TortoiseSVN feature or Subversion's one? I can't find any mention of shelving in svnStereophonic
It's a new Subversion feature, see subversion.apache.org/docs/release-notes/1.10#shelving.Sherronsherry
TortosieSvn 1.10 also added this feature tortoisesvn.net/tsvn_1.10_releasenotes.htmlTabshey
T
9

Another option is to use the 'Create patch' facility in TortoiseSvn to create a patch file and revert changes. The patch file can later be reapplied to get back where you were.

You may still end up with some sticky merges if you have to update the working copy revision though.

Tercentenary answered 14/2, 2012 at 13:26 Comment(0)
P
3

SVN have upgraded the shelving https://subversion.apache.org/docs/release-notes/1.11.html#shelving

The kinds of change you can shelve are committable changes to files and properties, except the following kinds which are not yet supported:

  • copies and moves
  • creating and deleting directories
Padget answered 9/11, 2018 at 10:35 Comment(1)
This should be the answer when it will no longer be experitmental, thanks tartarismo. Here is a convenient link: cwiki.apache.org/confluence/display/SVN/…Buatti
P
1

You can use a DVCS but in a way this is a kludge. 'Shelving' in a DVCS stores your changes locally only. Its useful only if you want to checkpoint your work to rollback if you break it with further work, but preferably you'd want to save your work on the server.

One way to do this in SVN without an explicit shelve command is to switch your working copy to a different svn location and commit there instead of on your main repo. This is effectively like creating a temporary branch and working on that for the duration of your work. I don't think you'll even have to merge as SVN will do it for you when you switch, as your local modifications will be kept.

Unfortunately, you cannot switch to a non-existent location, so the first time you do this, you'll have to create the 'branch' to shelve to. I guess the whole thing could be automated.

Physostomous answered 26/5, 2011 at 12:2 Comment(0)
C
0

Support Feature

SVN supports for shelves is experimental means, it doesn't promise backward compatibility for future releases, either its disabled by default.

it has been started with version 1.10

but the shelves create with 1.10 & 1.11 is not supported by newer version, as it didn't promises so.

so there are different underlying and you have to pay attention that this is an experimental feature and is going to be improved over the time.

the 1.10 shelve commands start with svn shelve but the 1.11 & 1.12 starts with svn x-shelve.

Commands

the commands for new shelve are:

    svn x-shelf-diff
    svn x-shelf-drop
    svn x-shelf-list, x-shelves
    svn x-shelf-list-by-paths
    svn x-shelf-log
    svn x-shelf-save
    svn x-shelve
    svn x-unshelve

Activating

for activating using this feature you have to run the command by setting the enviourment variable:

#Shelving-v3, as introduced in 1.12
SVN_EXPERIMENTAL_COMMANDS=shelf3
#Shelving-v2, as introduced in 1.11
SVN_EXPERIMENTAL_COMMANDS=shelf2

further information can be found here:

https://subversion.apache.org/docs/release-notes/1.14.html#shelving

Coreycorf answered 17/3, 2022 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.