www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Re: [libssh2] Trac commands in commit messages

Re: [libssh2] Trac commands in commit messages

From: Peter Stuge <peter_at_stuge.se>
Date: Sat, 26 Feb 2011 05:43:03 +0100

libssh2 Trac wrote:
> ---------------------------------------------------------------------------------------+
> Changes (by Peter Stuge <peter@…>):
>
> * owner: => Peter Stuge <peter@…>
> * status: reopened => closed
> * resolution: => fixed

I used a trick here which I haven't documented before, but which has
been available on the server for a while now.

Commit messages can contain commands that automatically add a comment
to a ticket, and also optionally close it.

--8<-- commit_updater.py docs
Update tickets based on commit messages.

This component hooks into changeset notifications and searches commit
messages for text in the form of:
{{{
command #1
command #1, #2
command #1 & #2
command #1 and #2
}}}

Instead of the short-hand syntax "#1", "ticket:1" can be used as well,
e.g.:
{{{
command ticket:1
command ticket:1, ticket:2
command ticket:1 & ticket:2
command ticket:1 and ticket:2
}}}

In addition, the ':' character can be omitted and issue or bug can be used
instead of ticket.

You can have more than one command in a message. The following commands
are supported. There is more than one spelling for each command, to make
this as user-friendly as possible.

  close, closed, closes, fix, fixed, fixes::
    The specified tickets are closed, and the commit message is added to
    them as a comment.

  references, refs, addresses, re, see::
    The specified tickets are left in their current status, and the commit
    message is added to them as a comment.

A fairly complicated example of what you can do is with a commit message
of:

    Changed blah and foo to do this or that. Fixes #10 and #12,
    and refs #12.

This will close #10 and #12, and add a note to #12.
-->8--

I forgot a setting that makes TracGit map email addresses to
registered user names, which is why it put my full name and email
instead of my username as owner. I've fixed the setting now, so next
time someone uses this it will work, as long as your email address
configured in Trac is the same as the email address configured in Git
when you create the commit.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2011-02-26

the libssh2 team