You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "Humbedooh (via GitHub)" <gi...@apache.org> on 2025/08/14 15:07:21 UTC

[PR] Support the suppress_if_match option from old svn-mailer [subversion]

Humbedooh opened a new pull request, #35:
URL: https://github.com/apache/subversion/pull/35

   suppress_if_match is/was used to suppress emails if a later mailer section also matches the current svn event, thus allowing the first section(s) to act as a fallback if no other, more specific section matches. 
   
   This brings back that functionality, avoiding duplicate emails for configurations that make use of suppress_if_match


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "Humbedooh (via GitHub)" <gi...@apache.org>.
Humbedooh commented on PR #35:
URL: https://github.com/apache/subversion/pull/35#issuecomment-3190735779

   The original work, I believe, is https://opensource.perlig.de/svnmailer/ which also explains how suppress_if_match works


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "sebbASF (via GitHub)" <gi...@apache.org>.
sebbASF commented on code in PR #35:
URL: https://github.com/apache/subversion/pull/35#discussion_r2286999394


##########
tools/hook-scripts/mailer/mailer.py:
##########
@@ -1442,32 +1443,48 @@ def repos_params(section_name, defaults):
         search_logmsg_re = re.compile(search_logmsg)
       else:
         search_logmsg_re = None
-
-      self._group_re.append((group,
-                             re.compile(for_paths),
-                             exclude_paths_re,
-                             params,
-                             search_logmsg_re))
+      suppress_if_match = getattr(sub, 'suppress_if_match', None)
+      if suppress_if_match == 'yes':
+        self._last_group_re.append((group,
+                                    re.compile(for_paths),
+                                    exclude_paths_re,
+                                    params,
+                                    search_logmsg_re,
+                                    True)) # Ignore if already matched
+      else:
+        self._group_re.append((group,
+                               re.compile(for_paths),
+                               exclude_paths_re,
+                               params,
+                               search_logmsg_re,
+                               False))

Review Comment:
   Regarding the use of 'yes': several other options behave in the same way.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "brainy (via GitHub)" <gi...@apache.org>.
brainy commented on code in PR #35:
URL: https://github.com/apache/subversion/pull/35#discussion_r2278419037


##########
tools/hook-scripts/mailer/mailer.py:
##########
@@ -1442,32 +1443,48 @@ def repos_params(section_name, defaults):
         search_logmsg_re = re.compile(search_logmsg)
       else:
         search_logmsg_re = None
-
-      self._group_re.append((group,
-                             re.compile(for_paths),
-                             exclude_paths_re,
-                             params,
-                             search_logmsg_re))
+      suppress_if_match = getattr(sub, 'suppress_if_match', None)
+      if suppress_if_match == 'yes':
+        self._last_group_re.append((group,
+                                    re.compile(for_paths),
+                                    exclude_paths_re,
+                                    params,
+                                    search_logmsg_re,
+                                    True)) # Ignore if already matched
+      else:
+        self._group_re.append((group,
+                               re.compile(for_paths),
+                               exclude_paths_re,
+                               params,
+                               search_logmsg_re,
+                               False))

Review Comment:
   Ugh, this is not nice. Remove the `if`.
   
   ```
   self._last_group_re.append((group,
                               re.compile(for_paths),
                               exclude_paths_re,
                               params,
                               search_logmsg_re,
                               # Ignore if already matched
                               suppress_if_match == 'yes'))
   ```
   
   Also, what guarantee is there that the true-value of `suppress_if_match` can only be `yes`? All I see is a new config option used in the code. Needs updated documentation in `mailer.conf.example`.



##########
tools/hook-scripts/mailer/mailer.py:
##########
@@ -1442,32 +1443,48 @@ def repos_params(section_name, defaults):
         search_logmsg_re = re.compile(search_logmsg)
       else:
         search_logmsg_re = None
