/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 commit.py

Add helper function, always set encoding to utf-8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
            if entry is None:
117
117
                del self._blobs[path]
118
118
 
 
119
    def _iterblobs(self):
 
120
        return ((path, sha, mode) for (path, (mode, sha)) in self._blobs.iteritems())
 
121
 
119
122
    def commit(self, message):
120
123
        c = Commit()
121
124
        c.parents = [self.repository.lookup_bzr_revision_id(revid)[0] for revid in self.parents]
122
 
        c.tree = commit_tree(self.store,
123
 
                [(path, sha, mode) for (path, (mode, sha)) in self._blobs.iteritems()])
 
125
        c.tree = commit_tree(self.store, self._iterblobs())
124
126
        c.committer = self._committer
125
127
        c.author = self._revprops.get('author', self._committer)
126
128
        c.commit_time = int(self._timestamp)
127
129
        c.author_time = int(self._timestamp)
128
130
        c.commit_timezone = self._timezone
129
131
        c.author_timezone = self._timezone
 
132
        c.encoding = 'utf-8'
130
133
        c.message = message.encode("utf-8")
131
134
        self.store.add_object(c)
132
135
        self._new_revision_id = self.repository.get_mapping().revision_id_foreign_to_bzr(c.id)