开发者

Mercurial , writing hooks using a .NET api

Hi I am looking for examples of how to write Mercurial hooks in 开发者_如何学Goa .NET language, including how to setup .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.

I am using .Net for a number of reasons , one being to link up with other systems using WFC


EDIT The new version of Mercurial.Net makes writing hooks easier, see see http://mercurialnet.codeplex.com/discussions/261283

  1. Create a "Windows Application" project (eg MyHook).
  2. Add a reference to "Mercurial.Net" (you can use NuGet to make it easier http://nuget.org/List/Packages/Mercurial.Net).
  3. 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.
  4. Compile your project.
  5. 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):

    [hooks]
    commit.hook1 = "C:\path to file\MyHook.exe"
    

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