tags:

views:

166

answers:

6

I'm a few weeks into moving all of our source code into an SVN repo, and really starting to see the magic. I now have a very simple question that will dictate much about my approach to SVNing.

I was on site for a client for 3 weeks, working on the trunk of ProjA. Just before I left, I created a branch of the trunk under "ProjA/tags/release-09.11.17" (datestamp version number) so I could have their exact build for emergency bug fixes.

Just now the client called me on a confirmed a simple math bug and I fixed it. I'm wondering how to approach updating our repo, and I see having several options:

1) Commit changes to the ProjA trunk, and delete "ProjA/tags/release-09.11.17"

2) Commit changes to both ProjA and "ProjA/tags/release-09.11.17"

3) Commit changes to ProjA, create a new tag for TODAY "ProjA/tags/release-09.11.19" and delete the old tag "ProjA/tags/release-09.11.17".

Any of these have pros/cons as I see it. In the coming weeks ProjA will see a lot of development that said client won't see until I'm back on site again.

Thoughts and reasons? Thanks!!

A: 

If you don't want any of the changes in the trunk to get released I would change the ProjA/tags/release-09.11.17 then merge those changes into the trunk

Rob B
A: 

I believe SVN gospel is that /tags is for doing just what you did-- marking a specific moment in time where the code was in a known state. I think what you want to do is create a branch in /branches/client which you can then keep up-to-date with merges from the trunk. You can ALSO copy a datestamped version over to /tags when you're done just as an aid to memory.

Matt
"SVN gospel" is exactly what I'm looking for. I'm trying to avoid future "I wish I would have approached it this way"s :P
bufferz
A: 

I recommend that you commit your changes into the release branch and re-deploy the code from the release branch. Then, you can merge the branch changes back into the trunk for future releases.

Using that method, you will preserve the integrity of the release code but also make sure the fix gets into future releases.

jonstjohn
See my comment in post above you, my question applies to your comment also.
bufferz
+1  A: 

It's a bad idea (at least from what I know of tagging/branching) to delete a tag. The tag is there for your reference at a later date -- think of it like a bookmark in time. If you want to find the code you put into that release, the tag will always be there for you.

If you want to start a new branch of development based on that tag, you can always do that using svn cp. You can commit your changes there, do some testing, and then tag that for release as a subsequent version, which is what it is -- you can't change what you've already released. Afterwards, you'll probably want to port the fixes back to your trunk. Depending on what you have set up in terms of merge info (via svnmerge.py or core svn style metadata), and depending on how much work you actually need to do in the branch, this may be trivial or a pain in your neck.

My takeaway advice is to try to avoid actually committing to a tag (other than its initial creation).

MikeSep
"If you want to start a new branch of development based on that tag,...""My takeaway advice is to try to avoid actually committing to a tag (other than its initial creation)."Would you say that this is the way to go even with blatantly obvious bug-fixes instead of developmental changes?
bufferz
That's a fair question. The temptation is high just to make a quick change on the tag. That's the beauty/simplicity of svn's approach to having a branch and tag simply be copies of trunk (or something else, for that matter). In other source control systems, you wouldn't really think to use a tag in this fashion (in git, you'd definitely start a branch), so I think it's a bad idea here.
MikeSep
I think you want a release branch which is tagged along the way as you make releases. The end of the release branch will probably always be tagged, and that tag will seem redundant until you add a new high-priority fix to the end of the release branch. In the meantime, you can be working on more experimental changes in the trunk.There's a section in the SvnBook that briefly talks about this style of branching:http://svnbook.red-bean.com/en/1.5/svn.branchmerge.commonpatterns.html#svn.branchmerge.commonpatterns.release
MikeSep
Thanks for the ongoing info! Would you suggest that if I have multiple clients that I'm constantly making small changes for, that I have a /tags directory within each client's branch? Where the individual clients' branches would often be identical to the trunk, but each would have its own /tags history. I ask because this is different than the default trunk|branches|tags structure.
bufferz
I don't think you should have tags inside a branch, if that's what you're proposing, but you may want to adopt a naming scheme to help you keep track of what you're tagging. There's nothing to say you can't have dirs of tags (tags/releases_for_clientA/2009-11-19/), though I think using names and trying to keep the tags and branches as flat as possible seems to be the norm. Ideally, the layout tree you see in trunk is the same under each branch and tag. (aside: You don't want to tag a subtree of trunk -- it makes for tracking headaches later on.)
MikeSep
A: 

I think that you are looking at it backwards, if there are ongoing, overlapping, packaged changes the preferred way to go would be to make those edits in a branch. Bug fixes, and short-term patches would go into the trunk.

While working on the longer-term project, the bug fixes can be merged into the branch, to ease that branches' final merge back into the trunk.

So, your emergency fix would go into the trunk, and be merged into branch/release 09.11.17.

Alex Waddell
So if I'm understanding correctly, you suggest that I keep the actual running (at the client's site) copy of ProjA in a branches/clientA directory at all times, even if it happens to be identical to the trunk? then make all little changes to that branch and keep merging. all the while keeping tags just for reference but never actually editing them?
bufferz
A: 

If you don't want all the changes between ProjA/tags/release-09.11.17 and ProjA/trunk@HEAD to be in release ProjA/tags/release-09.11.XX (with XX being the date of that bugfix release), you can do is this:

  1. copy ProjA/tags/release-09.11.17 to ProjA/branches/fix_math_bug
  2. fix the bug on that branch, run the tests (here you could also merge other bugfixes from the trunk if you want to)
  3. copy ProjA/branches/fix_math_bug to ProjA/tags/release-09.11.XX
  4. delete ProjA/branches/fix_math_bug
sbi