Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 10 years ago

#9306 closed defect (fixed)

CommitTicketUpdater does not close ticket

Reported by: jakerothenbuhler@… Owned by: Remy Blank
Priority: normal Milestone: 0.12
Component: ticket system Version: 0.12dev
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

The CommitTicketUpdater plugin is adding comments correctly but not closing tickets as it should.

How to Reproduce

When pushing a changeset to a Mercurial repository with a comment such as "closes #1", CommitTicketUpdater adds "closes #1" as a new comment in ticket #1 but does not alter the status or resolution of the ticket.

The repository's changegroup hook is executing this script:

#!/bin/sh
# Notify trac when new Mercurial changesets arrive.
# Short repository name must be the same as its directory.

TRACADMIN=/path/to/trac-admin
ENVIRON=/path/to/trac/env
REPONAME=`basename $PWD`
REVS=`/path/to/hg log -r $HG_NODE:tip --template {node}\ `
export PYTHON_EGG_CACHE=/tmp/.python-eggs
CMD="$TRACADMIN $ENVIRON changeset added $REPONAME $REVS"
$CMD

System Information

Trac 0.12b1
Docutils 0.6
Genshi 0.6
Mercurial 1.5
mod_wsgi 3.1 (WSGIProcessGroup WSGIApplicationGroup %{GLOBAL})
Pygments 1.1.1
pysqlite 0.12b1
Python 2.6.5 (r265:79063, Apr 15 2010, 10:04:19) [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)]
setuptools 0.6c11
SQLite 3.6.23.1
Subversion 1.6.5 (r38866)

Installed Plugins

TracMercurial 0.12.0.21dev-r9589

Attachments (0)

Change History (10)

comment:1 by Remy Blank, 15 years ago

Is the author of the changeset the same as the username in Trac? The commit updater component checks if the changeset author has TICKET_MODIFY permission, and only then changes the ticket status.

I wasn't too convinced that the permission check was a good idea in the first place, and I'm even less convinced now. Maybe it should be made optional?

comment:2 by jakerothenbuhler@…, 15 years ago

Thanks for the quick response. The changeset author was not the same as the Trac username. Tickets are properly closed when submitting a changeset as a Trac user with the TICKET_MODIFY permission.

in reply to:  2 comment:3 by Remy Blank, 15 years ago

Replying to jakerothenbuhler@…:

The changeset author was not the same as the Trac username. Tickets are properly closed when submitting a changeset as a Trac user with the TICKET_MODIFY permission.

Thanks for the feedback. So, what do you think? Should the permission check be made optional?

comment:4 by jakerothenbuhler@…, 15 years ago

If the permission check were made optional, I would probably leave it enabled. I was using different usernames by mistake. I want comments generated by CommitTicketUpdater to use the Trac username for clarity. Also, keeping Trac usernames and changeset authors synced simplifies searching and maintains consistency in the timeline. In spite of this, I think it would be a good idea to make the permission check optional because I can imagine situations where turning the permission check off would be beneficial.

It would be nice to be able to maintain consistency between a repository and Trac without using the same usernames for both. I like to use full name and email (e.g. John Smith <smith@…>) for changeset authorship, but these names are not usable as Trac usernames. Ideally, I would map Trac usernames to repository authors and Trac would then show the appropriate users when displaying changesets and ticket comments.

in reply to:  4 comment:5 by Remy Blank, 15 years ago

Milestone: 0.12.1
Owner: set to Remy Blank

Replying to jakerothenbuhler@…:

It would be nice to be able to maintain consistency between a repository and Trac without using the same usernames for both. I like to use full name and email (e.g. John Smith <smith@…>) for changeset authorship, but these names are not usable as Trac usernames. Ideally, I would map Trac usernames to repository authors and Trac would then show the appropriate users when displaying changesets and ticket comments.

Yes, that was my thought, too. This probably requires a better user management than what we have at the moment.

I'll add an option to disable the permission checks.

comment:6 by Remy Blank, 15 years ago

Milestone: 0.12.10.12
Resolution: fixed
Status: newclosed

Option added in [9629].

comment:7 by Pedro Ferreira <pedro.ferreira@…>, 15 years ago

It would be nice to be able to maintain consistency between a repository and Trac without using the same usernames for both. I like to use full name and email (e.g. John Smith <smith@…>) for changeset authorship, but these names are not usable as Trac usernames. Ideally, I would map Trac usernames to repository authors and Trac would then show the appropriate users when displaying changesets and ticket comments.

I second this. Assuming that usernames in Trac and the repo are the same may be OK for SVN, but for sure not for i.e. Git, where users are identified by Full Name <email@…>. Maybe adding a "repository identity" for each user would be enough?

comment:8 by anonymous, 14 years ago

How do I set this option from [9629] ?

I tried

[trac]
...
commit_ticket_update_check_perms = False

But I still have this problem using git.

in reply to:  8 comment:9 by Remy Blank, 14 years ago

Replying to anonymous:

How do I set this option from [9629] ?

You set it in the [ticket] section, not the [trac] section.

comment:10 by debacle@…, 10 years ago

Check also, if you have set commit_ticket_update_commands.close in the [ticket] section. If not set, it should work, but maybe you set it to a strange or even empty value?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank 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.