Added by Erik Drolshammer, last edited by Erik Drolshammer on Nov 16, 2009  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

How to choose VCS?

Since most projects are based on Maven, we are limited to using products supported by Maven. See SCM Overview .

Comparison between Bazaar, CVS, Git, Mercurial, Subversion might also be helpful.

Analysis of Git and Mercurial

Quickly revert a commit

  1. Find the revision number of the commit you want to revert.
    • svn log --limit 5
  2. Merge in the negation of the change set from that commit. To revert revision 7:
    • svn merge -c -7 .

Use Subversion post-commit hook to send out email

Why?
  • "Cheap communication" ,i.e. you absorb a lot of information with minimum effort
  • Covers some aspects of code and change review and control, since controversial commits are more easily detectable.
  • Train developers in VCS best practices. E.g. how to structure your commits and how detailed your commit messages should be.

The only disadvantage of implementing this tactic is increased email sending. This potential challenge is solved by sending email to an email list and setting up sane subjects, as this will allow easy filtering of the email.

How?
  • Make sure /usr/sbin/sendmail works.
  • Copy post-commit template
    cp ${repoPath}/hooks/post-commit.tmpl ${repoPath}/hooks/post-commit
    
  • Locate the commit-email.pl sample from the Subversion distribution
    commitScript=`find / -name commit-email.pl | grep hook-scripts`
    
  • Copy commit-email.pl sample
    cp ${commitScript} ${repoPath}/hooks/commit-email.pl
    
  • Modify ${repoPath}/hooks/commit-email.pl to use sendmail and not smtp. Additional recommended changes can be found in commit-email.pl.diff.
    @@ -47,8 +47,8 @@
     # You should define exactly one of these two configuration variables,
     # leaving the other commented out, to select which method of sending
     # email should be used.
    -#$sendmail = "/usr/sbin/sendmail";
    -$smtp_server = "127.0.0.1";
    +$sendmail = "/usr/sbin/sendmail";
    +#$smtp_server = "127.0.0.1";
    
  • Modify ${repoPath}/hooks/post-commit to execute commit-email.pl. A minimal version can be
    #!/bin/sh
    
    REPOS="$1"
    REV="$2"
    
    /path/to/repo/hooks/commit-email.pl "$REPOS" "$REV" mailing-list@example.org specific.user1@example.org specific.user2@example.org
    
  • Make both files executable
    chmod a+x ${repoPath}/hooks/{commit-email.pl,post-commit}
    
Resources

Note that the perl script in SVN has been deprecated in favor of the more powerful python mailer.py.

There is also an even more powerful tool available at http://opensource.perlig.de/svnmailer/ - however, it requires some python and python-svn bindings and seems a bit tricky to set up. If you have Ruby installed, the easiest thing to follow this recipe: http://blog.hungrymachine.com/2007/11/05/pretty-svn-commit-emails/

Avoid IDE specific files and such in the VCS repository

Why?

IDE specific files are seldom identical between environments (even though the same IDE is used) and change quite frequently.

How

Set up the repository to ignore these files. The following filter is a good starting point.

 
global-ignores = *.iml *.iws *.ipr target test-output activemq-data .classpath .project .settings *.o *.lo *.la ## ..rej *.rej .~ ~ .# .DS_Store

This can be done on the root folder of the project or globally for your client.

Client:

 vim /home/erik/.subversion/config 

global-ignores in Subversion documentation

All content on this wiki is licensed under a Creative Commons Attribution 3.0 Unported License.