Edgewall Software
Modify

Opened 15 years ago

Closed 14 years ago

#7743 closed enhancement (wontfix)

Add/document commit-hook

Reported by: Marcus Lindblom <macke@…> 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 Christian Boos, 15 years ago

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.

comment:2 by anonymous, 14 years ago

looks like #7723 has been fixed; does that mean there's a way to do this now?

comment:3 by Remy Blank, 14 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 Christian Boos, 14 years ago

Keywords: multirepos added
Milestone: not applicablemercurial-plugin
Priority: normalhigh

comment:5 by dholth, 14 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 Remy Blank, 14 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 Remy Blank, 14 years ago

Milestone: plugin - mercurial
Resolution: wontfix
Status: newclosed

Superseded by the CommitTicketUpdater.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.