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

  • Committer: Jelmer Vernooij
  • Date: 2018-03-08 01:08:54 UTC
  • mto: (0.200.1831 work)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@jelmer.uk-20180308010854-hsj46y62wyzfdgjh
Improve transaction and write group handling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
        else:
157
157
            self._lock_mode = 'w'
158
158
            self._lock_count = 1
 
159
            self._transaction = transactions.WriteTransaction()
159
160
        return repository.RepositoryWriteLockResult(self.unlock, None)
160
161
 
161
162
    def break_lock(self):
174
175
        else:
175
176
            self._lock_mode = 'r'
176
177
            self._lock_count = 1
 
178
            self._transaction = transactions.ReadOnlyTransaction()
177
179
        return lock.LogicalLockResult(self.unlock)
178
180
 
179
181
    @only_raises(errors.LockNotHeld, errors.LockBroken)
190
192
        self._lock_count -= 1
191
193
        if self._lock_count == 0:
192
194
            self._lock_mode = None
 
195
            transaction = self._transaction
 
196
            self._transaction = None
 
197
            transaction.finish()
193
198
 
194
199
    def is_write_locked(self):
195
200
        return (self._lock_mode == 'w')
199
204
 
200
205
    def get_transaction(self):
201
206
        """See Repository.get_transaction()."""
202
 
        if self._write_group is None:
 
207
        if self._transaction is None:
203
208
            return transactions.PassThroughTransaction()
204
209
        else:
205
 
            return self._write_group
 
210
            return self._transaction
206
211
 
207
212
    def reconcile(self, other=None, thorough=False):
208
213
        """Reconcile this repository."""
236
241
        GitRepository.__init__(self, gitdir)
237
242
        self._git = gitdir._git
238
243
        self._file_change_scanner = GitFileLastChangeScanner(self)
 
244
        self._transaction = None
239
245
 
240
246
    def get_commit_builder(self, branch, parents, config, timestamp=None,
241
247
                           timezone=None, committer=None, revprops=None,