Tag Archive for svn

Automating SVN

Last week we went over the basics of SVN. This week we are going to talk about saving some time by automating your SVN processes.

To automate your SVN process you can either create scripts to launch your SVN client of choice or you can program your own SVN client.

Automating TortoiseSVN

If you are using TortoiseSVN there are command line parameters you can send to the client to automate many of the SVN processes. If you are using another SVN client you will need to check what command line parameters it supports.

Details on the TortoiseSVN Commands can be found at http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-automation.html

Making your Own SVN Client

Why would you want to spend time making an SVN client when there are so many out there?

Well for starters in order to automate the SVN processes using the Client Commands, that client needs to be installed on that computer. Do you want to be installing SVN clients everywhere?

Another draw back to the TortoiseSVN Commands is that it only opens the appropriate screen and does not complete the action for you. If you send the branch command it will open the branching window and populate all of the information you sent, but you still have to enter a comment and click the button on the screen. That’s usually not the level of automation I want.

Here is where the old saying “If you want something done right, you’ve got to do it yourself” comes into play.

You can create your own SVN Client using the SharpSVN API available through http://sharpsvn.open.collab.net/ .

Which to Use and When?

Both options have there benifits. While they might not be as powerfull as the API, it can be a lot quicker to create a batch script that launches your SVN client.

Personally, I have been using a mixture of the two. I automated processes for things like checking out, exporting and branching through the SharpSVN API, while the processes for committing changes I do through TortoiseSVN Commands. The process for commiting can get complicated and this is also the one area that I typically want the UI to come up, so I can see what files were changed.

SVN Tools – Getting Started with Source Control

This week we are going back to basics and talking about an important topic for any type of developer, Source Control Management.

What is SVN?

SVN is a common abbreviation used by programmers for Subversion. It is a repository where code and other files can be stored. Both the current version as well as historical copies of previous versions are stored within this repository.

Basic SVN Commands

  • Add
  • Checking Out
  • Update
  • Commit

When you start out with SVN you will need to use the “Add” command to create a new folder or “Add” a file. If you are working with an existing repository, you can use the “Check Out” command to make your own copy of a folder from SVN. If changes are made to the SVN folder after you check it out you can use the “Update” command to sync your local copy of the folder with what is now in SVN. After you have made your changes you will want to check them back into SVN using the “Commit” command.

Commit Small and Often

When you start out with SVN it is easy to get into the habit of checking in all of you code changes at once. If you lump all of your days or weeks changes together it makes it much harder to manage the code. To get the most out of SVN you will want to check in smaller more logical chunks of code. If you make a bug fix in the code check that individual bug fix in with its own commit, don’t let your changes build up.

Advanced SVN Commands

  • Branch – Creates a copy of a
  • Merge
  • Diff

SVN is more than just a backup system for your files. It allows a team or a single developer to track and manage changes they have made to the code base. You can create copies or “Branches” of your project, allowing you to develop and test new features before intergrating or “Merging” them back into your main code or “Trunk”. Multiple branches are supported so developers can independently work on adding features to the same project. When your changes are ready to be merged back into the trunk you can view all of the changes between two versions of the code using the “Diff” feature.

SVN Software

There are a number of SVN servers and even more clients. Here is a SVN Server and Client that I recommend you give a try if you are new to SVN.

If you are working with a team, you will want to check what software they may already be using. As you would not want to setup another SVN environment, if there is already one in use.

VisualSVN – SVN Server

Visual SVN is an easy to use and fully functional SVN server built for the Windows Platform.

Visual SVN Server is available at http://www.visualsvn.com/server/ . Once you have downloaded and installed the Visual SVN Server check out the Getting Started section of their website for details on configuring your SVN Server.

TortoiseSVN – SVN Client

TortoiseSVN is an easy to use SVN Client for Windows machines. It gives you a nice UI so you don’t have to be typing out commands. It even hooks into the file explorer, so you can quickly check in changes.

TortoiseSVN is available at http://tortoisesvn.net/ .

Here is a quick video to get you started with TortoiseSVN.

For more information on using TortoiseSVN Client check out the tutorial at http://www.igorexchange.com/node/87 .

Other Flavors of Source Control

SVN is not your only choice for version control like Mercurial, CSV or Perforce. A couple of note for CRM Developers are:

Team Foundation Server (TFS)

As many Dynamics CRM Developers work for Microsoft Shops, a talk about source control would not be completed without mentioning Microsoft’s application lifecycle management solution called Team Foundation Server (TFS). TFS is more than just source code management and includes Work Item Tracking, Build Automation, Reporting and Project Management.

