通过一次提交打开和关闭 trac 票证

发布于 2024-09-05 09:17:48 字数 173 浏览 5 评论 0 原文

我正在寻找一种方法来向我的 VCS 添加提交后或提交前挂钩,这样我就可以一次性创建和关闭 trac 票证。

该用例适用于发现并纠正错误的情况,但单个开发人员希望确保项目经理可以看到修复已完成、完成的时间以及修复已完成的里程碑。

创建票证时,我们在 trac 中有一个默认里程碑,因此反映该信息也很好。

I am looking for a way to add a post-commit or pre-commit hook to my VCS that will allow me to both create and close a trac ticket in one go.

The use-case is for when a bug has been found, and corrected, but a single developer who wants to make sure the project manager can see the fix has been done, when it was done and what milestone the fix has been done in.

We have a default milestone in trac when creating a ticket, so reflecting that information would be good too.

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

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

发布评论

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

评论(2

神经暖 2024-09-12 09:17:49

我建议扩展 TracTicketChangesetsPlugin 来执行此操作。

您可以调整它在提交消息中检测命令的方式(请参阅 http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L154),因为您还没有可以参考的票号。

请参阅http://trac-hacks.org /browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L215 实际进行解析的位置。您必须返回一些新令牌来代表“新票”。

实际更改票证的代码位于 http ://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L234,因此您将在此处创建新票证,然后立即将其关闭。要创建新票证,请调用 Ticket(self.env),然后使用 Ticket.insert() 保存它(请参阅 http://trac.edgewall.org/browser/trunk/trac/ticket/model.py?rev=9692#L174 )。

如果您这样做,我建议您将补丁附加到 Trac Hacks 的新票证< /a>.

I recommend extending TracTicketChangesetsPlugin to do this.

You would adjust the way it detects the command in the commit message (see http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L154), as you would not have a ticket number to refer to yet.

See http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L215 for where it actually does the parsing. You would have to return some new token to represent "new ticket."

The code that actually changes the tickets is at http://trac-hacks.org/browser/tracticketchangesetsplugin/trunk/ticketchangesets/commit_updater.py?rev=8114#L234 , so here would you create NEW ticket, then close it straight away. To create a new ticket, call Ticket(self.env) and then save it with Ticket.insert() (see http://trac.edgewall.org/browser/trunk/trac/ticket/model.py?rev=9692#L174 ).

If you do this, I recommend attaching your patch to a new ticket at Trac Hacks.

毁虫ゝ 2024-09-12 09:17:49

创建一个提交后挂钩。请注意 trac post-commit 挂钩如何工作并复制此功能来控制此操作(创建 + 关闭票证)。创建 + 关闭是两个单独的 http 请求,可以使用 wget 进行,您可以拦截票证创建表单的帖子,查看现有的 trac 集成如何工作,或者以其他方式破解它。玩得开心。我希望这可以更具体,但这确实取决于您想要做什么。

Create a post-commit hook. Notice how the trac post-commit hooks work and copy this functionality to control this action (creation + closing ticket). The creation + closing are two separate http requests that can happen with wget, you can intercept the ticket creation form's post, look at how the existing trac integration works, or hack it some other way. Have fun. I wish this could be more specific but it really does depend on what you're trying to do.

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