Edgewall Software

Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11785 closed defect (fixed)

node_format = short and show_rev = yes not honored in post-commit message — at Version 6

Reported by: anonymous Owned by: Jun Omae
Priority: normal Milestone: 1.0.3
Component: ticket system Version: 1.0.1
Severity: normal Keywords: CommitTicketUpdater mercurial git
Cc: Branch:
Release Notes:

Show display_rev'ed revision id in ticket commit message generated by CommitTicketUpdater.

API Changes:
Internal Changes:

Description

The post-commit message in a ticket's history always shows the full hash for the changeset and no revision number, irrespective of node_format = short and show_rev = yes settings. Same if they are omitted (they are the defaults anyways). The shortened hash and the revision number are correctly displayed in the timeline, source browser, and apparently anywhere else.

To reproduce: create a ticket, commit to hg repo with a commit message like 'closes #1' to trigger a ticket status change. Now the ticket status is 'closed' and its history shows a message with the full hex hash and without revision number.

System: Win7 64 bits, Python 2.7.6 32 bits, Trac 1.0.1, tracmercurial 1.0.0.3dev-r0 (installed globally), mercurial-3.1.1.win32-py2.7.exe from https://bitbucket.org/tortoisehg/files/downloads

Change History (6)

comment:1 by Jun Omae, 10 years ago

Component: plugin/mercurialticket system
Keywords: CommitTicketUpdater git added
Milestone: 1.0.3
Owner: set to Jun Omae
Status: newassigned

Indeed. I'll post diff for unit tests later.

  • tracopt/ticket/commit_updater.py

    diff --git a/tracopt/ticket/commit_updater.py b/tracopt/ticket/commit_updater.py
    index aa4a9dc..3b43d6d 100644
    a b class CommitTicketUpdater(Component):  
    197197
    198198    def make_ticket_comment(self, repos, changeset):
    199199        """Create the ticket comment from the changeset data."""
    200         revstring = str(changeset.rev)
     200        rev = changeset.rev
     201        revstring = str(rev)
     202        drev = str(repos.display_rev(rev))
    201203        if repos.reponame:
    202204            revstring += '/' + repos.reponame
     205            drev += '/' + repos.reponame
    203206        return """\
    204 In [changeset:"%s"]:
     207In [changeset:"%s" %s]:
    205208{{{
    206209#!CommitTicketReference repository="%s" revision="%s"
    207210%s
    208 }}}""" % (revstring, repos.reponame, changeset.rev, changeset.message.strip())
     211}}}""" % (revstring, drev, repos.reponame, rev, changeset.message.strip())
    209212
    210213    def _update_tickets(self, tickets, changeset, comment, date):
    211214        """Update the tickets with the given comment."""
Last edited 10 years ago by Jun Omae (previous) (diff)

comment:2 by Jun Omae, 10 years ago

Proposed changes in log:jomae.git@t11785. All tests pass.

comment:3 by anonymous, 10 years ago

Works perfect now, thank you.

comment:4 by Ryan J Ollos, 9 years ago

Change looks good and work well.

comment:5 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Thanks for the reivew. Committed in [13346] and merged to trunk in [13347].

comment:6 by Ryan J Ollos, 9 years ago

Release Notes: modified (diff)
Note: See TracTickets for help on using tickets.