Patchwork [1,of,3,STABLE] py3: use mail.parsebytes() in gnuarch catlog parser

login
register
mail settings
Submitter Denis Laxalde
Date Nov. 4, 2019, 9:18 a.m.
Message ID <b09e0c3c51f1d819eaae.1572859124@marimba>
Download mbox | patch
Permalink /patch/42705/
State Accepted
Headers show

Comments

Denis Laxalde - Nov. 4, 2019, 9:18 a.m.
# HG changeset patch
# User Denis Laxalde <denis@laxalde.org>
# Date 1572857533 -3600
#      Mon Nov 04 09:52:13 2019 +0100
# Branch stable
# Node ID b09e0c3c51f1d819eaaec188a5c9e26219294586
# Parent  579672b347d2169a4abfb372873972a0fd6a839c
py3: use mail.parsebytes() in gnuarch catlog parser

We drop 'catlogparser' attribute now unused.
Yuya Nishihara - Nov. 4, 2019, 1:25 p.m.
On Mon, 04 Nov 2019 10:18:44 +0100, Denis Laxalde wrote:
> # HG changeset patch
> # User Denis Laxalde <denis@laxalde.org>
> # Date 1572857533 -3600
> #      Mon Nov 04 09:52:13 2019 +0100
> # Branch stable
> # Node ID b09e0c3c51f1d819eaaec188a5c9e26219294586
> # Parent  579672b347d2169a4abfb372873972a0fd6a839c
> py3: use mail.parsebytes() in gnuarch catlog parser

Queued for stable, many thanks.

Patch

diff --git a/hgext/convert/gnuarch.py b/hgext/convert/gnuarch.py
--- a/hgext/convert/gnuarch.py
+++ b/hgext/convert/gnuarch.py
@@ -7,7 +7,6 @@ 
 # GNU General Public License version 2 or any later version.
 from __future__ import absolute_import
 
-import email.parser as emailparser
 import os
 import shutil
 import stat
@@ -17,6 +16,7 @@  from mercurial.i18n import _
 from mercurial import (
     encoding,
     error,
+    mail,
     pycompat,
     util,
 )
@@ -69,7 +69,6 @@  class gnuarch_source(common.converter_so
         self.changes = {}
         self.parents = {}
         self.tags = {}
-        self.catlogparser = emailparser.Parser()
         self.encoding = encoding.encoding
         self.archives = []
 
@@ -299,7 +298,7 @@  class gnuarch_source(common.converter_so
 
     def _parsecatlog(self, data, rev):
         try:
-            catlog = self.catlogparser.parsestr(data)
+            catlog = mail.parsebytes(data)
 
             # Commit date
             self.changes[rev].date = dateutil.datestr(