Folder Alignment Overrides
Introduction
Alignment override filters determine how files and/or folders from two sides of a folder comparison are matched, or aligned. By default DeltaWalker aligns files and folders by their names, that is for two resources to be compared their names need to be the same. For example, a file named data.txt in first/left panel can only be compared to a file named data.txt
Oftentimes however there's a need to align and compare resources with different names, for example data.txt with data.log. Entrer Alignment Overrides.
Usage
To create a new alignment override filter go to Filters Preference Page and select New->Alignment Override:
In the Add New Filter dialog type in the expressions to do the name matching. For example, adding *.log for the first resource name and *.txt for the second resource name tells the folder comparison engine to ignore the file extensions when matching files with extensions .log and .txt. The following before and after screenshots illustrate the result:
Before, with no alignment override filter.
After, using the above described alignment override filter:
Use the Apply to folders field to specify one or more folders this alignment override should be applied to. If you are working with large folder hierarchies, specifying apply to folders can greatly speed up the overall folder comparison performance.
Expressions
As with the include/exclude folder comparison filters, both shell, and the more powerful and complex, regular expression filters can be used.
A shell expression can use the following special characters:
? matches any single character once. For example test??.log will match any name which starts with "test", then has 2 other characters and ends with ".log" e.g. test12.log, testAZ.log, but not testA.log
* matches any character zero or more times. For example test*.log will match any name which starts with "test", then has any characters and ends with ".log" e.g. test1.log, testMyFile.log, even test.log, but not test.logs
Alignment override filters can be made more powerful by using regular instead of shell expressions. The purpose of an alignment override filter is to match two strings, specifically the names of two file system resources, using two regular expressions. To achieve that it uses a special, proprietary pattern object referred to as a dual pattern. A dual pattern is a pattern that matches 2 strings using 2 regular expressions - primary and secondary.
The first regex is named primary, because the second refers to it. The second is named secondary because it references/refers to the first one. The type of referencing presently supported is Group referencing i.e. making a reference in the secondary pattern to a group from the primary pattern.
For example if test(\d).txt is the primary and test($1).log is the secondary expression, ($1) is a reference in secondary regex to 1-st group in the primary. This will align files test1.txt with test1.log, test2.txt with test2.log, etc.
Examples
Left | Right | Regex | Effect |
---|---|---|---|
sample.txt | sample.log | No | Aligns "sample.txt" with "sample.log |
*.txt | *.log | No | Aligns files with extension "txt" to files with extension "log" e.g. "file1.txt" -> "file1.log", "readme.txt" -> "readme.log", etc. |
start*.htm | index*.html | No | Aligns files with prefix "start" and extension "htm" to files with prefix "index" and extension "html" e.g. "start_page1.htm" -> "index_page1.html", "start_help.htm" -> "index_help.html", etc. |
Log_(\d+)\.log | ($1)\.txt | Yes | Aligns file names beginning with "Log_" followed by at least one digit, ending with extension "htm" with file names without the "Log_" prefix followed by the same digits as in first file name and ending with extension "txt". For example: "Log_20120616.log" -> "20120616.txt", "Log_20120617.log" -> "20120617.txt", etc. |