Opened 16 years ago
Closed 14 years ago
#7743 closed enhancement (wontfix)
Add/document commit-hook
Reported by: | Owned by: | Christian Boos | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | plugin/mercurial | Version: | 0.11 |
Severity: | normal | Keywords: | multirepos |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
There is a commit hook here which IMHO should be incorporated into the plugin.
The comments also refer to a built-in hook, but I was unable to find it (neither in code nor on the TracMercurial page).
Attachments (0)
Change History (7)
comment:1 by , 16 years ago
comment:2 by , 15 years ago
looks like #7723 has been fixed; does that mean there's a way to do this now?
comment:3 by , 15 years ago
In the MultiRepos branch, the automatic change of tickets based on commit messages has been re-written as a proper plugin (source:sandbox/multirepos/tracopt/ticket/commit_updater.py), which is independent of the VC backend. So there's nothing more to be done in the Mercurial plugin. We still need to document how to call the generic hook (trac-admin $ENV changeset added
) for the various backends.
I suggest we close this against 0.12-multirepos.
comment:4 by , 15 years ago
Keywords: | multirepos added |
---|---|
Milestone: | not applicable → mercurial-plugin |
Priority: | normal → high |
comment:5 by , 15 years ago
This is the Mercurial hook I use to automatically close tickets when "fixes #1234" appears in a commit message. Must also enable the CommitTicketUpdater plugin.
#!/bin/sh # Notify trac when new Mercurial changesets arrive. # Short repository name must be the same as its directory. # Add to hgrc in the trac repository as # [hooks] # changegroup.trac = /path/to/this/script.sh ENVIRON=/path/to/trac/environ REPONAME=`basename $PWD` REVS=`hg log -r $HG_NODE:tip --template {node}\ ` CMD="/usr/bin/trac-admin $ENVIRON added $REPONAME $REVS" $CMD
comment:6 by , 15 years ago
You also need to set the "commit" hook, and your current script might break for large numbers of revisions (ok, thousands, so that's not going to happen very often). See the bottom of MultipleRepositorySupport#Merge for a complete example.
comment:7 by , 14 years ago
Milestone: | plugin - mercurial |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
Superseded by the CommitTicketUpdater.
The hook itself: http://www.bitbucket.org/madssj/mercurial-trac-hook/src/tip/trachook.py
Surely having a changeset hook for TracMercurial would be a good thing, but I prefer to base that on the new emerging interface for changeset change notification, as started in #7723.
That way the mercurial hook itself will be quite minimalistic, and the actions to be taken (closing tickets, etc.) would be done externally.