Trac Changeset Module

Trac 拥有一个内置的功能进来对文件的不同和修改可视化显示。

Trac has a built-in functionality for visualizing diffs - changes to files.

The Changeset View

当查看一个提交的修改集,例如点击修改集 TracLink 或在 timeline上的修改集事件行上点击时,Trac将显示造成这种修改的补丁集合。

修改集视图由两部分组成,headerdiff view

When viewing a commited changeset, such as when clicking a changeset TracLink or a changeset event-line in the timeline, Trac will display what changes this current set of patches imposes.

The changeset view consists of two parts, the header and the diff view.

Changeset Header

头(header)显示了整个修改集的概述。在这里你可以发现这样的信息:

  • Timestamp -- 何时修改集被提交
  • Author -- 谁提交的修改集
  • Message -- 来自作者的简短描述(提交的日志消息)
  • Files -- 本次修改集所影响的文件列表

在每一个列出的文件前面你会发现带颜色的方块。颜色指示修改集对这个文件有什么影响。

  • 绿色: 增加
  • 红色: 删除
  • 黄色: 修改

颜色图例说明作为一个提醒显示在头的下面。

The header shows an overview of the whole changeset. Here you will find information such as:

  • Timestamp -- When the changeset was commited
  • Author -- Who commited the changeset
  • Message -- A brief description from the author (the commit log message)
  • Files -- A list of files affected by this changeset

In front of each listed file, you'll find a colored rectangle. The color indicates how the file is affected by the changeset.

  • Green: Added
  • Red: Removed
  • Yellow: Modified

The color legend is located below the header as a reminder.

Diff View

在头的下面是修改集的主要部分--差异视图。每个文件被显示在一个分离的区域,每个区域只包含被修改集影响的文件的内容。有两种不同的显示差异的的风格:inlineside-by-side(你可以使用参数表单(preferences form)在这两种风格间进行切换)。

  • inline风格显示文件的改变部分在文件名的下面。一块内容从文件中删除将显示为红色,增加的部分将显示为绿色。如果一块内容被修改,则旧的版本显示在新版本的上面。在左侧的行号指明修改在文件旧版本和新版本的确切位置。
  • side-by-side风格将旧版本显示在左边,新版本显示在右边(这样将需要比 inline 风格更宽的屏幕)。新增和删除的内容将按照与inline风格一样的方式显示颜色(分别为绿色和红色),但修改的内容将有一个黄色的背景。

另外,在参数表格中有多种高级选项可以用来调整差异的显示:

  • 你可以设置在每个修改之前和之后显示多少行
  • 你可以切换是否空行、大小写改变和空白改变被忽略,以便让你找到功能性的修改更迅速

Below the header is the main part of the changeset, the diff view. Each file is shown in a separate section, each of which will contain only the regions of the file that are affected by the changeset. There are two different styles of displaying the diffs: inline or side-by-side (you can switch between those styles using the preferences form):

  • The inline style shows the changed regions of a file underneath eachother. A region removed from the file will be colored red, an added region will be colored green. If a region was modified, the old version is displayed above the new version. Line numbers on the left side indicate the exact position of the change in both the old and the new version of the file.
  • The side-by-side style shows the old version of the left and the new version on the right (this will typically require more screen width than the inline style.) Added and removed regions will be colored in the same way as with the inline style (green and red, respectively), but modified regions will have a yellow background.

In addition, various advanced options are available in the preferences form for adjusting the display of the diffs:

  • You can set how many lines are displayed before and after every change
  • You can toggle whether blank lines, case changes and white space changes are ignored, thereby letting you find the functional changes more quickly

See also: TracGuide, TracBrowser