对于每次进行修改和提交,你应该有针对性地留下日志信息。这样,你就可以在以后方便地看到你都做了什么,为什么这么做。当然这么做还是你拥有了开发过程的详细日志。
版本日志对话框可以获取所有的日志信息,并将其显示出来。对话框的视图分成3个面板。
最上方的面板显示了版本的列表。这其中包含了日期和时间,以及提交的用户和日志信息开头的部分内容。
以蓝色显示的行表示某些内容被复制到该开发版本中(可能是从一个分支中复制而来)。
中间的面板显示了被选中的版本的完整的日志信息。
最下面的面板显示了被选中版本中都对哪里文件和文件夹进行了修改。
当然,对话框的作用不止于此——它提供了右键菜单,通过它可以获取更多的项目历史信息。
有几种途径可以调出日志对话框:
从右键菜单的TortoiseSVN子菜单中调用
从属性页中调用
在更新结束后,从进度对话框中调用。在这里,日志对话框只显示你上一次更新以来的版本变化。
If the repository is unavailable you will see the Want to go offline? dialog, described in “离线方式”一节.
顶部面板有个动作列,包含了此版本的动作概要图标。有四个不同的图标,每个都在自己的列显示。
If a revision modified a file or directory, the modified icon is shown in the first column.
If a revision added a file or directory, the added icon is shown in the second column.
If a revision deleted a file or directory, the deleted icon is shown in the third column.
If a revision replaced a file or directory, the replaced icon is shown in the fourth column.
The top pane of the Log dialog has a context menu that allows you to access much more information. Some of these menu entries appear only when the log is shown for a file, and some only when the log is shown for a folder.
将你的工作版本与选中的版本进行比较。默认的比较工具是与TortoiseSNV一同发布的TortoiseMerge,如果日志对话框是针对文件夹的,那么就会出现一个被修改的文件的列表,你可以单独地查看每个文件所做的修改。
追溯选中的版本,和你的工作基础文件,使用可视化差异工具比较追溯报告。参阅 “追溯不同点”一节 以获得更多信息(仅对于文件)。
将选中的版本作为单一差异文件(GNU补丁格式)查看。相对于可视化的文件比较器,它更难阅读,但它将所有的变化显示在一个格式更为紧凑的文件中。
Compare the selected revision with the previous revision. This works in a similar manner to comparing with your working copy. For folders this option will first show the changed files dialog allowing you to select files to compare.
Show the changed files dialog allowing you to select files. Blame the selected revision, and the previous revision, and compare the results using a visual diff tool. (folders only).
将选中的版本保存到文件,你可以得到一份该文件的旧版本(仅对于文件)。
用此文件类型的默认查看器,或你指定的程序打开选中的文件(仅对于文件)。
追溯文件直到选中的版本(仅对于文件)。
打开版本库浏览器,基于选中的版本,在版本库中检查选中的文件或目录。
Create a branch or tag from a selected revision. This is useful e.g. if you forgot to create a tag and already committed some changes which weren't supposed to get into that release.
Update your working copy to the selected revision. Useful if you want to have your working copy reflect a time in the past, or if there have been further commits to the repository and you want to update your working copy one step at a time. It is best to update a whole directory in your working copy, not just one file, otherwise your working copy could be inconsistent.
If you want to undo an earlier change permanently, use Revert to this revision instead.
Revert to an earlier revision. If you have made several changes, and then decide that you really want to go back to how things were in revision N, this is the command you need. The changes are undone in your working copy so this operation does not affect the repository until you commit the changes. Note that this will undo all changes made after the selected revision, replacing the file/folder with the earlier version.
If your working copy is in an unmodified state, after you perform this action your working copy will show as modified. If you already have local changes, this command will merge the undo changes into your working copy.
What is happening internally is that Subversion performs a reverse merge of all the changes made after the selected revision, undoing the effect of those previous commits.
If after performing this action you decide that you want to undo the undo and get your working copy back to its previous unmodified state, you should use → from within Windows Explorer, which will discard the local modifications made by this reverse merge action.
If you simply want to see what a file or folder looked like at an earlier revision, use Update to revision or Save revision as... instead.
Undo changes from which were made in the selected revision. The changes are undone in your working copy so this operation does not affect the repository at all! Note that this will undo the changes made in that revision only; it does not replace your working copy with the entire file at the earlier revision. This is very useful for undoing an earlier change when other unrelated changes have been made since.
If your working copy is in an unmodified state, after you perform this action your working copy will show as modified. If you already have local changes, this command will merge the undo changes into your working copy.
What is happening internally is that Subversion performs a reverse merge of that one revision, undoing its effect from a previous commit.
You can undo the undo as described above in Revert to this revision.
Merge the selected revision(s) into a different working copy. A folder selection dialog allows you to choose the working copy to merge into, but after that there is no confirmation dialog, nor any opportunity to try a test merge. It is a good idea to merge into an unmodified working copy so that you can revert the changes if it doesn't work out! This is a useful feature if you want to merge selected revisions from one branch to another.
检出你选择的目录的选中版本,创建一个全新副本。它弹出对话框,让你确认URL和版本,并且选择保存的位置。
导出选择的文件/目录的选中版本。它弹出对话框,让你确认URL和版本,选择导出位置。
编辑之前提交时的日志信息或是作者。请阅读“修改日志消息和作者”一节,了解其工作原理。
View and edit any revision property, not just log message and author. Refer to “修改日志消息和作者”一节.
将选中版本的详细日志信息复制到剪贴板。它会复制版本号,作者,日期,日志信息,以及每个版本的改变项目列表。
在日志信息中搜索你输入的的文字。这个操作搜索日志信息,也搜索由Subversion建立的提交行为总结(最底部的面板中的内容)。搜索大小写无关。
如果你使用Ctrl组合键一次选中了两个版本,右键菜单有所改变:
使用可视化差异比较工作比较两个选中的版本。默认的比较工作是与TortoiseSVN一起提供的TortoiseMerge。
如果你是针对文件夹选中这个选项,则会弹出一个对话框列出修改过的文件,提供了更多的差异比较选项。请参考比较版本对话框获得详情: “比较文件夹”一节。
Blame the two revisions and compare the blame reports using a visual difference tool. Read “追溯不同点”一节 for more detail.
使用单一差异文件显示差异。这对文件和文件夹都有效。
如前所述将日志消息复制到剪贴板。
如前所述可以搜索日志消息。
If you select two or more revisions (using the usual Ctrl or Shift modifiers), the context menu will include an entry to Revert all changes which were made in the selected revisions. This is the easiest way to rollback a group of revisions in one go.
You can also choose to merge the selected revisions to another working copy, as described above.
If all selected revisions have the same author, you can edit the author of all those revisions in one go.
日志对话框的底部面板也有右键菜单,你可以:
Show changes made in the selected revision for the selected file. This context menu is only available for files shown as modified.
Blame the selected revision and the previous revision for the selected file, and compare the blame reports using a visual diff tool. Read “追溯不同点”一节 for more detail.
Show file changes in unified diff format. This context menu is only available for files shown as modified.
用默认查看器或你指定的程序打开选中文件的选中版本。
Opens the Blame dialog, allowing you to blame up to the selected revision.
还原选中文件的选中版本所作的变更。
查看选中项的Subversion属性。
显示选中的单个文件的版本日志。
Show the revision log for the selected single file, including merged changes. Find out more in “合并跟踪特性”一节.
将选中的版本保存成文件,你可以得到一份该文件的旧版本。
你可能会注意到,我们有时候说改变,有时候说差异。它们的区别在哪儿?
Subversion uses revision numbers to mean 2 different things. A revision generally represents the state of the repository at a point in time, but it can also be used to represent the changeset which created that revision, eg. “Done in r1234” means that the changes committed in r1234 implement feature X. To make it clearer which sense is being used, we use two different terms.
如果你选择了两个版本 N 和 M,上下文菜单会显示这两个版本的差异。用 Subversion 术语说,就是diff -r M:N。
如果你选择了一个版本 N,上下文菜单会显示这个版本的改变。用 Subversion 术语说,就是diff -r N-1:N 或 diff -c N。
The bottom pane shows the files changed in all selected revisions, so the context menu always offers to show changes.
日志对话框并不总是显示所有曾经的修改,日志不显示的可能原因如下:
For a large repository there may be hundreds or even thousands of changes and fetching them all could take a long time. Normally you are only interested in the more recent changes. By default, the number of log messages fetched is limited to 100, but you can change this value in → (“TSVN对话框设置一”一节),
当复制/重命名时停止复选框被选中时, 如果选中的文件或文件夹是从版本库中的其他地方复制而来的,显示日志将停止在该点。这对于查看分支(或标记)时很有用,因为它会停在分支的根节点上,可以快速查看该分支的修改。
一般情况下你可以不要勾选它。 TortoiseSVN会记住它的状态,以改进性能。
如果你在从合并对话框中调用的显示日志对话框,那么这个复选框默认将总是选中的。这是由于合并通常都是查看分支中的修改, 获取分支的根之前的日志在这种情况下通常没有什么意义。
注意,Subversion当前是用复制/删除来实现重命名的,所以重命名一个文件或文件夹也会造成日志显示停止(如果选择了复制/重命名时停止)在该点。
如果你要查看更多的日志信息,点击,以获取下100个日志信息。如果有需要你可以多次重复这个操作。
这个按钮旁边的是一个多功能按钮,它可以记住上一次你要它进行的操作。点击它上面的箭头,可以看到更多的选项。
如果你要查询指定范围的版本,使用。这会出现一个对话框,要求输入开始和结束的版本。
如果你要查询从最新版本直到版本1的所有的日志消息,使用。
Because the log dialog shows you the log from HEAD, not from the current working copy revision, it often happens that there are log messages shown for content which has not yet been updated in your working copy. To help make this clearer, the commit message which corresponds to the revision you have in your working copy is shown in bold.
When you show the log for a folder the revision highlighted is the highest revision found anywhere within that folder, which requires a crawl of the working copy. This can be a slow operation for large working copies, and the log messages are not displayed until the crawl completes. If you want to disable or limit this feature you need to set a registry key HKCU\Software\TortoiseSVN\RecursiveLogRev as described in “注册表设置”一节.
Subversion 1.5 and later keeps a record of merges using properties. This allows us to get a more detailed history of merged changes. For example, if you develop a new feature on a branch and then merge that branch back to trunk, the feature development will show up on the trunk log as a single commit for the merge, even though there may have been 1000 commits during branch development.
If you want to see the detail of which revisions were merged as part of that commit, use the Include merged revisions checkbox. This will fetch the log messages again, but will also interleave the log messages from revisions which were merged. Merged revisions are shown in grey because they represent changes made on a different part of the tree.
Of course, merging is never simple! During feature development on the branch there will probably be occasional merges back from trunk to keep the branch in sync with the main line code. So the merge history of the branch will also include another layer of merge history. These different layers are shown in the log dialog using indentation levels.
Revision properties are completely different from the Subversion properties of each item. Revprops are descriptive items which are associated with one specific revision number in the repository, such as log message, commit date and committer name (author).
有时你可能想要修改你曾经输入的日志消息,也许是因为有拼写错误或是你想改进消息内容,或是其他别的原因。偶尔你还想修改提交者,可能是你忘了设置认证等原因。
Subversion lets you change revision properties any time you want. But since such changes can't be undone (those changes are not versioned) this feature is disabled by default. To make this work, you must set up a pre-revprop-change hook. Please refer to the chapter on Hook Scripts in the Subversion Book for details about how to do that. Read “服务器端钩子脚本”一节 to find some further notes on implementing hooks on a Windows machine.
Once you've set up your server with the required hooks, you can change the author and log message (or any other revprop) of any revision, using the context menu from the top pane of the Log dialog. You can also edit a log message using the context menu for the middle pane.
由于Subversion的版本属性不受版本控制,对于这种属性的修改(如 svn:log提交信息属性将永久覆盖该属性之前的值。
如果你只想要显示上千条日志中你所感兴趣的日志,你可以使用日志对话框顶部的过滤器控件。开始和结束日期控件允许你查看指定日期范围内的输出。查找框帮你查出含有指定内容的信息。
Click on the search icon to select which information you want to search in, and to choose regex mode. Normally you will only need a simple text search, but if you need to more flexible search terms, you can use regular expressions. If you hover the mouse over the box, a tooltip will give hints on how to use the regex functions. You can also find online documentation and a tutorial at http://www.regular-expressions.info/. The filter works by checking whether your filter string matches the log entries, and then only those entries which match the filter string are shown.
To make the filter show all log entries that do not match the filter string, start the string with an exclamation mark ('!'). For example, a filter string !username will only show those entries which were not committed by username.
要注意的是,这些过滤器只对已经获取的信息有效。它们并不从版本库中下载信息。
You can also filter the path names in the bottom pane using the Hide unrelated changed paths checkbox. Related paths are those which contain the path used to display the log. If you fetch the log for a folder, that means anything in that folder or below it. For a file it means just that one file. The checkbox is tristate: you can show all paths, grey out the unrelated ones, or hide the unrelated paths completely.
Sometimes your working practices will require log messages to follow a particular format, which means that the text describing the changes is not visible in the abbreviated summary shown in the top pane. The property tsvn:logsummary can be used to extract a portion of the log message to be shown in the top pane. Read “TortoiseSVN 项目属性”一节 to find out how to use this property.
Because the formatting depends upon accessing subversion properties, you will only see the results when using a checked out working copy. Fetching properties remotely is a slow operation, so you will not see this feature in action from the repo browser.
按扭,可以显示一些你感兴趣的关于日志对话框中版本的信息。可以显示已经有几个作者做了工作,他们各提交了几次,按周的统计,等等。现在,你可以发现一个大概情况: 谁最勤快,谁偷懒。;-)
此图用简单柱状图、叠加柱状图或饼图显示了哪些作者已经在项目中活跃了。
Where there are a few major authors and many minor contributors, the number of tiny segments can make the graph more difficult to read. The slider at the bottom allows you to set a threshold (as a percentage of total commits) below which any activity is grouped into an Others category.
本页图示了以提交次数和作者作为条件的项目行为统计。这里可以看出项目什么时候有人在工作,以及什么人在什么时候进行了工作。
如果有多个作者,你就会在图中看到多行。有两种视图可用正常,在这里,每个作者的行为都相对于基线;叠加,在这里每个作者的行为是相对于他的下面那条线。后一种视图避免了线的交叉,对于图来说更明了,但对查看一个作者的输出比较不直观。
By default the analysis is case-sensitive, so users PeterEgan and PeteRegan are treated as different authors. However, in many cases user names are not case-sensitive, and are sometimes entered inconsistently, so you may want DavidMorgan and davidmorgan to be treated as the same person. Use the Authors case insensitive checkbox to control how this is handled.
注意,统计只包括了日志对话框中的那段时期。如果日志对话框中只显示一个版本,那么统计就没有什么意义了。
If the server is not reachable, and you have log caching enabled you can use the log dialog and revision graph in offline mode. This uses data from the cache, which allows you to continue working although the information may not be up-to-date or even complete.
Here you have three options:
Complete the current operation in offline mode, but retry the repository next time log data is requested.
Remain in offline mode until a repository check is specifically requested. See “刷新视图”一节.
If you don't want to continue the operation with possibly stale data, just cancel.
The Make this the default checkbox prevents this dialog from re-appearing and always picks the option you choose next. You can still change (or remove) the default after doing this from → .
If you want to check the server again for newer log messages, you can simply refresh the view using F5. If you are using the log cache (enabled by default), this will check the repository for newer messages and fetch only the new ones. If the log cache was in offline mode, this will also attempt to go back online.
If you are using the log cache and you think the message content or author may have changed, you can use Shift-F5 or Ctrl-F5 to re-fetch the displayed messages from the server and update the log cache. Note that this only affects messages currently shown and does not invalidate the entire cache for that repository.