views:

813

answers:

8

I'm looking for an overview over different source code control policies. I only came across the Main-Line policy and would like to better know others before committing to one with the team.

Can someone provide a link to an overview or even give me some names of policies so I can launch google on it?

A: 

My favorite policy is "No subversion commits that do not reference tickets + Auto Trac comments for each commit": http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook

rjurney
Maybe, just maybe, in a really locked down maintenance environment. I'd much rather that all the devs are encouraged to check in. Get an automated test and build system in place and make sure you have configuration audits for baselines, but don't discourage commits.
Hamish Smith
+2  A: 

I have had great use of the book Practical Perforce. Though you might not be working with Perforce I think that chapter 7 (How Software Evolves) and chapter 8 (Basic Codeline Management) might be very useful. You might be able to skim them on Google Books.

Perforce also has many great articles on the subject. Software Life-Cycle Modeling writes about policies.
Perforce complete technical documentation.

And, no I'm not working for neither with Perforce.

Good luck, Thomas

homaxto
+5  A: 

No empty commit messages.

Vilmantas Baranauskas
A: 

Commit per-change instead of per-file.

This has following advantages:

  • You can later see why this single line has been changed in this exact file (aha, this was bugfix for bug #123). If you commit per-file then commit messages tend to describe changes done in file - which you can see with diff anyway. If you commit per-change then commit messages tend to explain why the change has been done in the first place.
  • It is much easier to revert or merge changes/bugfixes.
  • It helps to organize your work better as you clearly focus on a single bug/feature/change you are working. You commit when you are done.

Some people think this policy produces more commits but from my experience you get less commits after all. For example, you are doing refactoring which affects 50 files. After refactoring you have a single commit with a message "Refactored xyz subsystem.".

For bigger changes you should consider dev-branch-per-change policy.

Vilmantas Baranauskas
This results in an awful lot of commits, or doesn't it?Can you name a source code control system which supports this kind of policy. All of the systems I know only support commit per file.
boutta
Yeah, it's a lot of commits. So long as they are genuine (http://thedailywtf.com/Articles/Productivity-20.aspx) that's not a problem @Vilmantas Baranauskas wants to ensure that he can track what the individual commits are for. It's a trade off.
Hamish Smith
Subversion supports it. E.g. you work on bug #123. To fix this bug you have to change 10 files. When you are done, on the root of the source tree you commit: svn commit -m "Fixed bug #123.". Modification of 10 files is commited as a single commit with a single message.
Vilmantas Baranauskas
That doesn't solve a problem I see. Say you work on Bug #1 and do something in file X. Now you have to work on Bug #2 wihtout having fixed Bug #1. You finish Bug #2. How can you now commit only the changes ob Bug #2? Or am I misunderstanding the concept or stretching too far?
boutta
I think it is bad idea to work on 2 bugfixes in parallel. Of course, if the bugs #1 and #2 are related, then fix them both and commit "Fixed bug #1 and #2: <insert something which describes both bugs here>."
Vilmantas Baranauskas
+5  A: 

The paper "streamed lines: branching patterns for parallel software development" is an excellent discussion on branching patterns such as the "main line" pattern you mention - it lists the options in the form of patterns together with discussion of anti-patterns. One of the authors is Robert Orenstein of Perforce.

Richard
A: 

Don't check-in/commit any changes that break a build.

Chris
+2  A: 

We use several practical rules as commit policy in our project. These rules help us to keep every revision in ready-to-deployment state. Our rules are similar to KDE commit policy, posted here: http://techbase.kde.org/Policies/SVN_Commit_Policy. Every commit should be (from higher to lower priority):

  • Successfully checked (compiled, tested, reviewed, FxCop'ed, etc.)
  • Atomic (should contain only one logical change, f.e. single bugfix, refactoring, etc.)
  • Non-redundant (no unused code should be added, do not commit commented code, delete it, do not commit accidentally format changes, etc)
  • Correctly and fully commented
  • Matched current development phase (for example no refactoring should be allowed in version support branches)
  • As small as possible to match previous rules.

We developed a simple tool SvnCommitChecker, witch helps us to check some of these rules before commit to svn. I plan to put it to sourceforge in near future with an article about benefits of keeping good svn change history.

Eugenek
+2  A: 

These two are basically the same:
Version Control for Multiple Agile Teams
Configuration Management Branching Strategy

We are using this strategy to make the trunk stable and enable developers do whatever they need on their branches.

There is some problem with Subversion since it can't handle Cyclic merges but it can worked around by deleting development branch after each reintegration back to the trunk (irrelevant for other version control systems)

Pini Reznik