diff options
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/fastimport.py | 11 | ||||
-rw-r--r-- | gbp/git/repository.py | 3 |
2 files changed, 8 insertions, 6 deletions
diff --git a/gbp/git/fastimport.py b/gbp/git/fastimport.py index 40433700..a9941036 100644 --- a/gbp/git/fastimport.py +++ b/gbp/git/fastimport.py @@ -20,6 +20,7 @@ import subprocess import time from gbp.errors import GbpError +from gbp.format import format_b from gbp.paths import to_bin @@ -48,7 +49,7 @@ class FastImport(object): "Invalid argument when spawning git fast-import: %s" % err) def _do_data(self, fd, size): - self._out.write(b"data %d\n" % size) + self._out.write(format_b(b"data %d\n", size)) while True: data = fd.read(self._bufsize) self._out.write(data) @@ -58,7 +59,7 @@ class FastImport(object): def _do_file(self, filename, mode, fd, size): name = b"/".join(to_bin(filename).split(b'/')[1:]) - self._out.write(b"M %d inline %s\n" % (mode, name)) + self._out.write(format_b(b"M %d inline %s\n", mode, name)) self._do_data(fd, size) def add_file(self, filename, fd, size, mode=m_regular): @@ -87,9 +88,9 @@ class FastImport(object): """ linktarget = to_bin(linktarget) linkname = to_bin(linkname) - self._out.write(b"M %d inline %s\n" % (self.m_symlink, linkname)) - self._out.write(b"data %d\n" % len(linktarget)) - self._out.write(b"%s\n" % linktarget) + self._out.write(format_b(b"M %d inline %s\n", self.m_symlink, linkname)) + self._out.write(format_b(b"data %d\n", len(linktarget))) + self._out.write(format_b(b"%s\n", linktarget)) def start_commit(self, branch, committer, msg): """ diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 3c858fa9..397ee9c9 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -24,6 +24,7 @@ from collections import defaultdict import gbp.log as log from gbp.errors import GbpError +from gbp.format import format_b from gbp.git.modifier import GitModifier from gbp.git.commit import GitCommit from gbp.git.errors import GitError @@ -1044,7 +1045,7 @@ class GitRepository(object): for mode, type_, sha1, name in contents: name = to_bin(name) - objs += b'%s %s %s\t%s\0' % (mode.encode(), type_.encode(), sha1.encode(), name) + objs += format_b(b'%s %s %s\t%s\0', mode.encode(), type_.encode(), sha1.encode(), name) sha1, err, ret = self._git_inout('mktree', args.args, |