1

Trying to write my first hook. I want to generate a file in the .hg folder every time a commit is done. I tried the following in my Mercurial.ini file:

[hooks]
commit = echo test > .hg\out.dat

... just to see if it would work. It complains about the directory not being found. To troubleshoot, I tried the following (simpler) hook:

[hooks]
commit = echo %cd%

... just to see what my current working directory was. The result is:

D:\

So for some reason, the hook is being run under the drive root, instead of my repository's directory.

Any ideas why?

I'm running under Win XP, FWIW.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
loneboat
  • 2,845
  • 5
  • 28
  • 40
  • Which version of Mercurial? Did you try to doanload the latest version? – John May 23 '11 at 20:36
  • 1.5.3 ; Seems like something pretty basic, so I figured it was probably something wrong I was doing (hence no, I didn't try updating) – loneboat May 23 '11 at 21:00
  • Works for me with version 1.8 on Windows 7, that is why I asked. – John May 23 '11 at 21:45
  • By "works for me", you mean the example as typed above works for you? Thanks for the feedback. – loneboat May 23 '11 at 22:00
  • Works for me means that I was not able to repro your problem. The hook created the output file as expected in the .hg directory. – John May 24 '11 at 16:07
  • Hooks should have been executed from the repository root ever since [changeset `88a9c75dc76a`](https://bitbucket.org/mirror/mercurial/changeset/88a9c75dc76a) from 2005. – Martin Geisler Dec 26 '11 at 17:24

0 Answers0