-
-      self._group_re.append((group,
-                             re.compile(for_paths),
-                             exclude_paths_re,
-                             params,
-                             search_logmsg_re))
+      suppress_if_match = getattr(sub, 'suppress_if_match', None)
+      if suppress_if_match == 'yes':
+        self._last_group_re.append((group,
+                                    re.compile(for_paths),
+                                    exclude_paths_re,
+                                    params,
+                                    search_logmsg_re,
+                                    True)) # Ignore if already matched
+      else:
+        self._group_re.append((group,
+                               re.compile(for_paths),
+                               exclude_paths_re,
+                               params,
+                               search_logmsg_re,
+                               False))
 
     # after all the groups are done, add in the default group
     try:
-      self._group_re.append((None,
+      self._last_group_re.append((None,
                              re.compile(self.defaults.for_paths),

Review Comment:
   Fix function argument indentation, please.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "sebbASF (via GitHub)" <gi...@apache.org>.
sebbASF commented on PR #35:
URL: https://github.com/apache/subversion/pull/35#issuecomment-3190052167

   https://github.com/apache/infrastructure-p6/blob/2059051d4af3256cfc752a8b8312d29fcb770111/modules/subversion_server/files/hooks/mailer.py


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "brainy (via GitHub)" <gi...@apache.org>.
brainy commented on code in PR #35:
URL: https://github.com/apache/subversion/pull/35#discussion_r2287059203


##########
tools/hook-scripts/mailer/mailer.py:
##########
@@ -1442,32 +1443,48 @@ def repos_params(section_name, defaults):
         search_logmsg_re = re.compile(search_logmsg)
       else:
         search_logmsg_re = None
-
-      self._group_re.append((group,
-                             re.compile(for_paths),
-                             exclude_paths_re,
-                             params,
-                             search_logmsg_re))
+      suppress_if_match = getattr(sub, 'suppress_if_match', None)
+      if suppress_if_match == 'yes':
+        self._last_group_re.append((group,
+                                    re.compile(for_paths),
+                                    exclude_paths_re,
+                                    params,
+                                    search_logmsg_re,
+                                    True)) # Ignore if already matched
+      else:
+        self._group_re.append((group,
+                               re.compile(for_paths),
+                               exclude_paths_re,
+                               params,
+                               search_logmsg_re,
+                               False))

Review Comment:
   Indeed they have and they're documented in `mailer.conf.example`. This one should be, too.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "dsahlberg-apache-org (via GitHub)" <gi...@apache.org>.
dsahlberg-apache-org commented on PR #35:
URL: https://github.com/apache/subversion/pull/35#issuecomment-3189826147

   Just curious. What is the "old svn-mailer"? I can't find this option in mailer.py (I tried to bisect the history up to gstein's work 2023/2024) but couldn't find it. Is it some ASF/Infra-local version?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Support the suppress_if_match option from old svn-mailer [subversion]

Posted by "brainy (via GitHub)" <gi...@apache.org>.
brainy commented on code in PR #35:
URL: https://github.com/apache/subversion/pull/35#discussion_r2278431338


##########
tools/hook-scripts/mailer/mailer.py:
##########
@@ -1442,32 +1443,48 @@ def repos_params(section_name, defaults):
         search_logmsg_re = re.compile(search_logmsg)
       else:
         search_logmsg_re = None
-
-      self._group_re.append((group,
-                             re.compile(for_paths),
-                             exclude_paths_re,
-                             params,
-                             search_logmsg_re))
+      suppress_if_match = getattr(sub, 'suppress_if_match', None)
+      if suppress_if_match == 'yes':
+        self._last_group_re.append((group,
+                                    re.compile(for_paths),
+                                    exclude_paths_re,
+                                    params,
+                                    search_logmsg_re,
+                                    True)) # Ignore if already matched
+      else:
+        self._group_re.append((group,
+                               re.compile(for_paths),
+                               exclude_paths_re,
+                               params,
+                               search_logmsg_re,
+                               False))

Review Comment:
   Belay that suggested code change, I'm blind. The docco request stands, though.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@subversion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org