Bug 200484

Summary: Add X- header to SVN commit mail to facilitate filtering / sorting
Product: Services Reporter: Ed Maste <emaste>
Component: Core InfrastructureAssignee: Ryan Steinmetz <zi>
Status: Closed FIXED    
Severity: Affects Only Me CC: allanjude, peter, zi
Priority: ---    
Version: unspecified   
Hardware: Any   
OS: Any   

Description Ed Maste freebsd_committer freebsd_triage 2015-05-27 15:17:33 UTC
There has been some discussion of changing the Subversion commit mail format to use part of the commit message as the subject rather than the quirky paths used today. However, to facilitate user filtering or sorting we should keep the quirky path information available.

I'd like to propose that we add an X- header, something like X-SVN-Subject or X-SVN-Path, that mirrors the current subject.
Comment 1 Glen Barber freebsd_committer freebsd_triage 2015-05-27 15:50:45 UTC
Reassign.
Comment 2 Glen Barber freebsd_committer freebsd_triage 2015-05-27 16:00:50 UTC
Set assignee back.  I misread the issue.
Comment 3 Ed Maste freebsd_committer freebsd_triage 2015-05-27 16:08:20 UTC
Proposed patch:

Index: mailer.py
===================================================================
--- mailer.py   (revision 283617)
+++ mailer.py   (working copy)
@@ -243,11 +243,12 @@
 #    hdrs = 'From: %s\n'    \
 #    hdrs = 'To: %s\n'      \
     hdrs = 'Subject: %s\n' \
+           'X-SVN-Dirs: %s\n' \
            'X-SVN-Group: %s\n' \
            'MIME-Version: 1.0\n' \
            'Content-Type: text/plain; charset=UTF-8\n' \
            'Content-Transfer-Encoding: 8bit\n' \
-           % (subject, group or "defaults")
+           % (subject, subject, group or "defaults")
 #           % (self.from_addr, string.join(self.to_addrs, ', '), subject)
     if self.reply_to:
       hdrs = '%sReply-To: %s\n' % (hdrs, self.reply_to)
Comment 4 Peter Wemm freebsd_committer freebsd_triage 2016-01-18 03:59:10 UTC
Patches are welcome - the code is in the svn tree for the commit mail generator.
Comment 5 Ed Maste freebsd_committer freebsd_triage 2016-01-25 01:06:15 UTC
> Patches are welcome - the code is in the svn tree for the commit mail generator.

There's a patch above in comment #3 -- is it not suitable?
Comment 6 Ed Maste freebsd_committer freebsd_triage 2016-03-21 18:09:07 UTC
Ping?
Comment 7 Ed Maste freebsd_committer freebsd_triage 2016-06-13 15:17:23 UTC
Ping?
Comment 8 Ed Maste freebsd_committer freebsd_triage 2017-06-24 00:37:04 UTC
Ping?
Comment 9 Ryan Steinmetz freebsd_committer freebsd_triage 2017-06-24 14:30:40 UTC
Just checked out the patch and, unless I am mistaken, this will just copy the entire subject of the email to a new header called X-SVN-Dirs.

So X-SVN-Dirs would be "svn commit: r320309 - stable/11/sys/i386/isa"

Do you want X-SVN-Dirs set to "stable/11/sys/i386/isa?"
Comment 10 Allan Jude freebsd_committer freebsd_triage 2017-06-24 18:43:38 UTC
IIANM this is the intention. The ultimate goal is to replace the subject line with the headline of the commit, but preserve the original subject line in a header so that existing mail sorting rules can easily be adapted.
Comment 11 Ed Maste freebsd_committer freebsd_triage 2017-06-24 18:50:12 UTC
Allan is correct, the goal is to allow straightforward conversion of any existing filtering rules.

Maybe "X-SVN-Info" would be a better name?
Comment 12 commit-hook freebsd_committer freebsd_triage 2017-06-27 16:05:58 UTC
A commit references this bug:

Author: zi
Date: Tue Jun 27 16:05:11 UTC 2017
New revision: 320410
URL: https://svnweb.freebsd.org/changeset/base/320410

Log:
  - Add in additional X-SVN-* headers to assist with mail sorting

  PR:		200484
  Requested by:	emaste

Changes:
  svnadmin/hooks/scripts/mailer.py
Comment 13 commit-hook freebsd_committer freebsd_triage 2017-06-27 16:10:08 UTC
A commit references this bug:

Author: zi
Date: Tue Jun 27 16:09:35 UTC 2017
New revision: 444474
URL: https://svnweb.freebsd.org/changeset/ports/444474

Log:
  - Add in additional X-SVN-* headers to assist with mail sorting

  PR:		200484
  Requested by:	emaste
  Approved by:	portmgr (me, wearing clusteradm hat)

Changes:
  svnadmin/hooks/scripts/mailer.py
Comment 14 Ryan Steinmetz freebsd_committer freebsd_triage 2017-06-27 16:15:35 UTC
I took your original idea and broke it out to follow the existing headers that other projects use, as well as add in X-SVN-Paths to capture the path information.

This should give everyone more flexibility while maintaining the ability to filter on whatever they want, hopefully now with more ease.

Please let me know if this change meets your needs.
Comment 15 Ryan Steinmetz freebsd_committer freebsd_triage 2017-06-27 16:17:18 UTC
(In reply to Ryan Steinmetz from comment #14)
Examples of the new headers in use:

X-SVN-Commit-Author: sunpoet                      
X-SVN-Commit-Paths: head/www/rubygem-actioncable5                      
X-SVN-Commit-Revision: 444488                      
X-SVN-Commit-Repository: ports 

X-SVN-Group: svnadmin
X-SVN-Commit-Author: zi
X-SVN-Commit-Paths: svnadmin/hooks/scripts
X-SVN-Commit-Revision: 320410
X-SVN-Commit-Repository: base
Comment 16 commit-hook freebsd_committer freebsd_triage 2017-06-27 16:41:35 UTC
A commit references this bug:

Author: zi
Date: Tue Jun 27 16:41:00 UTC 2017
New revision: 50411
URL: https://svnweb.freebsd.org/changeset/doc/50411

Log:
  - Add in additional X-SVN-* headers to assist with mail sorting

  PR:		200484
  Requested by:	emaste

Changes:
  svnadmin/hooks/scripts/mailer.py
Comment 17 Ryan Steinmetz freebsd_committer freebsd_triage 2017-06-27 16:42:36 UTC
Confirmed as fixed via IRC w/submitter.