44
The line with the "$Log$"-keyword begins with two "*" after which follows a space. KDiff3 uses the
first non-white-space string as "leading comment" and assumes that the history ends in the first line
without this leading comment. In this example the last line ends with a string that also starts with two
"*", but instead of a space character more "*" follow. Hence this line ends the history.
If history sorting isn't required then the history entry start line regular expression could look like this.
(This line is split in two because it wouldn't fit otherwise.)
\s*\\main\\\S+\s+[0-9]+ (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
[0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\s+.*
For details about regular expressions please see the
regular expression documentation by
Trolltech.
Note that "\s" (with lowercase "s") matches any white space and "\S" (with uppercase "S") matches
any non-white-space. In our example the history entry start contains first the version info with reg.
exp. "\\main\\\S+", the date consisting of day "[0-9]+", month
"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)" and year "[0-9][0-9][0-9][0-9]", the time
"[0-9][0-9]:[0-9][0-9]:[0-9][0-9]" and finally the developers login name ".*".
Note that the "leading comment"-characters (in the example "**") will already be removed by KDiff3
before trying to match, hence the regular expression begins with a match for none or more white-space
characters "\s*". Because comment characters can differ in each file (e.g. C/C++ uses other comment
characters than a Perl script) KDiff3 takes care of the leading comment characters and you should not
specify them in the regular expression.
If you require a sorted history. Then the sortkey must be calculated. For this the relevant parts in the
regular expression must be grouped by parentheses. (The extra parentheses can also stay in if history
sorting is disabled.)
\s*\\main\\(\S+)\s+([0-9]+) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)
([0-9][0-9][0-9][0-9]) ([0-9][0-9]:[0-9][0-9]:[0-9][0-9])\s+(.*)
The parentheses now contain 1. version info, 2. day, 3. month, 4. year, 5. time, 6. name. But if we want
to sort by date and time, we need to construct a key with the elements in a different order of
appearance: First the year, followed by month, day, time, version info and name. Hence the sortkey
order to specify is "4,3,2,5,1,6".
Because month names aren't good for sorting ("Apr" would be first) KDiff3 detects in which order the
month names were given and uses that number instead ("Apr"->"04"). And if a pure number is found it
will be transformed to a 4-digit value with leading zeros for sorting. Finally the resulting sort key for
the first history entry start line will be:
2001 04 0002 10:45:41 integration_branch_12 tom
For more information also see
Merge
Settings.
Navigation And Editing
Much navigation will be done with the scroll bars and the mouse but you can also navigate with the
keys. If you click into either window then you can use the cursor buttons left, right, up, down, page up,
page down, home, end, ctrl-home, ctrl-end as you would in other programs. The overview-column
next to the vertical scroll bar of the input files can also be used for navigating by clicking into it.
17