pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/py-fastimport Add an option for patching up the ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/37f933d4c335
branches:  trunk
changeset: 365778:37f933d4c335
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Jul 25 16:10:53 2017 +0000

description:
Add an option for patching up the encoding of commit messages.
Bump revision.

diffstat:

 devel/py-fastimport/Makefile                           |   3 +-
 devel/py-fastimport/distinfo                           |   3 +-
 devel/py-fastimport/patches/patch-fastimport_parser.py |  45 ++++++++++++++++++
 3 files changed, 49 insertions(+), 2 deletions(-)

diffs (74 lines):

diff -r 34f380eb08c4 -r 37f933d4c335 devel/py-fastimport/Makefile
--- a/devel/py-fastimport/Makefile      Tue Jul 25 16:09:40 2017 +0000
+++ b/devel/py-fastimport/Makefile      Tue Jul 25 16:10:53 2017 +0000
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.5 2017/07/14 10:26:50 adam Exp $
+# $NetBSD: Makefile,v 1.6 2017/07/25 16:10:53 joerg Exp $
 
 DISTNAME=      fastimport-0.9.6
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 CATEGORIES=    devel scm
 MASTER_SITES=  ${MASTER_SITE_PYPI:=f/fastimport/}
 
diff -r 34f380eb08c4 -r 37f933d4c335 devel/py-fastimport/distinfo
--- a/devel/py-fastimport/distinfo      Tue Jul 25 16:09:40 2017 +0000
+++ b/devel/py-fastimport/distinfo      Tue Jul 25 16:10:53 2017 +0000
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.3 2017/07/14 10:26:50 adam Exp $
+$NetBSD: distinfo,v 1.4 2017/07/25 16:10:53 joerg Exp $
 
 SHA1 (fastimport-0.9.6.tar.gz) = b6d52ae8cc1d76c1db8d4f416fc4b334ad5fe568
 RMD160 (fastimport-0.9.6.tar.gz) = 1ca2b8486c5b6b7a76bbeca6b967c78dd4211aca
 SHA512 (fastimport-0.9.6.tar.gz) = cc38c1218d65ef4a9e3a68d8af3fadf98c7cc0dcd8075b338b8f492d25765bc2fe2247000868fd3c95e1f7f4c2b9a05964ef7b4f9196c2777f6a7941f127f416
 Size (fastimport-0.9.6.tar.gz) = 33333 bytes
+SHA1 (patch-fastimport_parser.py) = 830a12da3ef6939cfd37624eb7765f40a0d0ee8a
diff -r 34f380eb08c4 -r 37f933d4c335 devel/py-fastimport/patches/patch-fastimport_parser.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/py-fastimport/patches/patch-fastimport_parser.py    Tue Jul 25 16:10:53 2017 +0000
@@ -0,0 +1,45 @@
+$NetBSD: patch-fastimport_parser.py,v 1.1 2017/07/25 16:10:53 joerg Exp $
+
+--- fastimport/parser.py.orig  2016-04-18 18:09:28.000000000 +0000
++++ fastimport/parser.py
+@@ -265,7 +265,7 @@ _WHO_RE = re.compile(br'([^<]*)<(.*)>')
+ class ImportParser(LineBasedParser):
+ 
+     def __init__(self, input_stream, verbose=False, output=sys.stdout,
+-        user_mapper=None, strict=True):
++        user_mapper=None, strict=True, message_fallback_encoding = None):
+         """A Parser of import commands.
+ 
+         :param input_stream: the file-like object to read from
+@@ -283,6 +283,7 @@ class ImportParser(LineBasedParser):
+         # We auto-detect the date format when a date is first encountered
+         self.date_parser = None
+         self.features = {}
++        self.message_fallback_encoding = message_fallback_encoding
+ 
+     def warning(self, msg):
+         sys.stderr.write("warning line %d: %s\n" % (self.lineno, msg))
+@@ -368,6 +369,11 @@ class ImportParser(LineBasedParser):
+                 break
+         committer = self._get_user_info(b'commit', b'committer')
+         message = self._get_data(b'commit', b'message')
++        if self.message_fallback_encoding:
++            try:
++                message.decode('UTF-8')
++            except:
++                message = message.decode(self.message_fallback_encoding).encode('UTF-8')
+         from_ = self._get_from()
+         merges = []
+         while True:
+@@ -432,6 +438,11 @@ class ImportParser(LineBasedParser):
+         tagger = self._get_user_info(b'tag', b'tagger',
+                 accept_just_who=True)
+         message = self._get_data(b'tag', b'message')
++        if self.message_fallback_encoding:
++            try:
++                message.decode('UTF-8')
++            except:
++                message = message.decode(self.message_fallback_encoding).encode('UTF-8')
+         return commands.TagCommand(name, from_, tagger, message)
+ 
+     def _get_mark_if_any(self):



Home | Main Index | Thread Index | Old Index