Visual Studio Orcas March 2007 CTP - Folder Difference - Part 2

 

Let us start with the Folder Difference invocation. Both Power Toy TreeDiff and Orcas Folder Difference support command line invocation as well as from the Source Control Explorer in Visual Studio.

 

Starting from the Command Line

 

In the Orcas CTP, Folder Difference is integrated into tf.exe with command folderdiff or treediff (as a command alias).

 

>tf folderdiff /?

 

TF - Team Foundation Source Control Tool

(C) Copyright 2007 Microsoft Corporation. All rights reserved.

 

Displays a visual representation of the differences between files in two server

folders, in a server folder and a local folder, or in two local folders.

 

tf folderdiff [sourcePath] targetPath [/recursive] [/noprompt]

              [/server:serverName:port] [/filter:filter]

              [/filterLocalPathsOnly]

              [/view:view]

 

The new options are:

/filter:filter

/filterLocalPathsOnly

/view:view

 

Option /filter:filter

Semicolon delimited list of inclusion and exclusion filter masks. Default is “*” (include all). See "File and Folder Filter" below.

 

Option /filterLocalPathsOnly

If this parameter is specified, only the local paths will be filtered, unless the corresponding server path exists. If not specified, the filter is applied to both server and local paths.

 

Option /view:view

This option tells Folder Difference what files to show in the result window. The option is comma-separated list of the following values:

 

Same

files with the same content in both source and target directories will be included

Different

files with different content in both source and target directories will be included

SourceOnly

files that exist only in source directory will be included

TargetOnly

files that exist only in target directory will be included

 

The default is “/view:Different,SourceOnly,TargetOnly” which lists only the files that are different or missing.

 

File and Folder Filter

A filter is an ordered list of name masks that are used to match the name of files and folders to be compared.

 

Each mask can contain the wildcard characters ? and *. ? matches exactly one character and * matches zero or more characters. The masks in a filter are delimited by semicolons (;). Folder masks must end in backslash (\). To specify an exclusion mask, prefix the mask with an exclamation mark (!).

 

The filter is applied to the file and folder names using the following rules:

  • When both file and folder masks are specified together in a filter, the file masks are separated into a file mask list and the folder masks are separated into the folder mask list. File masks are only applied to file names. Folder masks are only applied to folder names.
  • When a file/folder name is being matched, the name is compared to each mask in the filter in the order that was specified. As soon as the name matches a mask, the name is considered to be a match.
  • If the file masks in the filter contains an inclusion mask, files that do not match any of the file masks are excluded.
  • If the file masks in the filter contains only exclusion masks, files that do not match any of the file masks are included.
  • If the folder masks in the filter contains an inclusion mask, folders that do not match any of the folder masks are excluded.
  • If the folder masks in the filter contains only exclusion masks, folders that do not match any of the folder masks are included.

 

Here are some examples:

*.cs;!objd\;!obj\;!bin\

Matches all C# files and excludes objd, obj, and bin directories

!*.resx;!*.ini;!resources\;!*junk*\

Excludes all resx and ini files as well as the resources folders and those having "junk" in the name

 

 

Starting from Visual Studio

 

Folder difference can be started from various location in Visual Studio.

  • From the Source Control Explorer context menu on the folder tree or file list
  • From the Source Control Explorer toolbar
  • From File > Source Control > Compare

 

Note that the Compare menu item is context sensitive. A file comparison dialog will be presented for file selection and a folder comparison dialog will be presented for folder selection.

 

 

 

 

 

That's it for this installment of Orcas CTP Folder Difference. Next time, we'll talk about changes in the Visual Studio integration which will include the new folder compare dialog and the results window.

-Tan