Author: gstein
Date: Sat May 11 01:57:01 2024
New Revision: 1917657

URL: http://svn.apache.org/viewvc?rev=1917657&view=rev
Log:
Remove the _groups instance variable.

We actually don't need to retain an instance variable for the groups
found in the configuration file. Keep this as a local variable, and
then pass it to _prep_groups().

* tools/hook-scripts/mailer/mailer.py:
  (Config.__init__): stop using an instance variable, and just go with
    a localvar ORDERED_GROUPS. Remove the little hack that set
    ._groups early in order to create a stable ordering of instance
    variables. T3 sorts them, so this hack is no longer needed.

note: for testing purposes, we still set ._groups for now

Modified:
    subversion/trunk/tools/hook-scripts/mailer/mailer.py

Modified: subversion/trunk/tools/hook-scripts/mailer/mailer.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/tools/hook-scripts/mailer/mailer.py?rev=1917657&r1=1917656&r2=1917657&view=diff
==============================================================================
--- subversion/trunk/tools/hook-scripts/mailer/mailer.py (original)
+++ subversion/trunk/tools/hook-scripts/mailer/mailer.py Sat May 11 01:57:01 
2024
@@ -1256,14 +1256,14 @@ class Config:
     cp.read(fname)
 
     # record the (non-default) groups that we find
-    self._groups = [ ]
+    ordered_groups = [ ]
 
     for section in cp.sections():
       if not hasattr(self, section):
         section_ob = _sub_section()
         setattr(self, section, section_ob)
         if section not in self.PREDEFINED:
-          self._groups.append(section)
+            ordered_groups.append(section)
       else:
         section_ob = getattr(self, section)
       for option in cp.options(section):
@@ -1280,10 +1280,15 @@ class Config:
     # prepare maps. this may remove sections from consideration as a group.
     mapsections = self._prep_maps()
     for sectname in mapsections:
-        self._groups.remove(sectname)
+        ordered_groups.remove(sectname)
 
     # process all the group sections.
-    self._prep_groups(self._groups, repos_dir, default_params)
+    # NOTE: path-group testing and precedence is in file-order. Use a list
+    #   instead of a set to maintain the match ordering.
+    self._prep_groups(ordered_groups, repos_dir, default_params)
+
+    ### for t3, provide this instance var
+    self._groups = ordered_groups
 
   def is_set(self, option):
     """Return None if the option is not set; otherwise, its value is returned.


Reply via email to