VisualHG 中的自动提交
是否可以设置 VisualHg,以便每次退出 Visual studio 2010 时都会自动显示提交屏幕?
如果我忘记提交一些更改,这将非常有用。
Is it possible to setup VisualHg such that i'm automatically presented with a commit screen every time I quit Visual studio 2010?
This would be extremely useful if I forget to commit some changes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已设法使用以下步骤来完成此操作:
这将为您提供一个设置为处理 IDE 事件的文件。在文件中的最后一个
End Module
之前添加以下代码:这将在解决方案关闭之前执行提交操作(这将在 Visual Studio 关闭之前发生),但 VS 不会等待提交窗口在继续之前关闭。这并不理想,因为这意味着如果您想在提交之前进行任何更改,则必须重新加载解决方案。
另一种解决方案是处理 QueryCloseSolution 事件并询问用户是否要在关闭之前提交更改。如果他们回答“是”,那么您将取消关闭解决方案(通过将传入的布尔值设置为
True
)并调用DTE.ExecuteCommand("File.Commit")
。然后,当您进行提交时,解决方案将保持打开状态,但每次关闭解决方案时都会询问您是否要提交。进一步采用该解决方案需要从
QueryCloseSolution
事件启动hg status
,以在询问用户是否要提交更改之前检查是否存在未完成的更改。I've managed to do this using the following steps:
This gives you a file which is set up to handle IDE events. Before the last
End Module
in the file add the following code:This will execute the commit action before the solution closes (which will happen before Visual Studio closes) but VS doesn't wait for the commit window to close before carrying on. This isn't ideal as it means that you'd have to re-load the solution if you wanted to make any changes before committing.
An alternative solution would be to handle the
QueryCloseSolution
event and ask the user if they want to commit their changes before closing. If they answer "Yes" then you'd cancel the close solution (by setting the passed in boolean to beTrue
) and callDTE.ExecuteCommand("File.Commit")
. That would then leave the solution open whilst you did your commit but would ask you if you wanted to commit every time you close the solution.Taking that solution further would involve launching
hg status
from theQueryCloseSolution
event to check if there are outstanding changes before asking the user if they want to commit their changes.