Is it possible to create a branch from a tag in TortoiseSVN without first checking out the tag from SVN server? - tortoisesvn

Our trunk directory contains about 100mb of code and we create tags from the trunk directory. Normally, this is not an issue because a tag takes up no space until you need to use it for something. Since branches are created from tags in SVN, how can I create a branch from a tag wtihout first checking out the tag? It appears I need to do a Tortoise Update from Windows Explorer to get the tag down to my local machine before I can use Tortoise > Branch/Tag... to create a branch from it. This seems illogical since we don't make changes to tag folders, and it requires that I check out 100mb of code, only to create a branch, and then check out another 100mb of code in the branch folder, where the changes will actually be made.
Ideally, I'd be able to create a branch directly in the repository via RepoBrowser - but I can't see an option for it there.
Am I missing something?

Creating a branch is just a matter of copying the desired directory to another location. This can be done directly in the Repo Browser.
There is nothing special that differentiates a branch from a tag as far as Subversion is concerned. It is just a convention to store them under separate parent folders, named 'branches' and 'tags' accordingly.

The only difference between tags and branches is your attitude towards them -- they are equivalent behind the scenes -- shadow copies made in the repository.
You don't even need a working copy to create a branch/tag. For example, you can use this command-line:
svn copy http://server/test/trunk http://server/test/branch -m "make branch"
(assumes you have SVN.EXE in addition to TortoiseSVN, otherwise, use Ben's answer)

Related

TortoiseSVN switch Branches

I have used svn for a while but recently a couple teams were added to the project. One of the teams made a new branch and has asked me to check some of their changes. I went to the directory, right click, svn->switch and chose the new branch. I went in and tried to echo something to the page I was on to see if I was working in the new branch and I wasn't. This is a little beyond what I do but with the project getting so big I need to learn this.
Based on that, my question..is there something more to this that I am not doing? After switching the working copy to this new branch how do I work on it?
The difference between checkout and switch might be adding to the confusion. I think that in your case it would be simpler to just check out the branch to a different folder since you're just doing review and it may be the most straightforward way to proceed regardless.
See this section from the Tortoise docs:
To Checkout or to Switch...
...that is (not really) the question. While a checkout downloads
everything from the desired branch in the repository to your working
directory, TortoiseSVN → Switch... only transfers the changed data to
your working copy. Good for the network load, good for your patience.
:-)
To be able to work with your freshly generated branch or tag you have
several ways to handle it. You can:
TortoiseSVN → Checkout to make a fresh checkout in an empty folder.
You can check out to any location on your local disk and you can
create as many working copies from your repository as you like.
Switch your current working copy to the newly created copy in the
repository. Again select the top level folder of your project and use
TortoiseSVN → Switch... from the context menu.
In the next dialog enter the URL of the branch you just created.
Select the Head Revision radio button and click on OK. Your working
copy is switched to the new branch/tag.
Switch works just like Update in that it never discards your local
changes. Any changes you have made to your working copy which have not
yet been committed will be merged when you do the Switch. If you do
not want this to happen then you must either commit the changes before
switching, or revert your working copy to an already-committed
revision (typically HEAD).
If you want to work on trunk and branch, but don't want the expense of
a fresh checkout, you can use Windows Explorer to make a copy of your
trunk checkout in another folder, then TortoiseSVN → Switch... that
copy to your new branch.
In the regular "Properties" dialogue (right click on Windows explorer) you have a "Subversion" tab that will tell you what URL the file or directory points to. Use that to verify that you actually switched to the correct branch.
It's also worth nothing that any non-committed local changes will still be in your working copy.
There might be a misconception about svn switch :
At first I thought that the existence of a switch command would imply that there were a "current" or a "selected" working copy for the proper functioning of SVN. Like I'm currently working on trunk, then I'm working on a branch B, hence "switching" from a working copy to another. The truth is : there is no such thing as a current working copy ! There are just many local working copies : one for the trunk, one for a branch another for a tag and so on. But none would be "implicitly selected".
As Paul Sasik quotes : switch would allow, for instance, to have only one working copy of say, the trunk, and then, merging that local working copy with a targeted branch or tag from the remote repository. switch only sync differences between local and remote, hence avoiding to do a whole check out of a solution. Past exectution of command, every further commits on the working copy will occur on the distant repository folder which's been switched to, which's been targeted. No matter what the initial check out was for that local folder.

