Edgewall Software

Changes between Version 32 and Version 33 of TracWorkflow


Ignore:
Timestamp:
Apr 12, 2010, 3:03:34 PM (14 years ago)
Author:
Marc Wäckerlin
Comment:

How-To Combine SVN trac-post-commit-hook With Test Workflow

Legend:

Unmodified
Added
Removed
Modified
  • TracWorkflow

    v32 v33  
    116116}}}
    117117
     118=== How-To Combine SVN trac-post-commit-hook With Test Workflow ===
     119
     120If you installed a {{{post-commit-hook}}} in your subversion repository that calls {{{trac-post-commit-hook}}} as provided by trac, then you might want to change the behaviour: Now a developer should set the tickets to {{{testing}}}, not {{{closed}}} and assign them to the reporter.
     121
     122If you change the following method in file {{{trac-post-commit-hook}}}, then the subversion comments to close a ticket, sucht as {{{"closes #64"}}} won't close the ticket any more, but they will put the ticket to status {{{testing}}} and switch the owner to the reporter:
     123
     124{{{
     125    def _cmdClose(self, ticket):
     126        ticket['status'] = 'testing'
     127        ticket['owner'] = ticket['reporter']
     128        #ticket['status'] = 'closed'
     129        #ticket['resolution'] = 'fixed'
     130}}}
     131
     132Commented out are the original two lines.
     133
     134Of course you could also add new keywords, such as {{{test}}} or {{{testing}}} and a new function {{{_cmdClose}}}. Then a developer can choose whether he wants to put the ticket to testing state or to close it.
     135
     136In that case, extend the {{{_supported_cmds}}}, e.g. to:
     137
     138{{{
     139    _supported_cmds = {'close':      '_cmdClose',
     140                       'closed':     '_cmdClose',
     141                       'closes':     '_cmdClose',
     142                       'fix':        '_cmdClose',
     143                       'fixed':      '_cmdClose',
     144                       'fixes':      '_cmdClose',
     145                       'test':       '_cmdTest',
     146                       'testing':    '_cmdTest',
     147                       'addresses':  '_cmdRefs',
     148                       're':         '_cmdRefs',
     149                       'references': '_cmdRefs',
     150                       'refs':       '_cmdRefs',
     151                       'see':        '_cmdRefs'}
     152}}}
     153
     154... and add a new method {{{_cmdTest}}} just below  {{{_cmdClose}}} (and don't modify {{{_cmdClose}}}):
     155{{{
     156    def _cmdTest(self, ticket):
     157        ticket['status'] = 'testing'
     158        ticket['owner'] = ticket['reporter']
     159}}}
     160
     161In this case, don't forget to add the new keywords {{{test}}} and {{{testing}}} to file {{{trac-pre-commit-hook}}}, in case you also installed the subversion {{{pre-commit-hook}}}:
     162{{{
     163for tmp in re.findall('(?:close|closed|closes|fix|fixed|fixes|test|testing|addresses|references|refs|re|see)'
     164}}}
    118165== Example: Add simple optional generic review state ==
    119166