Pragmatic Version Control Using Subversion

Mike Mason

Mentioned 10

Provides information on Subversion 1.3, an open source version control system.

More on Amazon.com

Mentioned in questions and answers.

Anyone have any suggestions on where to start for a newbie wanting to try out some sort of source-control along with a new journey into ASP.NET? SVN, VSS, CVS...I dont even know where to start!

The Pragmatic series has two of the best books I have read to help get your head around version control. They have versions for SVN and CVS. I really like their chapters on tags and branches.

Many of my colleagues use SVN in groups of 1-5 people partly working on the specific project. Half of them are inexperienced students. In fact non of us are real software developers with year-long experience. Most of them use Eclipse and subclipse to read and write their contributions to the SVN repositories.

Some of them have problems with the difference of:

  • checking out (confused with update and merge)
  • commiting (confused with update)
  • updating (confused with commit and check out)
  • merging (is the hardest. Whats a merge? Do i have to merge my code "into the SVN"?)

They fear that the SVN might kill their work (they don't call it working branch) if they press the wrong button.

They are committing their eclipse .project files to the repository, after adding some arbitrary library dependencies to their java projects. The other colleagues get compilation errors from these comitts and find it hard to resolve these.

In general they say: I'd like to work without SVN, I don't like it. It's too complex.

Is there a e-learning project like "SVN for kids"? How can I make them like version control?

SVN keeps track of all changes since the project start, so there's practically no way to throw away your work just by hitting the "wrong" button. I really think that all significant work should be under version control, even if there's no team (I code alone and I use it).

I never really saw the point until I read this little book, try to make them read at least the first 20 pages. There's a good analogy there between subversion and the "undo" button of any editor, that may convince them of using it (it worked with me :) )

I read SO nearly everyday and mostly there is a thread about source control. I have a few questions. I am going to use SVN as example.

1) There is a team (small, large dosnt matter). In the morning everyone checks out the code to start working. At noon Person A commits, while person B still works on it. What happens when person B commits? how will person B know that there is an updated file?

2) I am assuming the answer to the first question is "run an update command which tells you", ok so person B finds out that the file they have been working on all morning in changed. When they see the udpated file, it seems like person A has REWRITTEN the file for better performance. What does person B do? Seems like there whole day was a waste of time. Or if they commit their version then its a waste of person A's time?

3) What are branches?

thanks, and if anyone knows a laymen terms pdf or something that explains it that would be awesome.

I gess you need read more about SCM like tools. This operations you have doubt are very much common in a development enviroment. Here goes my suggestions about SVN and Git books:

Good read :-)

I was reading this post about "branch per feature" and this one too and found myself wondering how many people out there are using this concept? I am all for continuous integration and tagging each check in. And at the end of an iteration I create a special tag set to identify the sprints result. I have never needed to take it further by creating a special branch for each features development.

Question: Does anyone branch their code for the development of each feature in their code base? If so, why do you do that and what are the benefits that you have seen from this process? Do the non-process oriented developers on your team buy off on this approach?

I haven't heard of such a thing. Seems like an overuse of branching to me. I guess it depends on what we mean by the word "feature". Is it a use case? A user story? An entire iteration?

Branches imply parallel development. If you aren't developing in parallel, why branch?

Some good SCM references from our host, Jeff Atwood:

  1. Eric Sink
  2. Branching and Merging Primer

And, of course, the SVN red bean book:

http://svnbook.red-bean.com/

I also like what "Pragmatic Version Control" has to say about branching and tagging.

When I first started using revision control systems like CVS and SVN, I didn't really understand the concepts of the "trunk", branching, merging and tagging. I'm now starting to understand these concepts, and really get the importance and power behind them.

So, I'm starting to do it properly. Or so I think... This is what I understand so far: The latest release/stable version of your code should sit in /trunk/ while beta versions or bleeding edge versions sit inside the /branches/ directory as different directories for each beta release, and then merged into the trunk when you release.

Is this too simplistic a view on things? What repository layouts do you guys recommend? If it makes a difference, I'm using Subversion.

What I do and normally see as a standard is:

The trunk should contain your main line of development, your unstable version. You should create release branches for your releases.

Something like:

/trunk (here your are developing version 2.0) /branches/RB-1.0 (this is the release branch for 1.0) /branches/RB-1.5

When you find a bug in 1.5, you fix it in the RB branch and then merge to the trunk.

I also recommend this book.

I am currently evaluating different source control solutions for work, and have a few questions about branching.

I have the basic understanding of how to branch, but i am unsure of how our build machine (CruiseControl.net) can get a branch to build it.

