When hacking on the ports tree or on the sources, you often have unfinished patches you are testing step by step.
I'm also hacking on something unfinished and then some other area needs some fixes with a higher priority and in the same time some people are asking for some testing/review on their own patches. So I need to quickly interrupt what I was working on get back to a clean tree, and switch from patches to patches.
While doing this is easy with git, fossil or mercurial it is more complicated with svn. The feature in particular I use on fossil/git for that is the stash feature.
So I wrote my own stash for svn, and because of mobility I was willing to be able to share my patches across boxes, so I have made stash able to be under a vcs itself, with support for git, hg, fossil and svn as a vcs for the stash.
How does it works: The stash command will discover that .svn of the working copy you are working on and will create a patches subdirectory.
Now imagine that directory itself contains a .hg, .fslckout, a .git or a .svn then stash will know it is being under vcs control.
$ stash save <name> [-u] [files...]
This will create a .svn/patches/
Once the diff created it will rollback the tree (on specified files or current directory) to the clean state before any modification.)
By default it will not overwrite a patch with the same name except is -u is provided on the command line.
If the stash directory is under a vcs control then a add/commit (or just commit in case of update) will be performed in the stash directory.
$ stash ls
List all the available patches.
$ stash show <name>
Print on stdout the content of a given patch
$ stash apply <name>
Apply a specified patch on the working copy using svn patch --strip 1 from the root of the working copy.
$ stash rm <name>
Remove/destroy a patch from the stash directory. In case the stash directory is under vcs control then the proper rm command followed by the needed commit will be performed.
$ stash pop <name>
It is the equivalent of stash apply
$ stash push <name>
Push (scp) the patch on a remote site (currently freefall is hard coded :)
$ stash sync <name>
This command is only useful if the stash directory is under vcs control, it performs the necessary pull/push mechanism depending on the VCS used.
No git svn won't have worked in my case for multiple reason: 1/ want something flexible which can also only work with svn 2/ the ports tree can work properly with git svn (properties setting adding new files etc will not work as one expect) 3/ I want to use fossil for the stash, other might prefer svn or hg.
Disclaimer: hg and git support hasn't been tested yet, patches welcome to fix them if needed. if you want to add support for your own favorite vcs just them me the patches I'll integrate them.