第 3 章 使用 TortoiseMerge

目录

Viewing Modes
查看/合并
应用补丁
按钮及其他控制
Line Status Icons
合并/编辑冲突
打开文件
查看/合并
应用补丁
设置
常用设置页
颜色设置页

Viewing Modes

TortoiseMerge has three main viewing modes: one-pane, two-pane and three-pane view. One/two-pane view is used to view changes and three-pane view is used to resolve conflicts.

查看/合并

图 3.1. 单窗口方式

单窗口方式

图 3.2. 两窗口方式

两窗口方式

两窗口方式有单窗口方式不具备的一些特性:

  • 用不同的颜色来显示修改行。增加的部分使用浅色,当然你可以配置使用什么颜色。删除部分使用深褐色删除线显示。检查屏幕快照了解它们如何工作。

  • 代码重构经常意味着许多空白字符(空格,制表,新行)变化,但是没有实际上的代码改变。举例来说,你可以将一个很长的行拆分为几行,或者将几行合并为一行。

    这些改变在视图的左边用白色圆形符号标记。如果你看到了这些白色圆形,就立即知道这里没有实际代码改变,不需要进一步检查这个代码块

  • Hand editing of the file in the right pane is possible in two-pane view. Such changes are marked with a pencil symbol.

如果你要比较/合并三个文件,TortoiseMerge 将会使用三窗口方式显示差异。这个视图也用来解决冲突文件。

图 3.3. 三窗口方式

三窗口方式

The left pane shows you the differences between Their file and the Base file, while the right pane shows you the differences between Mine file and the Base file. The bottom pane shows you the result of merging Base, Mine and Theirs with possible conflicts.

If you hover the mouse over the pane title, a tooltip will show the filenames used for the diff in each pane.

应用补丁

After TortoiseMerge parses the patch file it will show you a small window with all the files which have changes according to the patch file.

图 3.4. Patch File List

Patch File List


If the filename is shown in black, then the patch can be applied without any problems. That means the file is not outdated according to the patch. However, if the filename is shown in red, then the patch can't get applied directly because you already changed that file.

But don't worry. If you're working with Subversion you can retrieve an older version of the file and resolve the conflict. In fact, TortoiseMerge automatically tries to get that older version of the file and then shows you the diff between Base (the older version of the file), Mine (the file as it is currently in your working copy) and Theirs (the older version of the file with the patch already applied). Then you can resolve possible conflicts manually.

The patch file window has a context menu which allows you to preview the effect of the patch on the current file (apply without saving), to apply and save the changes for the selected file, or to apply and save changes to all files in the list. The double-click action is to preview.

依赖于 TortoiseMerge 能直接使用补丁,或者先取出老版本文件,它显示双窗口视图(可以直接打补丁),或者显示三窗口视图(取出了老版本文件)。