We have many projects, which are all relied appon by other projects (there are others to): Utilities > Data Access > Business Logic > Common GUI > ( Website | Desktop clients )

How do we structure the repository (Vault if that makes any difference) so that the build machine is able to:

  1. Build the trunk
  2. Build the 'latest' branch

A rough folder structure and/or an explanation on how to get from cruisecontrol would be great.

thanks

Edit:

To add some clarity, we intend to use the trunk for development, and then use a branch for each release.

Just to clarify about how tags and branches would be used in Vladimir's scheme. Let's say that version 1.x of your product is retired, version 2.1 is out in the world, and you're working on version 3.0:

trunk <- you're working on version 3.0 here
 project1
 project2

branches
 ReleaseBranch-1.0
 ReleaseBranch-2.0 <-- fixes to version 2.1 (the current production version) get committed here, then merged into the trunk

tags
 Release-1.0 <-- a copy of the source that was used to build version 1.0
 Release-1.1
 Release-1.2
 Release-2.0
 Release-2.1

In your continuous integration/build server, you're going to need 2 processes:

  • one that points to the trunk in your version control system
  • one that points to ReleaseBranch-2.0 on your version control system

The book Pragmatic Version Control with Subversion is designed for Subversion, but does go into how to organize a repository as described above.

I am looking to set up our web application shop to start utilzing svn better. Currently we have programmers making changes into trunk which then directly affects production...

yes I know - terrible!

I want to set up seperate branches so that there is a branch that we use to make fixes. Then we can promote to the QA branch and then promote to the trunk/prod branch when all is well.

Problem is - I am more fancy using Tortoise SVN - so if someone is willing to help me structure this well and explain a good process from going from one step to another through tortoise - that would be awesome!

Thanks in advance -

G'day,

I would highly recommend that you get a copy of the excellent book "Pragmatic Version Control: Using Subversion" (sanitised Amazon link) which covers this topic along with many others.

It does so in terms of what you want to do, rather than be simply a mechanical recitation of the features.

HTH

'Avahappy,

BTW I've just seen that the second edition of this book is out.

I am planning to create projects which will get a bit bigger than my projects before, so I thought it would be good to use a revision control system like svn or git to keep track of all changes, experiment a little bit with new functionalities in code without risks and so on.

Now (besides the question whether I should use svn or git), I am asking myself "how to use" such a system in general.

Up to now, I found vocabulary like trunk, tags and branches (The word merging appears often in that context). But I am not really sure how to really work with them. Tags seem to be something like release versions (if not please correct me), but I do not know what really belongs in the trunk or in a branch; when to use what etc..

During my researches, I also found a recommendation that you should generally create a folder structure with the sub-folders branches, tags and trunk for a new project. Would you also recommend this? Or should I handle the source-code of a project a different way?

Can somebody try to explain this to me?

The Subversion Red Bean book has a nice discussion about the topic.

Pragmatic Version Control is a fine book, too.

I have a Windows 2003 Server with IIS, I installed VisualSVN Server on it.

I have two developers, who are going to use TortoiseSVN.

Since this is my first time ever setting up a SVN server I am kind of confused on how this will all work. The way I see it, each developer would have a copy of the repository on his or her local pc, would each person be required to have IIS installed on their PC as well to test their copies before checking out?

Should I create a testing folder on the server and then a production ready? It seems as if that would cause more issues with copies?

What would you do?

EDIT

I dont know what I was thinking, I forgot that VS has a built in IIS when you debug so the issue about setting up IIS on either client or server is now a non-issue. But I am confused, I imported the site into the repo, it said it was on revision 2 but I dont see any of the files in the repo folder. Do I create a virtual folder in IIS pointing to the repo that I created?

"Pragmatic Version Control Using Subversion" and the SVN red-bean are the two sources you need to see.

Set up SVN on a single server and have all your developers point to it.

I just asked a rtm worthy question about SVN. I've used SVN for several years and I manage several repositories used for different projects; apparently, I've been managing to get by with my simplistic mastery of SVN's client app.

How do I get to the next level (of effective SVN workflow)? How do I learn to master the app when I don't, in person, know anyone who can coach me and give me pointers. Are there any resources (besides the manual and it's examples) to help me learn to use it beyond the basics (showing me why/when I would want to employ advanced commands etc.)?

I highly recommend Pragmatic Version Control Using Subversion. It's a bit of an introductory book, but it does have a lot of good things to say about Subversion best practices. I learned a lot about how best to organize and maintain project structures in SVN (and with other version control systems) from reading this book.