/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/git/tests/__init__.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-07-02 01:50:36 UTC
  • mfrom: (6973.13.15 python3-l)
  • Revision ID: breezy.the.bot@gmail.com-20180702015036-p7h30yemu44e4p01
Fix more tests on Python3.

Merged from https://code.launchpad.net/~jelmer/brz/python3-l/+merge/348782

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    def _create_blob(self, content):
83
83
        self._counter += 1
84
84
        from fastimport.commands import BlobCommand
85
 
        blob = BlobCommand(str(self._counter), content)
86
 
        self._write(str(blob)+"\n")
 
85
        blob = BlobCommand(b'%d' % self._counter, content)
 
86
        self._write(bytes(blob)+b"\n")
87
87
        return self._counter
88
88
 
89
89
    def set_symlink(self, path, content):
90
90
        """Create or update symlink at a given path."""
91
91
        mark = self._create_blob(content)
92
 
        mode = '120000'
93
 
        self.commit_info.append('M %s :%d %s\n'
 
92
        mode = b'120000'
 
93
        self.commit_info.append(b'M %s :%d %s\n'
94
94
                % (mode, mark, self._encode_path(path)))
95
95
 
96
96
    def set_file(self, path, content, executable):
125
125
    # TODO: Author
126
126
    # TODO: Author timestamp+timezone
127
127
    def commit(self, committer, message, timestamp=None,
128
 
               timezone='+0000', author=None,
 
128
               timezone=b'+0000', author=None,
129
129
               merge=None, base=None):
130
130
        """Commit the new content.
131
131
 
142
142
            commit.
143
143
        """
144
144
        self._counter += 1
145
 
        mark = str(self._counter)
 
145
        mark = b'%d' % self._counter
146
146
        if timestamp is None:
147
147
            timestamp = int(time.time())
148
 
        self._write('commit %s\n' % (self._branch,))
149
 
        self._write('mark :%s\n' % (mark,))
150
 
        self._write('committer %s %s %s\n'
 
148
        self._write(b'commit %s\n' % (self._branch,))
 
149
        self._write(b'mark :%s\n' % (mark,))
 
150
        self._write(b'committer %s %s %s\n'
151
151
                    % (committer, timestamp, timezone))
152
152
        message = message.encode('UTF-8')
153
 
        self._write('data %d\n' % (len(message),))
 
153
        self._write(b'data %d\n' % (len(message),))
154
154
        self._write(message)
155
 
        self._write('\n')
 
155
        self._write(b'\n')
156
156
        if base is not None:
157
 
            self._write('from :%s\n' % (base,))
 
157
            self._write(b'from :%s\n' % (base,))
158
158
        if merge is not None:
159
159
            for m in merge:
160
 
                self._write('merge :%s\n' % (m,))
 
160
                self._write(b'merge :%s\n' % (m,))
161
161
        self._writelines(self.commit_info)
162
 
        self._write('\n')
 
162
        self._write(b'\n')
163
163
        self.commit_info = []
164
164
        return mark
165
165
 
171
171
        """
172
172
        if ref is None:
173
173
            ref = self._branch
174
 
        self._write('reset %s\n' % (ref,))
 
174
        self._write(b'reset %s\n' % (ref,))
175
175
        if mark is not None:
176
 
            self._write('from :%s\n' % mark)
177
 
        self._write('\n')
 
176
            self._write(b'from :%s\n' % mark)
 
177
        self._write(b'\n')
178
178
 
179
179
    def finish(self):
180
180
        """We are finished building, close the stream, get the id mapping"""