Marko Taht
Marko Taht

Reputation: 1522

SVN tagging a tag

Client has a SVN repo with structure /trunk/branches/tags. Now we want to do a hotfix to a older version. But the state of the older version is only in tags/oldversion. Can i make a tag of tags/oldversion then do the fix and then commit the new tag? Or is there some other way to do this?

Upvotes: 1

Views: 966

Answers (2)

Álvaro González
Álvaro González

Reputation: 146350

The tunk/branches/tags layout is just a convention and nothing will prevent you from working on tags. But the convention implies that tags are read-only and you aren't meant to commit changes into existing tags.

From your description, I understand that /tag/oldversion points to either a fairly old revision of /trunk or a subdirectory inside /branches that no longer exists. I recommend you create a new branch to do regular work in the old version and, once you're done, create a new tag.

  1. Launch Repo-browser, right click on /tag/oldversion and select "Show log".

  2. Click on the latest revision, hopefully the one where the tag was created. In the pane below, take note of "Copy from path" and "Revision". That's the source URL, where the tag is pointing to. For instance, /trunk at r123.

  3. Back into Repo-browser, click the "HEAD" button beside "Revision" and use the dialogue to select the old revision.

    Open revision selector
    Select revision

  4. Now that Repo-browser is displaying r123, right click on /trunk, select "Copy to..." and edit the suggested path to create the new branch, e.g. /branches/legacy or /branches/1.x or whatever suits you. Don't worry, you can review the changes in the "Enter log message" dialogue before committing them.

    Enter log message

  5. Now you have a new fully functional branch that points to your old code. You can check out that branch and start coding. Create tags from it as you release.

(Yes, the overall procedure is probably faster with the command-line.)

Upvotes: 2

Chris
Chris

Reputation: 2304

You can make a branch/tag off of any directory in the repository. It's typically not convention to do it off of a tag, but it's not unheard of either -- especially for reasons you've detailed where you need to make a hotfix on that particular tag.

You can make the change directly in the tagged branch if you prefer. If you're using TortoiseSVN you may see something along the lines of "this appears to be a tag, are you sure you want to make this change?" (More than likely butchered that -- can't remember the message off the top of my head) and just continue.

The alternative is as you've mentioned; you can make another svn copy (svn copy being the actual command you're running whenever you branch/tag a directory -- there is zero difference between a branch and a tag aside from convention) of that tag and make the change in there (you'll see the same message above).

For example:

Repo
|_trunk
|_branches
|_tags
    |_oldversion // svn copy (branch) this directory
    |_newversion // to create this directory and apply the fix

I would prefer this second method, in the event you need to keep the previous tag pristine for traceability purposes.

Upvotes: 0

Related Questions