Edgewall Software
Modify

Opened 16 years ago

Closed 14 years ago

#7175 closed enhancement (wontfix)

The trac-post-commit-hook for svn makes for verbose comments with svnmerge

Reported by: wr0ngway@… Owned by:
Priority: normal Milestone:
Component: general Version:
Severity: normal Keywords: hook svnmerge patch
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I like to use the trac-post-commit-hook with svn to keep changesets associated with tickets. However, when using svnmerge, the default svnmerge comment includes all comments from the associated checkins, thereby causing duplicate, overly verbose comments to be added to all those tickets. I've found it useful to have this commit hook detect a svnmerge comment and only indicate a merge direction in the trac ticket, so I'm submitting a patch that does this. My knowledge of trac is minimal, my python really rusty, so this will probably need some work, but the concept should be sound, and it does work for me.

Attachments (1)

trac-svnmerge-commit-hook.diff (917 bytes ) - added by wr0ngway@… 16 years ago.
patch to make post commit hook less verbose when using svnmerge

Download all attachments as: .zip

Change History (5)

by wr0ngway@…, 16 years ago

patch to make post commit hook less verbose when using svnmerge

comment:1 by Remy Blank, 16 years ago

Keywords: patch added; post commit svn removed
Milestone: 2.0
Owner: Jonas Borgström removed

Interesting.

comment:2 by ebray, 15 years ago

Interesting… I wrote a similar patch just a couple months ago, and didn't know about this one. It's definitely worth considering. Prior to the patch, every time I did a merge, every ticket related to the merge would get updated with a very long message containing the change messages of every change that was merged. Sure it's possible to manually edit the generated commit message, but that's inconvenient.

Here's my version of the patch:

  • trunk/OmniPoint/Source/SVNHooks/trac-post-commit-hook

     
    124124command_re = re.compile(ticket_command)
    125125ticket_re = re.compile(ticket_prefix + '([0-9]+)')
     126svnmerge_actions = ['Merged', 'Blocked', 'Unblocked', 'Recorded rollback of']
     127svnmerge_re = re.compile(r'^\(In \[\d+\]\) (?:%s) revisions [\d,-]+ via '
     128                         'svnmerge' % '|'.join(svnmerge_actions))
     129svnmerge_revsplit_re = re.compile(r'(\d),(\d)')
    126130
    127131class CommitHook:
     
    165169                    tickets.setdefault(tkt_id, []).append(func)
    166170
     171        if svnmerge_re.match(self.msg):
     172            self.msg = svnmerge_revsplit_re.sub(r'\1, \2',
     173                                                self.msg.split('\n')[0])
     174
    167175        for tkt_id, cmds in tickets.iteritems():
    168176            try:

The version of revsplit_re is to insert spaces into the comma-separated list of merged revisions, which can sometimes be very long, and otherwise won't wrap.

comment:3 by Christian Boos, 14 years ago

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:4 by Remy Blank, 14 years ago

Milestone: triaging
Resolution: wontfix
Status: newclosed

svnmerge has been replaced by svn merge and svn:mergeinfo properties. AFAIK, svn merge doesn't generate a "summary" message containing all the merged changeset messages, so this issue doesn't happen anymore.

Modify Ticket

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