summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Roche <phil.roche@canonical.com>2016-06-07 16:56:28 +0100
committerPhilip Roche <phil.roche@canonical.com>2016-06-07 16:56:28 +0100
commit4500170c1d821f8c944252483a917d5c6863244e (patch)
tree1f3e101bbdfb5e014a84a8ccd3fc4a3545a09dc9
parent8163c919c4ecf8009e8123230f6e67bb0e8a58a1 (diff)
downloadpython-fastimport-git-4500170c1d821f8c944252483a917d5c6863244e.tar.gz
Check if commit id is an int, if so then convert to byte string
-rw-r--r--fastimport/commands.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/fastimport/commands.py b/fastimport/commands.py
index b344911..7f29599 100644
--- a/fastimport/commands.py
+++ b/fastimport/commands.py
@@ -162,10 +162,13 @@ class CommitCommand(ImportCommand):
self.lineno = lineno
self._binary = [b'file_iter']
# Provide a unique id in case the mark is missing
- if mark is None:
+ if self.mark is None:
self.id = b'@' + ('%d' % lineno).encode('utf-8')
else:
- self.id = b':' + mark
+ if isinstance(self.mark, (int)):
+ self.id = b':' + str(self.mark).encode('utf-8')
+ else:
+ self.id = b':' + self.mark
def copy(self, **kwargs):
if not isinstance(self.file_iter, list):
@@ -194,7 +197,11 @@ class CommitCommand(ImportCommand):
if self.mark is None:
mark_line = b''
else:
- mark_line = b'\nmark :' + self.mark
+ if isinstance(self.mark, (int)):
+ mark_line = b'\nmark :' + str(self.mark).encode('utf-8')
+ else:
+ mark_line = b'\nmark :' + self.mark
+
if self.author is None:
author_section = b''
else: