On Thu, Dec 31, 2009 at 06:38:34PM -0200, casca...@cascardo.info wrote:
> tags 172113 + patch
> thanks
> 
> Hello, folks.
> 
> I've prepared an NMU which is at [1]. It fixes bug 172113. Since the
> original patch has been tested for some time in my own machine, and this
> new version has been tested a little too, I consider it's safe to do the
> upload.
> 
> As both Pierre and Christian are in the LowThresholdNMU, I will ask my
> AM or a friend to do the upload next year. :-)
> 
> Regards,
> Cascardo.
> 
> [1] http://cascardo.info/debian/apt-listchanges_2.83+nmu2.dsc

Sorry, last diff contained .git directory. I've fixed it already and sent the
fixed package to the appointed location and I am attaching the fixed diff.

Regards,
Cascardo.
diff -Nru apt-listchanges-2.83+nmu1/apt-listchanges/ALCConfig.py apt-listchanges-2.83+nmu2/apt-listchanges/ALCConfig.py
--- apt-listchanges-2.83+nmu1/apt-listchanges/ALCConfig.py	2009-09-22 15:40:24.000000000 -0300
+++ apt-listchanges-2.83+nmu2/apt-listchanges/ALCConfig.py	2009-12-31 17:46:11.000000000 -0200
@@ -47,6 +47,7 @@
         self.which = 'both'
         self.allowed_which = ('both', 'news', 'changelogs')
         self.since = None
+        self.reverse = False
 
     def read(self, file):
         self.parser = ConfigParser.ConfigParser()
@@ -57,7 +58,7 @@
             for option in self.parser.options(self.profile):
                 value = None
                 if self.parser.has_option(self.profile, option):
-                    if option in ('confirm', 'run', 'show_all', 'headers', 'verbose'):
+                    if option in ('confirm', 'run', 'show_all', 'headers', 'verbose', 'reverse'):
                         value = self.parser.getboolean(self.profile, option)
                     else:
                         value = self.parser.get(self.profile, option)
@@ -81,7 +82,7 @@
             (optlist, args) = getopt.getopt(argv[1:], 'vf:s:cah', [
                 "apt", "verbose", "frontend=", "email-address=", "confirm",
                 "all", "headers", "save_seen=", "since=", "debug", "which=",
-                "help", "profile="])
+                "help", "profile=", "reverse"])
         except getopt.GetoptError:
             return None
 
@@ -134,6 +135,8 @@
                     sys.exit(1)
             elif opt == '--debug':
                 self.debug = 1
+            elif opt == '--reverse':
+                self.reverse = 1
 
         if self.email_address == 'none':
             self.email_address = None
diff -Nru apt-listchanges-2.83+nmu1/apt-listchanges/DebianFiles.py apt-listchanges-2.83+nmu2/apt-listchanges/DebianFiles.py
--- apt-listchanges-2.83+nmu1/apt-listchanges/DebianFiles.py	2009-09-22 15:40:24.000000000 -0300
+++ apt-listchanges-2.83+nmu2/apt-listchanges/DebianFiles.py	2009-12-31 17:46:11.000000000 -0200
@@ -110,7 +110,7 @@
         self.source  = pkgdata.source()
         self.Version = pkgdata.Version
 
-    def extract_changes(self, which, since_version=None):
+    def extract_changes(self, which, since_version=None, reverse=None):
         '''Extract changelog entries, news or both from the package.
         If since_version is specified, only return entries later than the specified version.
         returns a sequence of Changes objects.'''
@@ -128,7 +128,7 @@
 
         tempdir = self.extract_contents(filenames)
 
-        find_first = lambda acc, fname: acc or self.read_changelog(os.path.join(tempdir, fname), since_version)
+        find_first = lambda acc, fname: acc or self.read_changelog(os.path.join(tempdir, fname), since_version, reverse)
 
         news       = reduce(find_first, news_filenames, None)
         changelog  = reduce(find_first, changelog_filenames + changelog_filenames_native, None)
@@ -151,7 +151,7 @@
 
         return tempdir
 
-    def read_changelog(self, filename, since_version):
+    def read_changelog(self, filename, since_version, reverse=False):
         filenames = glob.glob(filename)
 
         fd = None
@@ -175,10 +175,13 @@
 
         urgency = numeric_urgency('low')
         changes = ''
+        rev = []
         is_debian_changelog = 0
         for line in fd.readlines():
             match = self.changelog_header.match(line)
             if match:
+                rev += [changes]
+                changes = ''
                 is_debian_changelog = 1
                 if since_version:
                     if apt_pkg.VersionCompare(match.group('version'),
@@ -192,6 +195,10 @@
         if not is_debian_changelog:
             return None
 
+        if reverse:
+            rev.reverse()
+        changes = "".join(rev)
+
         return Changes(self.source, changes, urgency)
 
     def _changelog_variations(self, filename):
diff -Nru apt-listchanges-2.83+nmu1/apt-listchanges.py apt-listchanges-2.83+nmu2/apt-listchanges.py
--- apt-listchanges-2.83+nmu1/apt-listchanges.py	2009-09-22 15:40:24.000000000 -0300
+++ apt-listchanges-2.83+nmu2/apt-listchanges.py	2009-12-31 17:46:11.000000000 -0200
@@ -132,7 +132,7 @@
                                                                       srcversion))
             continue
 
-        (news, changelog) = pkg.extract_changes(config.which, fromversion)
+        (news, changelog) = pkg.extract_changes(config.which, fromversion, config.reverse)
 
         if news or changelog:
             found[srcpackage] = 1
diff -Nru apt-listchanges-2.83+nmu1/debian/changelog apt-listchanges-2.83+nmu2/debian/changelog
--- apt-listchanges-2.83+nmu1/debian/changelog	2009-09-30 01:03:03.000000000 -0300
+++ apt-listchanges-2.83+nmu2/debian/changelog	2009-12-31 18:22:18.000000000 -0200
@@ -1,3 +1,11 @@
+apt-listchanges (2.83+nmu2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Introduce the --reverse option to list entries in the reverse order.
+    Closes: #172113
+
+ -- Thadeu Lima de Souza Cascardo <casca...@minaslivre.org>  Thu, 31 Dec 2009 17:58:25 -0200
+
 apt-listchanges (2.83+nmu1) unstable; urgency=low
 
   * Non-maintainer upload with maintainer's agreement

Attachment: signature.asc
Description: Digital signature

Reply via email to