[Python-modules-commits] [python-fastimport] 02/05: Add python3.4 support.
Jelmer Vernooij
jelmer at moszumanska.debian.org
Tue Apr 19 23:46:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
jelmer pushed a commit to branch upstream
in repository python-fastimport.
commit abd2454f12a1fc79e44577b29cd80e8d3f4a6df4
Author: Jelmer Vernooij <jelmer at jelmer.uk>
Date: Mon Apr 18 19:27:49 2016 +0000
Add python3.4 support.
---
.travis.yml | 1 +
NEWS | 4 ++++
fastimport/__init__.py | 2 +-
fastimport/commands.py | 48 ++++++++++++++++++++++-----------------
fastimport/tests/test_commands.py | 12 ++++------
setup.py | 2 +-
tox.ini | 4 ++--
7 files changed, 41 insertions(+), 32 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index cdfd7d0..b70020e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,7 @@ python:
- "2.7"
- "2.6"
- "3.5"
+ - "3.4"
- "pypy"
install:
- pip install unittest2 future
diff --git a/NEWS b/NEWS
index 96a0d02..ebc4b74 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+0.9.6 UNRELEASED
+
+ * Add python3.4 support (Jelmer Vernooij)
+
0.9.5 2016-04-18
* Add python3.5 support. (Félix Mattrat)
diff --git a/fastimport/__init__.py b/fastimport/__init__.py
index e515366..0d17622 100644
--- a/fastimport/__init__.py
+++ b/fastimport/__init__.py
@@ -30,4 +30,4 @@ it can be used by other projects. Use it like so:
processor.process(parser.parse())
"""
-__version__ = (0, 9, 5)
+__version__ = (0, 9, 6)
diff --git a/fastimport/commands.py b/fastimport/commands.py
index c09314e..b344911 100644
--- a/fastimport/commands.py
+++ b/fastimport/commands.py
@@ -27,6 +27,7 @@ import sys
from fastimport.helpers import (
newobject as object,
utf8_bytes_string,
+ repr_bytes,
)
@@ -230,14 +231,22 @@ class CommitCommand(ImportCommand):
filecommands = b''
else:
if include_file_contents:
- format_str = b'\n%r'
+ filecommands = b''.join([b'\n' + repr_bytes(c)
+ for c in self.iter_files()])
else:
- format_str = b'\n%s'
- filecommands = b''.join([format_str % (c,)
- for c in self.iter_files()])
- return b'commit %s%s%s\n%s%s%s%s%s%s' % (self.ref, mark_line,
- author_section, committer, msg_section, from_line, merge_lines,
- properties_section, filecommands)
+ filecommands = b''.join([b'\n' + str(c)
+ for c in self.iter_files()])
+ return b''.join([
+ b'commit ',
+ self.ref,
+ mark_line,
+ author_section + b'\n',
+ committer,
+ msg_section,
+ from_line,
+ merge_lines,
+ properties_section,
+ filecommands])
def dump_str(self, names=None, child_lists=None, verbose=False):
result = [ImportCommand.dump_str(self, names, verbose=verbose)]
@@ -301,8 +310,8 @@ class ResetCommand(ImportCommand):
# was needed. Always emit it, since it doesn't hurt and maintains
# compatibility with older versions.
# http://git.kernel.org/?p=git/git.git;a=commit;h=655e8515f279c01f525745d443f509f97cd805ab
- from_line = b'\nfrom %s\n' % self.from_
- return b'reset %s%s' % (self.ref, from_line)
+ from_line = b'\nfrom ' + self.from_ + b'\n'
+ return b'reset ' + self.ref + from_line
class TagCommand(ImportCommand):
@@ -318,17 +327,17 @@ class TagCommand(ImportCommand):
if self.from_ is None:
from_line = b''
else:
- from_line = b'\nfrom %s' % self.from_
+ from_line = b'\nfrom ' + self.from_
if self.tagger is None:
tagger_line = b''
else:
- tagger_line = b'\ntagger %s' % format_who_when(self.tagger)
+ tagger_line = b'\ntagger ' + format_who_when(self.tagger)
if self.message is None:
msg_section = b''
else:
msg = self.message
- msg_section = b'\ndata %d\n%s' % (len(msg), msg)
- return b'tag %s%s%s%s' % (self.id, from_line, tagger_line, msg_section)
+ msg_section = ('\ndata %d\n' % len(msg)).encode('ascii') + msg
+ return b'tag ' + self.id + from_line + tagger_line + msg_section
class FileCommand(ImportCommand):
@@ -374,9 +383,9 @@ class FileModifyCommand(FileCommand):
elif self.dataref is None:
dataref = b'inline'
if include_file_contents:
- datastr = b'\ndata %d\n%s' % (len(self.data), self.data)
+ datastr = ('\ndata %d\n' % len(self.data)).encode('ascii') + self.data
else:
- dataref = b'%s' % (self.dataref,)
+ dataref = self.dataref
path = format_path(self.path)
return b' '.join(
@@ -470,7 +479,7 @@ def format_path(p, quote_spaces=False):
quote = p[0] == b'"' or (quote_spaces and b' ' in p)
if quote:
extra = GIT_FAST_IMPORT_NEEDS_EXTRA_SPACE_AFTER_QUOTE and b' ' or b''
- p = b'"%s"%s' % (p, extra)
+ p = b'"' + p + b'"' + extra
return p
@@ -506,12 +515,9 @@ def format_property(name, value):
result = b''
utf8_name = utf8_bytes_string(name)
+ result = b'property ' + utf8_name
if value is not None:
utf8_value = utf8_bytes_string(value)
- result = b'property %s %d %s' % (
- utf8_name, len(utf8_value), utf8_value
- )
- else:
- result = b'property ' + utf8_name
+ result += b' ' + ('%d' % len(utf8_value)).encode('ascii') + b' ' + utf8_value
return result
diff --git a/fastimport/tests/test_commands.py b/fastimport/tests/test_commands.py
index 08fd764..16485eb 100644
--- a/fastimport/tests/test_commands.py
+++ b/fastimport/tests/test_commands.py
@@ -400,15 +400,15 @@ class TestNotesDisplay(TestCase):
self.assertEqual(
b"""commit refs/heads/master
mark :1
-author %(user)s
-committer %(user)s
+author Ed Mund <ed at example.org> 1234565432 +0000
+committer Ed Mund <ed at example.org> 1234565432 +0000
data 5
test
M 644 inline bar
data 0
commit refs/notes/commits
-committer %(user)s
+committer Ed Mund <ed at example.org> 1234565432 +0000
data 31
Notes added by 'git notes add'
@@ -416,16 +416,14 @@ N inline :1
data 10
Test note
commit refs/notes/test
-committer %(user)s
+committer Ed Mund <ed at example.org> 1234565432 +0000
data 31
Notes added by 'git notes add'
N inline :1
data 10
Test test
-""" % {
- b'user': b'%s <%s> %d %+05d' % committer,
-}, b''.join([repr_bytes(s) for s in commits]))
+""", b''.join([repr_bytes(s) for s in commits]))
class TestPathChecking(TestCase):
diff --git a/setup.py b/setup.py
index 1e1420c..151a09c 100755
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
from distutils.core import setup
-version = "0.9.5"
+version = "0.9.6dev"
setup(name="fastimport",
description="VCS fastimport/fastexport parser",
diff --git a/tox.ini b/tox.ini
index 16691b6..16cc2fa 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
[tox]
skipsdist = True
-envlist = py35,py26,py27
+envlist = py34,py35,py26,py27
[testenv]
commands = python -m unittest fastimport.tests.test_suite
@@ -8,4 +8,4 @@ commands = python -m unittest fastimport.tests.test_suite
[testenv:py26]
deps =
unittest2
-commands = python -m unittest2.__main__ fastimport.tests.test_suite
\ No newline at end of file
+commands = python -m unittest2.__main__ fastimport.tests.test_suite
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-fastimport.git
More information about the Python-modules-commits
mailing list