/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

More work on roundtrip push support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009 Jelmer Vernooij <jelmer@samba.org>
 
1
# Copyright (C) 2009-2010 Jelmer Vernooij <jelmer@samba.org>
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
112
112
 
113
113
    def finish_inventory(self):
114
114
        # eliminate blobs that were removed
115
 
        for path, entry in self._blobs.iteritems():
 
115
        for path, entry in iter(self._blobs.items()):
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)