我使用 Visual SVN Server 和 Tortoise SVN(客户端)进行源代码控制。我希望所有开发人员能够标准化签入注释的一致格式。

例如,我希望他们的提交消息默认为...

概要:

开发商名称: (预先填充)

审阅者:

[错误编号]:

[更改错误状态]:

已知的问题:

受影响的文件: (预先填充)

将来,我希望 [Bug Id] 和 [Bug State] 提供信息以触发 Bug 跟踪系统的自动更新。此外,开发人员名称和受影响的文件应预先填充 svn 用户和用户提交的文件。

请发送您可能拥有的任何链接或样本。

有帮助吗?

解决方案

取自 如何创建 Tortoise SVN 签入模板 (修改以适应更新的版本):

日志模板可以根据项目需求进行定制,可以实现严格的日志格式。

将其添加到您的 svn 存储库很简单:

  1. 选择要应用此操作的 SVN 文件夹,转到 Subversion 属性(右键单击 TortoiseSVN -> Properties)

  2. 选择 New -> Advanced, , 然后 tsvn:logtemplate 从名为的下拉列表中 Property name.

  3. 将上述模板(或您自己的模板)添加到组合框下方的文本区域。

  4. 如果要将属性应用于当前文件夹下层次结构中的每个文件和文件夹,请选中“递归”复选框。

  5. 点击 OK 将该属性添加到列表中。

  6. 签入所有文件夹和文件,以便团队中的其他人都可以使用相同的模板。

其他提示

用命令行要做到这一点的一种方式是改变SVN_EDITOR环境变量,这里描述:

http://svn.haxx.se/dev/archive -2006-02 / 0487.shtml

SVN_EDITOR="rm svn-commit.tmp && cp $REPOS/hooks/log.tmpl svn-commit.tmp && vi svn-commit.tmp"

或者,对于进一步SVN_EDITOR舒适(例如适当地链接到TFS工作项在具有的情况下使用SvnBridge),人们可以存储以下脚本〜/斌/ SVN_EDITOR:

#!/bin/sh

template_file="${@}"
template_file_new="${template_file}.new"

current_work_item_number_file="${HOME}/tfs_work_item_number_current.txt"
[ -f "${current_work_item_number_file}" ] && work_item=$(cat "${current_work_item_number_file}") || work_item="please fill in!"

# Yes folks, this is the TFS convention (hard, NOT-TO-BE-ALTERED text)
# to properly link to work items via SvnBridge commits!
work_item_prefix_hard_tfs_convention_text="work item: "

work_item_text="${work_item_prefix_hard_tfs_convention_text}${work_item}"

custom_text="${work_item_text}\n\n[this addition above initially placed to ignored content part here,\nto ensure properly abortable empty message by default - please move it to active content as needed]"

sed -e 's/\(will be ignored--\)/\1\n'"${custom_text}"'/' "${template_file}" > "${template_file_new}"

mv -f "${template_file_new}" "${template_file}"

$EDITOR "${@}"

,然后简单地做

export SVN_EDITOR=~/bin/svn_editor

在〜/ .bashrc或一些这样的。 保持在火狐TFS Web界面查看甚至从当前工作项页面更新工作项目编号文件积分(我认为有可能是Firefox的沟通,得到的网页标题等方式)。 或者仅仅是这个脚本启动第一初始编辑器中运行的持续性工作项目文件和然后的让它做的第二个编辑器运行在自定义模板提交

我发现它使用: Folder right-click -> Properties -> New... -> Advanced -> Property name: tsvn:logtemplate -> enter a Property value -> OK -> OK.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top