Mercurial hook not executing properly

后端 未结 9 1375
北恋
北恋 2020-12-30 12:02

This should be a very simple thing to have run, but for some reason it won\'t work with my Mercurial repository. All I want is for the remote repo to automatically run

9条回答
  •  一整个雨季
    2020-12-30 12:24

    First of all, I want to correct a few comments above.

    • Hooks are invoked also when pushing over file system.
    • It is not necessary to keep the hook in the repo on which you want them to operate. You can also write the same hook as in your question on the user end. You have to change the event from changegroup to outgoing and also to specify the URL of remote repo with the -R switch. Then if the pushing user has sufficient privileges on the remote repo, the hook will execute successfully.

    .hg/hgrc

    [hooks]
    outgoing = hg update -R $HG_URL
    

    Now towards your problem.... I suggest creating both prechangegroup and changegroup hooks and printing some debugging output.

    .hg/hgrc

    [hooks]
    prechangegroup = echo "Remote repo is at `hg tip -q`"
                     echo "Remote repo wdir is at `hg parents -q`"
    changegroup    = echo "Updating.... `hg update -v`"
                     echo "Remote repo is at `hg tip -q`"
                     echo "Remote repo wdir is at `hg parents -q`"
    

    And also push with the -v switch, so that you may know which hook is running. If you still can't figure out, post the output. I might be able to help.

提交回复
热议问题