Edgewall Software
Modify

Opened 12 years ago

Last modified 7 years ago

#10905 new enhancement

Enabled CommitTicketUpdater only for some repositories

Reported by: Mitar Owned by:
Priority: normal Milestone: next-major-releases
Component: version control Version: 0.12.3
Severity: normal Keywords: CommitTicketUpdater
Cc: mmitar@…, Jun Omae, Ryan J Ollos Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I am using CommitTicketUpdater on a Trac installation with multiple (git) repositories. The problem I am having is that for some of those repositories we are using GitHub for ticketing. And because CommitTicketUpdater listens to all comments, when somebody reference ticket with GitHub ticket number, a wrong reference is made in Trac. Would it be possible to enable CommitTicketUpdater only for some repositories?

Attachments (0)

Change History (11)

comment:1 by Jun Omae, 12 years ago

I have the similar problems which I use a subversion repository and the git-svn cloned repository.

I'm using the following script instead of CommitTicketUpdater. Set the repository names to [ticket] commit_ticket_update_ignore_repositories.

from trac.config import ListOption
from tracopt.ticket.commit_updater import CommitTicketUpdater

class MyCommitTicketUpdater(CommitTicketUpdater):

    ignore_repositories = ListOption(
        'ticket', 'commit_ticket_update_ignore_repositories', '',
        keep_empty=True,
        doc="""List of repository names that should not be updated tickets
        when the changes.

        Note that `(default)` can be used instead of an empty name for the
        default repository.""")

    def changeset_added(self, repos, changeset):
        if not self._is_ignored(repos):
            CommitTicketUpdater.changeset_added(self, repos, changeset)

    def changeset_modified(self, repos, changeset, old_changeset):
        if not self._is_ignored(repos):
            CommitTicketUpdater.changeset_modified(self, repos, changeset,
                                                    old_changeset)

    def _is_ignored(self, repos):
        if self.env.is_component_enabled(CommitTicketUpdater):
            return True
        reponame = repos.reponame
        if is_default(reponame):
            if '(default)' in self.ignore_repositories:
                return True
            reponame = ''
        return reponame in self.ignore_repositories

comment:2 by Remy Blank, 12 years ago

This would be a worthwhile addition to CommitTicketUpdater.

comment:3 by Mitar, 12 years ago

Thanks for the code.

comment:4 by Jun Omae, 12 years ago

Cc: Jun Omae added
Milestone: next-stable-1.0.x

I'll push to 1.0-stable.

comment:5 by Mitar, 11 years ago

Ping?

comment:6 by Jun Omae, 11 years ago

Keywords: CommitTicketUpdater added

comment:7 by Ryan J Ollos, 10 years ago

Cc: Ryan J Ollos added

comment:8 by Ryan J Ollos, 9 years ago

Milestone: next-stable-1.0.xnext-dev-1.1.x

The change looks good and useful to me.

comment:9 by Ryan J Ollos, 9 years ago

Milestone: next-dev-1.1.xnext-dev-1.3.x

Narrowing focus for milestone:1.2. Please move ticket to milestone:1.2 if you intend to fix it.

comment:10 by Ryan J Ollos, 8 years ago

See #108 for trac-github, which requests the ability to selectively enable or disable CommitTicketUpdater for repository paths (branches).

comment:11 by Ryan J Ollos, 7 years ago

Milestone: next-dev-1.3.xnext-major-releases

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


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