If you are looking to create a collaborative and agile team you should take a look at implementing Team Foundation Server.

TFS is not a quick install and your done deal, it is a change in the way of life for your developers, testers and project managers. You wouldn’t just install CRM for a sales team and walk away thinking that they will suddenly become this well oiled sale closing machine because you have installed a great program for them to use. There is a lot of up front time investment to get your team off the ground with TFS, but the investment can payoff in the long run.

GIT

Unlike most other source code management systems GIT creates a local repository on your machine. As needed you can update your repository by “pulling” down the latest version from a remote repository. If you have changes you would like to have added to the remote repository you can “Push” them up to the server. This pushing and pulling concept has made GIT widely used with the Open Source Community.

With other source control systems you are connecting directly with a central repository server every time you check code out or commit changes. This can be a problem if you are disconnected from the network. If you spend the day out of the office working on your laptop you have to wait until you get an internet connection before you can check in your changes.

You can download GIT through http://git-scm.com/ . Their site also has some great information in the Documentation section to get you started with GIT and source control.

GitHub

GitHub is a hosting provider for GIT repositories. They offer free hosting for Open Source projects, and you will find that many open source projects have taken them up on this offer.

The recently released a windows client, which you can download from http://windows.github.com/ . As an added bonus the client is built using the Metro UI, so

 

 

CRM Tool of The Week – Solution Packager

R8 has many new exciting features like CRM Mobile and Cross-Browser Support. However, what I have been most anticipating since Convergence 2012 was not a feature from Rollup 8 but one of the tools that will be released in the updated SDK called the Solution Packager. 

What is the Solution Packager?

 The solution packager is a command line tool that lets you pack and unpack a solution zip file. The unpacking goes beyond just unzipping the file into the handful of files contained in a solution. It extracts components at a granular level creating a file for each form, view and web resource.

What is So Great About the Solution Packager?

The Solution Packager offers a new level of code management for Solutions.

Before it was very hard to effectively manage the code changes to your CRM Solutions. You may have been checking your solition files into SVN, so your solution files would be backed up and could easily rollback to previous versions. But it was pretty futile to try and do a diff on two versions of a solution file or try and merge two branches.

Now with the Solutions Packager we can break the big unmanagable solutions files into smaller chunks that are easier to swallow. After unpacking the solutions and comparing them it’s much easier to tell what has changed, so we know to merge them or throw them out.

Downloading the Solution Packager 

The Solution Packager is due to be released in an update to the SDK in the Spring/Summer of 2012. However, I was very happy when I downloaded the Rollup 8 Beta files and saw that one of them was for the Solution Packager.

The Rollup 8 Beta is available through the Connect Website. Take a look at Girish’s article on downloading the beta at http://blogs.msdn.com/b/girishr/archive/2012/05/09/microsoft-dynamics-crm-2011-ur9-a-k-a-r8-beta-is-here.aspx . Once you get to the Download screen you will see one of the files you can download is Dynamics CRM Solution Packager.

Using the Solution Packager

The Solution Packager is a command line tool. You will need open the command prompt by going to Start>Run>cmd . Then use the cd command to switch to the directory where you saved the SolutionPackager.exe file. You can then use the commands below to pack or unpack a solution.

Extract Command to unpack a solution

The following commands will Extract the solution zipfile c:\Solutions\Default_1_0.zip to the folder c:\Solutions\Default_1_0
Full Command
solutionpackager.exe /action:Extract /zipfile:c:\Solutions\Default_1_0.zip /folder:c:\solutions\Default_1_0
Shorthand Command
solutionpackager.exe /a:Extract /z:c:\Solutions\Default_1_0.zip /f:c:\solutions\Default_1_0

Pack Command to package a solution back up

The following commands will Package the contents from c:\Solutions\Default_1_0 back into a zipfile called solution zipfile c:\Solutions\Default_1_0.zip
Full Command
solutionpackager.exe /action:Pack /zipfile:c:\Solutions\Default_1_0.zip /folder:c:\solutions\Default_1_0
Shorthand command
solutionpackager.exe /a:Pack /z:c:\Solutions\Default_1_0.zip /f:c:\solutions\Default_1_0

Other Command Parameters

There are some additional Optional Parameters you can user including:

  • /packagetype {Unmanaged|Managed|Both}
  • /safe
  • /clobber
  • /errorlevel {Off|Error|Warining|Info|Verbose}
  • /log

A full list of the command line commands is available in the ReadMe document that is part of the download.