谁修改了哪一行?
有时你不仅要知道哪一行做了修改,还要精确地知道谁修改了一个文件中的哪一行。这就是TortoiseSVN → 追溯…命令,有时候也叫做 评注 命令派上用场的时候了。
对一个文件中的每一行,这个命令列出了作者和该行修改时的版本。
追溯文件
图 4.62. 评注/追溯对话框
如果对早期版本的修改不感兴趣,你可以设置从哪个版本开始追溯。如果你想追溯每一个版本,你可以把那个数值设置为1
。
默认情况下追溯文件是使用 TortoiseBlame 来查看,突出显示不同的版本以使其更易于阅读。如果你想打印或者编辑追溯文件,选择 使用文本查看器查看追溯文件。
你可以指定处理行结束符和空白改变的方法。这些选项在 “行结束符和空白选项”一节
You can include merge information as well if you wish, although this option can take considerably longer to retrieve from the server. When lines are merged from another source, the blame information shows the revision the change was made in the original source as well as the revision when it was merged into this file.
Once you press OK TortoiseSVN starts retrieving the data to create the blame file. Once the blame process has finished the result is written into a temporary file and you can view the results.
图 4.63. TortoiseBlame
TortoiseBlame,包含在TortoiseSVN中,使得追溯文件更加容易阅读。当你的鼠标在追溯信息列的某一行上盘旋时,所有和该列具有相同版本号的行都会用一个比较暗的背景色显示。同一作者修改的其他版本的行会用一个亮一些的背景色显示。如果你的显示设置为256色模式,那么颜色显示的可能不会很清楚。
如果在某一行上左击,具有同一版本号的所有行都会高亮显示,同一作者的其他版本的行会用一个更亮的颜色高亮显示。这个高亮具有粘性,也就是说允许你移动鼠标但原先高亮的地方仍然保持高亮。再次点击该版本将关闭高亮显示。
只要鼠标逗留在追溯信息列,版本注释(日志信息)就会作为提示出现。如果你想复制此版本的日志信息,使用在追溯信息列显示的右键菜单。
你可以在追溯报告里用编辑 → 查找…来搜索想要的内容。它允许你搜索版本号,作者还有文件的内容。这个搜索不包含日志信息-你可以在日志对话框里搜索日志信息。
你也可以使用 编辑 → 转到行 … 来跳到指定行。
当鼠标滑过追溯信息列时,有个上下文菜单可以帮助你比较版本和检查历史,它用鼠标下方行的版本号作为参考版本。上下文菜单 → 追溯以前版本产生同一个文件的追溯报告,它使用以前的版本作为上限,给出了你看到最后修改之前的文件状态追溯报告。上下文菜单 → 显示修改启动差异察看器,显示在参考版本中的修改。上下文菜单 → 显示日志从参考版本开始显示版本日志。
如果您需要对最早和最新变化之处有一个更好的视觉指示,选择 View → Color age of lines。这将使用一个颜色渐变来显示新行为红色、旧行为蓝色。默认着色很浅,但你可以使用 TortoiseBlame 设置来改变它。
If you are using Merge Tracking and you requested merge info when starting the blame, merged lines are shown slightly differently. Where a line has changed as a result of merging from another path, TortoiseBlame will show the revision and author of the last change in the original file rather than the revision where the merge took place. These lines are indicated by showing the revision and author in italics. The revision where the merge took place is shown separately in the tooltip when you hover the mouse over the blame info columns. If you do not want merged lines shown in this way, uncheck the Include merge info checkbox when starting the blame.
If you want to see the paths involved in the merge, select View → Merge paths. This shows the path where the line was last changed, excluding changes resulting from a merge.
The revision shown in the blame information represents the last revision where the content of that line changed. If the file was created by copying another file, then until you change a line, its blame revision will show the last change in the original source file, not the revision where the copy was made. This also applies to the paths shown with merge info. The path shows the repository location where the last change was made to that line.
TortoiseBlame 设置可以使用 TortoiseBlame 选项卡上的 TortoiseSVN → 设置… 来访问。请参阅 “TortoiseBlame 的设置”一节
追溯不同点
One of the limitations of the Blame report is that it only shows the file as it was in a particular revision, and the last person to change each line. Sometimes you want to know what change was made, as well as who made it. If you right click on a line in TortoiseBlame you have a context menu item to show the changes made in that revision. But if you want to see the changes and the blame information simultaneously then you need a combination of the diff and blame reports.
在版本日志对话框里包含了以下几个选项支持你做这样的操作。
- 追溯版本
在顶部窗口,选择两个版本,然后选择上下文菜单 → 追溯版本。它将取出两个版本的追溯数据,然后使用差异察看器比较这两个追溯文件。
- 追溯修改
在上面的面板里选择一个版本,然后在下面的面板选择一个文件然后选择右键菜单 → 追溯改变。这会为选定版本及其上一个版本获取追溯数据,然后用差异阅读器比较两份追溯文件。
- 与工作副本比较并追溯
为一个单一文件显示日志,在上面的面板选择一个版本,然后选择上下文菜单 → 与工作副本比较并追溯。这会为文件的选择版本和工作副本获取追溯数据,然后使用差异阅读器比较两份追溯文件。