As stated on the TracWiki, the intended workflow is:
- A Trac user begins work on a ticket
- They obtain code from the version control system
- After the work is completed they perform a commit of their
modifications to the version control
repository
- The user inserts the Trac ticket number into the commit message as a
TracLink
- Trac can now display the change set for the ticket
Where the TracLink is something like #1 or ticket:1 or even comment:1:ticket:2 when referring to a ticket.
If you miss creating the link when the commit is made, you can still create one in the ticket comments themselves using TracLinks such as: r2, r1:3, [1:3], log:@1:3, etc.