Can you use InterTrac aliases with MultiProjectCommitTicketUpdaterPlugin?

26 views
Skip to first unread message

Miguel Almeida

unread,
Aug 12, 2016, 3:11:02 PM8/12/16
to Trac Users
I am trying to use the MultiProjectCommitTicketUpdaterPlugin.

The documentation says " By prepending the project name to the ticket number in the approved InterTrac fashion, you can add comments to tickets in specific projects only."


Given the following intertrac configuration:

[intertrac]
tools.title = My Tools
tools.url =  http://some/url

I was under the impression that you'd be able to update ticket #99k with the commit message: foo (see tools:#99)

However, I discovered that, because my tools project's name is "My tools project" (as seen in the corresponding trac's admin section), this commit doesn't get added to ticket #99.

If, however, I change the project name to "Tools", the commit message will be added.


The documentation is a bit ambiguous, because it says "prepending the project name", but it also says "in InterTrac fashion".

Am I missing something to be able to use my intertrac names or aliases here, or will this tool only work with the actual project name? I was hoping for the former, since the project names tend to be more verbose than the intertrac aliases!

All insights appreciated!

Miguel

RjOllos

unread,
Aug 21, 2016, 11:22:45 AM8/21/16
to Trac Users
The plugin doesn't use intertrac configuration, instead it matches to the project name, which is configured through the [project] name option:


- Ryan

RjOllos

unread,
Aug 21, 2016, 11:38:47 AM8/21/16
to Trac Users
I'm not sure it would make sense to use the [intertrac] section to configure this plugin. The CommitTicketUpdater is running for each environment for which the hook is configured. The intertrac section is commonly used to make a Trac environment aware of other environments, whereas if the intertrac section was used for this plugin it would have to be configured the same for every environment, and the environment would be using the intertrac section to obtain configuration about itself.

I also agree though that it doesn't make sense to use the [project] name setting. Two options I can think of are:
* Add a [project] short_name option
* Use the Environment name: https://trac.edgewall.org/browser/branches/1.2-stable/trac/env.py?rev=14977&marks=310#L309. The Environment name is the string you use when creating the environment, i.e. the directory name of the project: "trac-admin <name> initenv"

- Ryan

Miguel Almeida

unread,
Aug 21, 2016, 12:38:45 PM8/21/16
to trac-...@googlegroups.com

A project short name would be the best of the two options, I suppose. It could be set in the admin section of the project and would work essentially the same way as the alias in intertrac. I like that!


--
You received this message because you are subscribed to a topic in the Google Groups "Trac Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/trac-users/62Eu-uJZWEw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to trac-users+unsubscribe@googlegroups.com.
To post to this group, send email to trac-...@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

RjOllos

unread,
Aug 22, 2016, 4:22:40 AM8/22/16
to Trac Users


On Sunday, August 21, 2016 at 12:38:45 PM UTC-4, Miguel Almeida wrote:

A project short name would be the best of the two options, I suppose. It could be set in the admin section of the project and would work essentially the same way as the alias in intertrac. I like that!


I'm looking at implementing it after refactoring the code a bit. You can follow this ticket if you'd like:
https://trac-hacks.org/ticket/12852

- Ryan

RjOllos

unread,
Aug 22, 2016, 8:47:31 AM8/22/16
to Trac Users

#12852 is implemented now. You'll need to reinstall from the 1.0 directory:
https://trac-hacks.org/svn/multiprojectcommitticketupdaterplugin/1.0/

Please comment on #12852 if you're able to test it out.

- Ryan
 

Miguel Almeida

unread,
Aug 23, 2016, 8:02:48 AM8/23/16
to trac-...@googlegroups.com
Thanks Ryan,

I'm trying to test it, but with no luck. I've removed the previous plugin and added the new one to the plugins directory and, while the new version is being loaded [1], I'm not being able to trigger the plugin (no debug log after [2]).
I'll try to investigate.

[1]
2016-08-23 12:49:29,323 Trac[loader] DEBUG: Adding plugin MultiProjectCommitTicketUpdater 1.0.0dev from /srv/trac/plugins/MultiProjectCommitTicketUpdater-
1.0.0dev-py2.6.egg

[2] 2016-08-23 12:49:29,924 Trac[api] DEBUG: Event changeset_added on Internal tools for revision 6194


--

Miguel Almeida

unread,
Aug 23, 2016, 8:38:14 AM8/23/16
to trac-...@googlegroups.com
[UPDATE] For reference, my global_trac.ini (non-commented is with stable, commented is what I switched to when trying to use 1.0.0 from svn).

[components]
multicommitupdater.* = enabled

[multicommitupdater]
envelope = ()
commands.refs = re see rel
commands.close = fix fixes close closes
check_perms = false

#[ticket]
#commit_ticket_update_envelope = ()
#commit_ticket_update_commands.refs = re see rel
#commit_ticket_update_commands.close = fix fixes close closes


In my tools.ini I have:
[ticket]
commit_ticket_update_short_name=xxx

[components]
tracopt.ticket.commit_updater.committicketreferencemacro = enabled
#tracopt.ticket.commit_updater.committicketupdater = enabled
#disabled when using version 1.0.0x
tracopt.ticket.commit_updater.committicketupdater = disabled


I've also added the following debug to the tool, which isn't logged:
    def _parse_message(self, message):
        """Parse the commit message and return the ticket references."""
        self.log.debug("xxxxxxxxxxxx parsing the message")
        cmd_groups = self.command_re.findall(message)
(...)
 # Project name is the first thing in the list, then tickets.
            name = project_groups.pop(0)
            self.log.debug("xxx name is: #%s", name)
            self.log.debug("xxx project_name is: #%s",self.project_name.lower())


Still investigating...



RjOllos

unread,
Aug 23, 2016, 1:19:27 PM8/23/16
to Trac Users

There were two issues:
* I made a syntax error in r15726.
* The regex didn't work when using an envelope. I hadn't touched that part of the code yet, and it needed a major rewrite.

The latest changes have been committed in r15730 (2).

- Ryan

(1) https://trac-hacks.org/changeset/15726
(2) https://trac-hacks.org/changeset/15730

Reply all
Reply to author
Forward
0 new messages