/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/memorytree.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:
44
44
from .mapping import GitFileIdMap
45
45
from .tree import MutableGitIndexTree
46
46
 
47
 
class GitMemoryTree(MutableGitIndexTree,_mod_tree.Tree):
 
47
 
 
48
class GitMemoryTree(MutableGitIndexTree, _mod_tree.Tree):
48
49
    """A Git memory tree."""
49
50
 
50
51
    def __init__(self, branch, store, head):
102
103
                    self._file_transport.mkdir(subpath)
103
104
                    trees.append((subpath, self.store[sha]))
104
105
                elif stat.S_ISREG(mode):
105
 
                    self._file_transport.put_bytes(subpath, self.store[sha].data)
 
106
                    self._file_transport.put_bytes(
 
107
                        subpath, self.store[sha].data)
106
108
                    self._index_add_entry(subpath, 'file')
107
109
                else:
108
110
                    raise NotImplementedError(self._populate_from_branch)
119
121
                self._lock_mode = "r"
120
122
                self._populate_from_branch()
121
123
            return lock.LogicalLockResult(self.unlock)
122
 
        except:
 
124
        except BaseException:
123
125
            self._locks -= 1
124
126
            raise
125
127
 
133
135
                self._populate_from_branch()
134
136
            elif self._lock_mode == "r":
135
137
                raise errors.ReadOnlyError(self)
136
 
        except:
 
138
        except BaseException:
137
139
            self._locks -= 1
138
140
            raise
139
141
        return lock.LogicalLockResult(self.unlock)
149
151
            elif self._lock_mode == "r":
150
152
                raise errors.ReadOnlyError(self)
151
153
            return lock.LogicalLockResult(self.unlock)
152
 
        except:
 
154
        except BaseException:
153
155
            self._locks -= 1
154
156
            raise
155
157
 
182
184
        if stat.S_ISDIR(stat_val.st_mode):
183
185
            return None
184
186
        elif stat.S_ISLNK(stat_val.st_mode):
185
 
            blob = Blob.from_string(self._file_transport.readlink(path).encode('utf-8'))
 
187
            blob = Blob.from_string(
 
188
                self._file_transport.readlink(path).encode('utf-8'))
186
189
        elif stat.S_ISREG(stat_val.st_mode):
187
190
            blob = Blob.from_string(self._file_transport.get_bytes(path))
188
191
        else:
215
218
        with self.lock_read():
216
219
            if self.branch.head is None:
217
220
                return _mod_revision.NULL_REVISION
218
 
            return self.branch.repository.lookup_foreign_revision_id(self.branch.head)
 
221
            return self.branch.repository.lookup_foreign_revision_id(
 
222
                self.branch.head)
219
223
 
220
224
    def basis_tree(self):
221
225
        """See Tree.basis_tree()."""
240
244
            self.branch.head = None
241
245
        else:
242
246
            self._parent_ids = parent_ids
243
 
            self.branch.head = self.branch.repository.lookup_bzr_revision_id(parent_ids[0])[0]
 
247
            self.branch.head = self.branch.repository.lookup_bzr_revision_id(
 
248
                parent_ids[0])[0]
244
249
 
245
250
    def mkdir(self, path, file_id=None):
246
251
        """See MutableTree.mkdir()."""