Issue #33 on hold

Reevaluate using precommit hook instead of "dirty" Wrap_Commit implementation.

Nathan Durnan
repo owner created an issue

The {{{precommit}}} hook seems to trigger in both Mercurial and TortoiseHg back as far as thg 2.0.5. Is it possible to get rid of the patched Wrap_Commit method that is currently being used?

Comments (3)

  1. Nathan Durnan reporter

    Both the precommit and pretxncommit hooks appear to be functional within both Mercurial and TortoiseHg. I can get them to trigger and record updated timestamps in the .hgtimestamp file. The trick is trying to figure out how to add the timestamp file to the commit file set from within those hooks. So far I have not been able to figure out how to modify the commit contents during the precommit or pretxncommit hooks.

    The pre-commit hook (note the hyphen) does allow me to modify the commit contents, but pre- hooks still do not work perfectly from within TortoiseHg. They are not recognized from an extension's ui.setconfig('hooks', ...) calls. The only way to get the pre- hooks to work from within TortoiseHg is to add them explicitly to the [hooks] section of the mercurial.ini file. The current "Wrap_Commit" method is at least automatically triggered by both Mercurial and TortoiseHg without extra configuration options.

    The extensions.wrapcommand() method still does not work from within TortoiseHg either. It works just fine for command line Mercurial, but not from the TortoiseHg GUI. So that option is still no good.

  2. Nathan Durnan reporter

    On hold until TortoiseHg fixes the issue with pre- and post- command hooks, or someone can figure out how to modify the commit contents during the precommit or pretxncommit hooks.

  3. Nathan Durnan reporter

    NOTE: Look at the method used by the LargeFiles extension that intercepts the commit in the reposetup event (hgext\largefiles\reposetup.py). This may be another alternative method to trigger the pre-commit timestamp features.

  4. Log in to comment