user200783
user200783

Reputation: 14348

Subversion (and TortoiseSVN): Is it possible to create a tag directly from an existing tag?

In my subversion repository, I have the standard /trunk, /branches and /tags folders and a tag, say /tags/tag1.

Is it possible to checkout /tags/tag1, make some local changes, and then commit directly as another tag, say /tags/tag2? Can I do this without touching the trunk or any branches?

Also, if this is generally possible using subversion, can it be done with TortoiseSVN?

Edit:

If this can be done using TortoiseSVN, I assume it can be done from the command line. What commands would I need to use?

Upvotes: 1

Views: 3001

Answers (5)

BT147
BT147

Reputation: 3

Well You can create a Tag from a Tag, but as mentioned Tags are "read-only" snapshots so better 1st create a Trunc from that earlier Tag say Tag 1 by " Update to Revision" and give particular rev no of Tag1 and then make the changes to Trunc and without svn update/commit of trunc simply Branch a Tag from trunc and choose working copy and make new tag .Don't forget to switch Trunc at the end of this practice in order to have continuity with svn tags.

Upvotes: 0

CruiZen
CruiZen

Reputation: 182

It is possible to do this from TortoiseSVN. Go to the location of the tag that you locally modified in Windows explorer. Choose 'Branch/ Tag' from the TortoiseSVN context menu. Now select the TO url to something like 'svn://server/project/tag2'. Next, for 'Create copy in the repository from', choose the option 'Working Copy'

Upvotes: 1

Amber
Amber

Reputation: 526603

Subversion basically treats everything like a directory structure - a tag is simply another folder in the structure that happens to be within a 'tags' directory.

Thus, technically you could check out the tags directory, copy one tag folder to a new folder, svn add that new folder, and commit it - which would essentially create a new tag based off of the old files. However, you wouldn't get the link between the old tag and the new one (which sort of makes sense - tags aren't supposed to be linked to anything, they're just supposed to be snapshots).

A better scenario if you want good progression of revisions would be to copy the old tag into a branch; make the changes, commit the branch, and then copy the branch back to a new tag. This would preserve the history of the changes much more accurately.

Upvotes: 0

Jarrett Meyer
Jarrett Meyer

Reputation: 19573

You can create a branch from /tags/tag1 to /tags/tag2. You can do this without touching the trunk or any existing branches.

We call this hotfix branching, because /trunk has moved on, but there's something in /tags/release-1.0 that needs to be fixed. So we'll branch from /tags/release-1.0 to /tags/release-1.0.1. We'll make the fix and commit to that tag.

Upvotes: 0

Davide Gualano
Davide Gualano

Reputation: 13003

Yes, you can do this: checkout the tag, then fro the working copy choose Branch/Tag and select "Working copy" in the "Create copy in the repository from:" section, and in the "To URL:" field enter the url of the new tag.

But why you want to do this? Usually, tags are "read-only" snapshots of the state of the code base, and should not be modified.

Upvotes: 3

Related Questions