Friday, July 27, 2012

SVN Modified File Checkins - Guidelines

In any software project development, we use configuration tools such as SVN, ClearCase etc for configuration management activities. We work on the project files and check in them back to configuration server after we are done working on those files. In a bigger projects, there will be thousands of source files that project members will be working on. The activities involved are checking out the source code, work on them and then check-in the modified project source files. Checking in huge number of modified files(Jar, EXE, DLL etc) is sometimes not an easy task if proper guidelines are not followed. Every check in has effect on the existing source base and often developers fail to realize the effect or realize it too late. In this short article, I am going to explain few guidelines while checking in the modified source files keeping SVN(Subversion) as example.
  •  Take an SVN update on all the source files that are potentially impacted by your local modifications.
  • While taking SVN upate, there are chances of merges being happened. The merges will sometimes be merged well with your changes or there can be conflicts. Resolve the conflicts manually and verify that your changes are appearing. Its best practice to keep a backup of all your modified files since conflicts can be confusing and you tend to revert your changes and freshly want to merge your changes using some tools called beyond compare etc.
  • Build all the project modules to verify that there are no compilation errors. 
  • If any error occurs (this could usually happen because SVN didn't merge correctly or some dependency between classes broke) then fix those errors and compile again
  • Once there are no compile errors commit your changes
The bove steps can also be automated by using SVN commands. The most used SVN command lines are as follows
  • svn update [Path to project files]
  • svn commit [Path of the file(s) to commit> --message <commit comment]
  • svn resolve --accept=ARG [PATH...]
  • svn resolve [Path of file(s) to revert]
  • svn checkout checkout URL[@REV]... [PATH]
  • svn add [Path of files to add]  - Adds non version-ed files to subversion
  • svn log [Path of the file location or revision] - Shows the log messages for a set of revision(s) and/or file(s) 
  • svn status [Path] - This can be used to print the status of local files or files in the repository.
Furthermore you can also integrate your batch file or ant script with your IDE. In eclipse,
  • Go to Run->External Tools->External Tools Configurations.
  • Create a new Ant build for ant scripts or Program for your batch file
  • Point to your ant script or batch file. Click Apply and then click Run.
  • The external tool will now appear in the Run->External Tools->External Tools Configurations menu.
 For a complete guidelines on Configuration Management, visit Configuration Management Best Practices.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...