Edgewall Software
Modify

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

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

Attachments (0)

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.

diff --git a/tracopt/ticket/commit_updater.py b/tracopt/ticket/commit_updater.py
index aa4a9dc..3b43d6d 100644
--- a/tracopt/ticket/commit_updater.py
+++ b/tracopt/ticket/commit_updater.py
@@ -197,15 +197,18 @@ class CommitTicketUpdater(Component):

     def make_ticket_comment(self, repos, changeset):
         """Create the ticket comment from the changeset data."""
-        revstring = str(changeset.rev)
+        rev = changeset.rev
+        revstring = str(rev)
+        drev = str(repos.display_rev(rev))
         if repos.reponame:
             revstring += '/' + repos.reponame
+            drev += '/' + repos.reponame
         return """\
-In [changeset:"%s"]:
+In [changeset:"%s" %s]:
 {{{
 #!CommitTicketReference repository="%s" revision="%s"
 %s
-}}}""" % (revstring, repos.reponame, changeset.rev, changeset.message.strip())
+}}}""" % (revstring, drev, repos.reponame, rev, changeset.message.strip())
}}}
Version 0, edited 10 years ago by Jun Omae (next)

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)

Modify Ticket

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