Is there a way to use tortoise svn to backup my modified files?

I have a bunch of files that I've changed that I don't really want to commit, but I would like to back them up locally in case I would like to use them again. (Then I'll revert them.)
TortoiseSvn working status helps to view the modified files, but I want a way to save them all to a separate directory like Backups\, preferably with their folder heirararchy still in tact.
How can I do that?
UPDATE:
Apparently branching is the way to go.
But what I did was just copied the modified files paths to the clipboard (which is an option in tortoisesvn) then to a file, and created a program to copy them to a backup folder.
You can create a branch and commit those files only in that branch.
You can commit it inside a branch, so it doesn't affect your current 'trunk' or branch.
If you had a try with bazaar , that is compatible with SVN, there is a shelf command to temporarily store a set of modification and apply back them later.

How to temporarily apply (or archive) PATCH/DIFF changes from Tortoise SVN?

I've been using Tortoise SVN + Visual SVN for about a year since left the corporate world to do my own startup. There's one feature in Tortoise SVN that I've never figured out:
How can I bundle up a bunch of changes into a PATCH or DIFF file and either: A) share them with my co-founder; or B) archive them into a standalone change that I can either "apply" or "revert" on my dev box?
At my previous employer, we used an internal tool that let us build so-called DPK files that contained a set of local changes. You could add changed files to the DPK and then share it with colleagues. They could either review the changes in a Diff tool or apply all the changes from the DPK to test your change on their box. After the review was complete, you could then check in these changes. You could also have multiple DPK's applied at the same time (provided you didn't have overlapping changes).
I want to achieve the same thing with Tortoise SVN + Visual SVN in the VS2010 IDE.
My real-world scenario is that I have some extensive change pending but uncompleted on my box. I want to ZIP up these changes and store them in a DIFF file, revert the changes, move on to something else, work on that, and in a few days reapply my changes from the archived DIFF file.
Reluctantly answering my own question. This feature is available with Tortoise SVN. Basically, you make a PATCH file, distribute it or archive it, and then you apply the PATCH. The only trick is to make sure you're in the right location in the WC (Working Copy) when you do the "apply". When you apply, you'll get a popup menu to the left with a list of all files in the changelist. You can apply the patches one by one or in bulk. Seems to work great. I should have drilled into the docs more before posting this question.
Here's the text for picking the location:
"Patch files are applied to your
working copy. This should be done from
the same folder level as was used to
create the patch. If you are not sure
what this is, just look at the first
line of the patch file. For example,
if the first file being worked on was
doc/source/english/chapter1.xml and
the first line in the patch file is
Index: english/chapter1.xml then you
need to apply the patch to the
doc/source/ folder. However, provided
you are in the correct working copy,
if you pick the wrong folder level,
TortoiseSVN will notice and suggest
the correct level."
Be sure to pick the location carefully. If Tortoise SVN can't find it because you selected the wrong node in the VS file explorer, it will try to find a matching location and that might be wrong. In my tests, the Patch feature actually tried to map to a branch (!!) when I specified the wrong location.
Here's the relevant link:
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-patch.html

TortoiseSVN: copy contents of one branch over another

