September 6, 2007

Using Guiffy's Folder Compare

Surround SCM
Guiffy is the integrated tool provided with Surround SCM that is used for viewing differences and merging of text files. A nice feature provided by Guiffy is the ability to compare two folders. This allows you to select any two folders and compare them recursively. You can also drill down to a specific file and view differences of this file between the two folders.

Applications with Surround SCM

With Surround SCM, this gives you the ability to compare a repository between two moments in time, or timestamps. This could also be used to compare branches only if you do not want to compare the latest version of the files in either of the branches. If you use labels (if you do, you should read this article), you can use this feature to compare between two labels recursively. The main idea here is that you have to do two separate gets, each to a separate directory (or "locations"). Then you will select these two folders in Guiffy's folder compare. Each get will be based on a different timestamp, label, or even different "last version to be in the following state" (maybe you want to compare the last "reviewed" files versus the current "in progress" files). Figure 1 illustrates the various options you can select when doing a recursive get, including the Browse button that allows you select a different location for the get.

Figure 1 - Get Options

A Simple Example

For this example we are going to compare a repositories between two moments in time. Let's say it's the end of the week and I want to view difference between the files last Friday and today (a week later). Please note that this will not list every single change that has taken place this week. For a detailed report on every change that took place, including the time, user, comments, etc., you should then use the Surround SCM reports. The first step is to do a get to one location. For this I am going to create a folder named "Folder Old" and select a timestamp of "08/25/2007". The get dialog is shown below in Figure 2.
Figure 2 - Get Dialog
The second step is to do a get to the second location using a different timestamp. For this I will use a timestamp of "08/31/2007". The get dialog is shown in Figure 3.
Figure 3 - Get Dialog
Now that I have the files in the folders I want, I need to open Guiffy. Guiffy is an integrated application, so it can not be opened as a separate application by itself. To open Guiffy, you must do differences.
Figure 4 - Differences menu option
For this example, I pick a file that has two versions, and I will diff between the server version (version 2) and a historical version (version 1).
Figure 5 - Differences Options
It really does not matter which file or which versions you pick. We are only doing this to start Guiffy. Once Guiffy starts, you may want to select Options > Folder Show.... There you can tell Guiffy to only show files that have changed. This will unclutter the view and only display files that are different. Here you can also select an option to automatically display all the subfolders. This will save you time, so you don't have to go folder by folder, expanding each one.
Figure 6 - Folder Show Options
Now that we have set our options, we are ready for the compare. Select File > Open&Compare Folders..., and then browse to each folder as shown in the Figure 7.
Figure 7 - Folder Compare Open window
Now that we have our folders selected, click the Compare button and there you go.
Figure 8 - Folder Compare
You can then double-click on a specific file for Guiffy to display the line by line differences of the specified file. Notice that Guiffy only expanded those folders that have different files. Setting the "Folder Show..." options as mentioned above will really save you time and is highly recommended.

Other Uses

As mentioned, this application of the Guiffy folder compare is not limited to using timestamp. You can also do gets based on the other options provided. A get from separate branches is also an option, although it only makes sense for comparing non-current versions of files. Branch Differences is a better tool for comparing the latest version of two branches. Comparing Two Changelists - Another application of Guiffy's folder compare feature is to compare two changelists. In the Changelists management window in Surround SCM (Tools > Changelists), you can do a get of a committed changelist. However, the get will place the files in the working directory. You cannot select a different location for the get. This means that a couple more steps are required, namely, changing the working directory before each get. Before you get changelist "A", change the working directory to folder "A". Before you get changelist "B", change the working directory to folder "B". Then change the working directory back to what it originally was. Keep in mind that since it is doing a get to a working directory, it will also place a .MySCMServerInfo file in every folder and subfolder.