Hi I am looking for examples of how to write Mercurial hooks in a .NET language, including how to setup .hg/hgr
您好我正在寻找如何在.NET语言中编写Mercurial钩子的示例,包括如何设置.hg / hgr
I have used the "Mercurial.Net" Api, but the information in the Windows environment variables is a bit limited and returning error messages on the standard error channel does not appear to work. I guess I am doing something wrong.
我使用了“Mercurial.Net”Api,但Windows环境变量中的信息有点受限,并且标准错误通道上的返回错误消息似乎不起作用。我想我做错了什么。
I am using .Net for a number of reasons , one being to link up with other systems using WFC
我使用.Net有很多原因,一个是使用WFC与其他系统连接
1 个解决方案
#1
9
EDIT The new version of Mercurial.Net makes writing hooks easier, see see http://mercurialnet.codeplex.com/discussions/261283
编辑新版本的Mercurial.Net使编写钩子变得更容易,请参阅http://mercurialnet.codeplex.com/discussions/261283
- Create a "Windows Application" project (eg MyHook).
- Add a reference to "Mercurial.Net" (you can use NuGet to make it easier http://nuget.org/List/Packages/Mercurial.Net).
- In your main method, do whatever processing you want (eg retrieve the log and then the info on the last commit - see http://mercurialnet.codeplex.com/discussions/261283 for examples). You can add a
MessageBox.Show(message)
to check that the hook is indeed executed. - Compile your project.
-
Add the hook to your .hg/hgrc file (below is an example of a hook that will be executed after each commit, see https://www.mercurial-scm.org/wiki/Hook for more info, http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html for even more info):
将钩子添加到.hg / hgrc文件中(下面是每次提交后将执行的钩子的示例,有关详细信息,请参阅https://www.mercurial-scm.org/wiki/Hook,http:// hgbook.red-bean.com/read/handling-repository-events-with-hooks.html了解更多信息):
[hooks] commit.hook1 = "C:\path to file\MyHook.exe"
创建“Windows应用程序”项目(例如MyHook)。
添加对“Mercurial.Net”的引用(您可以使用NuGet使其更容易http://nuget.org/List/Packages/Mercurial.Net)。
在您的main方法中,执行您想要的任何处理(例如,检索日志,然后检索上次提交的信息 - 请参阅http://mercurialnet.codeplex.com/discussions/261283以获取示例)。您可以添加MessageBox.Show(消息)来检查钩子是否确实已执行。
编译您的项目。
The next time you commit your hook should be executed.
下次你提交你的钩子应该被执行。
Check http://docs.vkarlsen.no/Mercurial.Net/ to learn about the classes of Mercurial.Net.
检查http://docs.vkarlsen.no/Mercurial.Net/以了解Mercurial.Net的类。
#1
9
EDIT The new version of Mercurial.Net makes writing hooks easier, see see http://mercurialnet.codeplex.com/discussions/261283
编辑新版本的Mercurial.Net使编写钩子变得更容易,请参阅http://mercurialnet.codeplex.com/discussions/261283
- Create a "Windows Application" project (eg MyHook).
- Add a reference to "Mercurial.Net" (you can use NuGet to make it easier http://nuget.org/List/Packages/Mercurial.Net).
- In your main method, do whatever processing you want (eg retrieve the log and then the info on the last commit - see http://mercurialnet.codeplex.com/discussions/261283 for examples). You can add a
MessageBox.Show(message)
to check that the hook is indeed executed. - Compile your project.
-
Add the hook to your .hg/hgrc file (below is an example of a hook that will be executed after each commit, see https://www.mercurial-scm.org/wiki/Hook for more info, http://hgbook.red-bean.com/read/handling-repository-events-with-hooks.html for even more info):
将钩子添加到.hg / hgrc文件中(下面是每次提交后将执行的钩子的示例,有关详细信息,请参阅https://www.mercurial-scm.org/wiki/Hook,http:// hgbook.red-bean.com/read/handling-repository-events-with-hooks.html了解更多信息):
[hooks] commit.hook1 = "C:\path to file\MyHook.exe"
创建“Windows应用程序”项目(例如MyHook)。
添加对“Mercurial.Net”的引用(您可以使用NuGet使其更容易http://nuget.org/List/Packages/Mercurial.Net)。
在您的main方法中,执行您想要的任何处理(例如,检索日志,然后检索上次提交的信息 - 请参阅http://mercurialnet.codeplex.com/discussions/261283以获取示例)。您可以添加MessageBox.Show(消息)来检查钩子是否确实已执行。
编译您的项目。
The next time you commit your hook should be executed.
下次你提交你的钩子应该被执行。
Check http://docs.vkarlsen.no/Mercurial.Net/ to learn about the classes of Mercurial.Net.
检查http://docs.vkarlsen.no/Mercurial.Net/以了解Mercurial.Net的类。