[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Enhancement: bugid prefix (useful with Trac)

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: 2006-06-08 18:31:09 CEST

Idan Gazit wrote:

> In Trac (and, possibly other such systems), tickets (aka bugs) are
> always prefixed by the '#' char, and when displayed by the Trac web

That's not quite true. Trac actually uses a regex pattern to find those
tickets inside a Subversion log message. You can simply change that
regex to match whatever you want.

> interface, these are automagically linkified so they point at the
> appropriate issue number. That is to say, #123 will lead to ticket 123
> when clicked.
>
> The problem lies with tortoise's bugtraq field. I've set the following
> properties:
>
> bugtraq:numeric = true
> bugtraq:message = Tickets affected: #%BUGID%
>
> However some issues close or are associated with more than one ticket.
> When this is the case, I would enter "123,124" in the bug id field,
> however the resulting append at the bottom of the commit log message
> looks like:
>
> Tickets affected: #123,124
>
> This is problematic because the first bugid gets linkified, but the
> second does not, because it lacks the # prefix.
>
>
> What I want to have appear is:
>
> Tickets affected: #123,#124

In this file:
http://projects.edgewall.com/trac/browser/trunk/contrib/trac-post-commit-hook

change the lines:
commandPattern = re.compile(leftEnv +
r'(?P<action>[A-Za-z]*).?(?P<ticket>#[0-9]+(?:(?:[, &]*|[ ]?and[
]?)#[0-9]+)*)' + rghtEnv)

and

ticketPattern = re.compile(r'#([0-9]*)')

to
commandPattern = re.compile(leftEnv +
r'(?P<action>[A-Za-z]*).?(?P<ticket>#[0-9]+(?:(?:[, &]*|[ ]?and[
]?)[0-9]+)*)' + rghtEnv)

and

ticketPattern = re.compile(r'([0-9]*)')

Now the line
Tickets affected: #123,124
should work ok.

But the best way would be to use the bugtraq:logregex property instead.
After all, Trac uses a regex to parse the log message, so you should use
the same regex in TSVN too.

No need to add again one more 'feature' to the already existing bugtraq
properties and how they're handled. We implemented the regex stuff there
to give the user the maximum flexibility so we don't have to deal with
every issue/bugtracker out there which all use some slightly different
syntax.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: dev-help@tortoisesvn.tigris.org
Received on Thu Jun 8 18:31:24 2006

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.