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

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2018-11-16 18:59:44 UTC
  • mfrom: (7143.15.15 more-cleanups)
  • Revision ID: breezy.the.bot@gmail.com-20181116185944-biefv1sub37qfybm
Sprinkle some PEP8iness.

Merged from https://code.launchpad.net/~jelmer/brz/more-cleanups/+merge/358611

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
class SettingCustomFileIdsUnsupported(UnsupportedOperation):
60
60
 
61
 
    _fmt = "Unable to store addition of file with custom file ids: %(file_ids)r"
 
61
    _fmt = ("Unable to store addition of file with custom file ids: "
 
62
            "%(file_ids)r")
62
63
 
63
64
    def __init__(self, file_ids):
64
65
        BzrError.__init__(self)
89
90
        for (file_id, path, changed_content, versioned, parent, name, kind,
90
91
             executable) in iter_changes:
91
92
            if kind[1] in ("directory",):
92
 
                self._inv_delta.append((path[0], path[1], file_id, entry_factory[kind[1]](file_id, name[1], parent[1])))
 
93
                self._inv_delta.append(
 
94
                    (path[0], path[1], file_id, entry_factory[kind[1]](
 
95
                        file_id, name[1], parent[1])))
93
96
                if kind[0] in ("file", "symlink"):
94
97
                    self._blobs[path[0].encode("utf-8")] = None
95
98
                    self._any_changes = True
181
184
                if self._mapping.BZR_FILE_IDS_FILE is None:
182
185
                    raise SettingCustomFileIdsUnsupported(fileid_map)
183
186
                self.store.add_object(fileid_blob)
184
 
                self._blobs[self._mapping.BZR_FILE_IDS_FILE] = (stat.S_IFREG | 0o644, fileid_blob.id)
 
187
                self._blobs[self._mapping.BZR_FILE_IDS_FILE] = (
 
188
                    stat.S_IFREG | 0o644, fileid_blob.id)
185
189
            else:
186
190
                self._blobs[self._mapping.BZR_FILE_IDS_FILE] = None
187
191
        self.new_inventory = None
192
196
 
193
197
    def finish_inventory(self):
194
198
        # eliminate blobs that were removed
195
 
        self._blobs = {k: v for (k, v) in viewitems(self._blobs) if v is not None}
 
199
        self._blobs = {k: v for (k, v) in viewitems(
 
200
            self._blobs) if v is not None}
196
201
 
197
202
    def _iterblobs(self):
198
 
        return ((path, sha, mode) for (path, (mode, sha)) in viewitems(self._blobs))
 
203
        return ((path, sha, mode) for (path, (mode, sha))
 
204
                in viewitems(self._blobs))
199
205
 
200
206
    def commit(self, message):
201
207
        self._validate_unicode_text(message, 'commit message')
202
208
        c = Commit()
203
 
        c.parents = [self.repository.lookup_bzr_revision_id(revid)[0] for revid in self.parents]
 
209
        c.parents = [self.repository.lookup_bzr_revision_id(
 
210
            revid)[0] for revid in self.parents]
204
211
        c.tree = commit_tree(self.store, self._iterblobs())
205
212
        encoding = self._revprops.pop(u'git-explicit-encoding', 'utf-8')
206
213
        c.encoding = encoding.encode('ascii')
227
234
        c.commit_timezone = self._timezone
228
235
        c.author_timezone = self._timezone
229
236
        c.message = message.encode(encoding)
230
 
        if self._config_stack.get('create_signatures') == _mod_config.SIGN_ALWAYS:
 
237
        if (self._config_stack.get('create_signatures') ==
 
238
                _mod_config.SIGN_ALWAYS):
231
239
            strategy = gpg.GPGStrategy(self._config_stack)
232
240
            c.gpgsig = strategy.sign(c.as_raw_string(), gpg.MODE_DETACH)
233
241
        self.store.add_object(c)