如何创建 SVN 提交消息模板和挂钩以进行验证

发布于 2024-07-23 12:43:38 字数 385 浏览 8 评论 0原文

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

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

概要:

开发人员名称:(预先填充)

审核者:

[Bug Id]:

[更改 Bug 状态]:

已知问题:

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

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

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

I'm using Visual SVN Server and Tortoise SVN (client) for source control. I would like all developers to standardize on a consistent format for checkin notes.

For Example I want their Commit Message to default to...

Synopsis:

Developer Name: (pre-populated)

Reviewed By:

[Bug Id]:

[Change Bug State]:

Known Issues:

Affected Files: (pre-populated)

In the future I'd like [Bug Id] and [Bug State] to supply the information to trigger an automated update to the Bug Tracking system. Also Developer Name and Affected Files should be prepopulated with the svn user and files that the user is commiting.

Please send any links or samples you may have.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

满身野味 2024-07-30 12:43:38

我发现它使用:
文件夹右键-> 属性-> 新... -> 高级-> 属性名称:tsvn:logtemplate -> 输入属性值 -> 好的-> 好的。

I found it using:
Folder right-click -> Properties -> New... -> Advanced -> Property name: tsvn:logtemplate -> enter a Property value -> OK -> OK.

自找没趣 2024-07-30 12:43:38

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

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

将其添加到您的 svn 存储库很容易:

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

  2. 选择新建 -> 高级,然后从名为属性名称的下拉列表中选择tsvn:logtemplate

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

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

  5. 单击确定将该属性添加到列表中。

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

Taken from How to create a Tortoise SVN Checkin Template (modified to fit to more current versions):

The log template can be customized as per the project requirements and can be used to implement strict log format.

Adding this to your svn repository is easy :

  1. Select a SVN folder to which you want to apply this go to Subversion properties( right click TortoiseSVN -> Properties)

  2. Select New -> Advanced, then tsvn:logtemplate from the drop down list named Property name.

  3. Add the above templates(or your own) to text area below combo box.

  4. If you want to apply the property to every file and folder in the hierarchy below the current folder, check the Recursive checkbox.

  5. Click on OK to add that property to the list.

  6. Check-in all the folders and files so that everyone else in your team can use the same template.

奶茶白久 2024-07-30 12:43:38

使用命令行执行此操作的一种方法是更改​​ 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"

A way to do this with the command line is to change the SVN_EDITOR environment variable, described here:

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"
难忘№最初的完美 2024-07-30 12:43:38

或者,为了进一步方便 SVN_EDITOR (例如,在必须使用 SvnBridge 的情况下正确链接到 TFS 工作项),可以将以下脚本存储为 ~/bin/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 或类似的目录中 执行。
即使从 Firefox TFS Web 界面中查看的当前工作项页面也能保持工作项编号文件更新的奖励积分(我认为可能有一种方法与 Firefox 通信以获取页面标题等)。
或者只是让此脚本启动第一个初始编辑器在持久工作项文件上运行,然后让它在自定义提交模板上运行第二个编辑器。

Or, for further SVN_EDITOR comfort (e.g. properly linking to the TFS work item in the case of having to use SvnBridge), one could store the following script as ~/bin/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 "${@}"

and then simply do

export SVN_EDITOR=~/bin/svn_editor

in ~/.bashrc or some such.
Bonus points for keeping the work item number file updated even from the current work item page as viewed in Firefox TFS web interface (I think there possibly is a way to communicate with Firefox to get page titles etc.).
Or simply have this script start a first initial editor run on the persistent work item file and then let it do the second editor run on the customized commit template.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文