I'm using TortoiseSVN without an external Subversion server to manage LabView source (i.e. a large collection of ever-changing binary files).
I'd like to have a "beta" branch of the repository that anyone can subscribe to and get daily updates. I guess this is different from a usual beta release series with separate branches, but it's right for this project.
What is the best/easiest way to copy the contents of a particular revision of the trunk branch over to the beta branch? Essentially what I want to do is delete the old contents of beta and insert new contents. Delete+add would work, I suppose, but it's clearly suboptimal. Merge is not an option unless I can get Tortoise to automatically resolve all conflicts in the trunk's favor, including deleting files.
Update: a couple people have asked why I don't want delete+add. I'd like a cleaner alternative.
This method leads to half the updates to the beta tree being "wipe out last rev."
The updates are not atomic so someone could pick up an empty release.
I haven't tried and seen, but beta wouldn't be a proper branch. Would the revision log even track multiple revisions at all, since it's a "new" file each time?
Update 2: svn allows any arbitrary commands before a commit, but I couldn't get Tortoise to work this way. After selecting "Delete," stub directories were still left over until I committed, at which point I could repopulate the branch. There needs to be a way to unmark a directory for deletion when it exists in both the old and new tag revisions.
Merge is not an option unless I can
get Tortoise to automatically resolve
all conflicts in the trunk's favor,
including deleting files.
I don't know about TortoiseSVN, but if you install the command line client you could do the following to merge the latest trunk changes to a beta branch:
cd c:/path/to/my/working/copy/of/beta/branch
svn merge file:///c:/path/to/my/repository/trunk --accept theirs-full
svn commit -m "merged latest trunk changes to beta branch"
The --accept theirs-full option resolves all conflicts by using the trunk's version like you want.
This has some advantages: subversion will do representation sharing, so files stored on both branches will not take extra space in the repository. Also, when users update their beta working copy, only the files that were changed need to be pulled over the wire.
SVN is transactional - a delete and copy (not add!) would not be problematic. And beta would be a proper branch (or better a tag)
Why not delete beta/* and then copy trunk/* to beta/ ?

Using tortoiseSVN, how do you tag the code?

Using TortoiseSVN, how do you tag the code?
Is the process to branch exactly the same?
I know you have to just copy the code to the /tag/ folder, but how?
i.e. I want to copy revision # to a tag#.
Will it affect the /trunk/ at all?
The answers here were missing some key information for getting started with SVN and braches.
Step 1: You need to make sure you have a suitable branches/tags dir. e.g. if your project has this structure:
url/myproj/trunk/...
you also need:
url/myproj/tags/
url/myproj/branches/
To do this, don't "add" the directories and commit them, or tortoise will give you an error. Instead use the tortoise svn repo-browser, go to myproj then right click and "add Folder".
Step 2: Right click on your trunk folder, select "tortoise SVN" then "branch/tag". The copy branch/tag dialogue now pops up.
Step 3: Set the "to Path" to "/myproj/tags/myversion" where myversion is usually something like "1.0". Select "Head revision in the repository" and make sure "switch working to new branch/tag" is not checked. Hit OK.
Step 4: Unfortunately, next time you do an update, it will pull down the branches and tags as files. This means your HD will get filled with every file from every branch and version created. One solution is to only checkout each individual trunk dir, which is not always convenient (as you have to manually update 30 trunk dirs if you have one repo with 30 projects).
Personally, having used CVS, SCCS, PVCS, VSS & Rational for 30 years, I find SVN much harder to work with.
Right click on your project folder and select Branch/Tag
Point the URL to whatever you want the folder to be called inside the /Tag/ folder
Select Specific revision in repository and choose the one you want
It won't affect the trunk at all.
How to create a tag :
Right click on your repository local copy
Choose Create a branch or a tag...
Choose URL of the tag (normally at the same level that trunk you have a tags folder)
Choose which revision you want to tag
(Usually, you will choose HEAD revision. Why ? Because normally tags are to mark a state of your repository typically for release management, and then when you have the repository state wished, you tag it and then continue the development.
Yes, it's almost the same process that for branches, the difference is "conceptual".
No effect to your trunk !
Here's the official documentation.
Creating a tag won't affect the trunk nor your working copy (you'll still be pointing to trunk) unless you switch to the newly created tag or branch.
Answers below:
The process is almost exactly the same as a branch.
A branch is a tag which is updated essentially.
Right click on the folder you want to tag, click on RepoBrowser, then branch/tag.
Modify the ToURL, with where you want to place your tag
Enter your comment/tag in the box below.
This will tag the code in the folder, without moving it.
This will not effect the trunk at all.

Resources