Author: dsahlberg
Date: Mon Mar 10 08:47:35 2025
New Revision: 1924263
URL: http://svn.apache.org/viewvc?rev=1924263&view=rev
Log:
Make sure newly added backport entry is sorted at the end of the section.
* tools/dist/backport/status.py:
(StatusFile.insert): As above
Modified:
subversion/trunk/tools/dist/backport/status.py
Modified: subversion/trunk/tools/dist/backport/status.py
URL:
http://svn.apache.org/viewvc/subversion/trunk/tools/dist/backport/status.py?rev=1924263&r1=1924262&r2=1924263&view=diff
==============================================================================
--- subversion/trunk/tools/dist/backport/status.py (original)
+++ subversion/trunk/tools/dist/backport/status.py Mon Mar 10 08:47:35 2025
@@ -244,20 +244,25 @@ class StatusFile:
# Find an existing section header to insert the new entry
i = 0
+ correct_header = False
while i < len(self.paragraphs):
- if self.paragraphs[i].kind is Kind.section_header \
- and self.paragraphs[i]._containing_section == containing_section:
- self.paragraphs.insert(i+1, p)
- return
+ if self.paragraphs[i].kind is Kind.section_header:
+ if self.paragraphs[i]._containing_section == containing_section:
+ correct_header = True
+ elif correct_header:
+ self.paragraphs.insert(i, p)
+ correct_header = False
+ return
i += 1
- # None found so we need to append a new header followed by the new entry
- self.paragraphs.append(Paragraph(Kind.section_header,
- containing_section + ":\n" \
- + '=' * (len(containing_section)+1) +
"\n",
- None,
- containing_section)
- )
+ if not correct_header:
+ # None found so we need to append a new header followed by the new entry
+ self.paragraphs.append(Paragraph(Kind.section_header,
+ containing_section + ":\n" \
+ + '=' * (len(containing_section)+1) +
"\n",
+ None,
+ containing_section)
+ )
self.paragraphs.append(p)
def remove(self, entry):