/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 bzrlib/remote.py

  • Committer: Aaron Bentley
  • Date: 2007-08-15 16:05:13 UTC
  • mfrom: (2703 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2709.
  • Revision ID: abentley@panoramicfeedback.com-20070815160513-aepyrd0uu9vtedsy
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
249
249
        self._lock_count = 0
250
250
        self._leave_lock = False
251
251
 
 
252
    def abort_write_group(self):
 
253
        """Complete a write group on the decorated repository.
 
254
        
 
255
        Smart methods peform operations in a single step so this api
 
256
        is not really applicable except as a compatibility thunk
 
257
        for older plugins that don't use e.g. the CommitBuilder
 
258
        facility.
 
259
        """
 
260
        self._ensure_real()
 
261
        return self._real_repository.abort_write_group()
 
262
 
 
263
    def commit_write_group(self):
 
264
        """Complete a write group on the decorated repository.
 
265
        
 
266
        Smart methods peform operations in a single step so this api
 
267
        is not really applicable except as a compatibility thunk
 
268
        for older plugins that don't use e.g. the CommitBuilder
 
269
        facility.
 
270
        """
 
271
        self._ensure_real()
 
272
        return self._real_repository.commit_write_group()
 
273
 
252
274
    def _ensure_real(self):
253
275
        """Ensure that there is a _real_repository set.
254
276
 
299
321
        assert response[0] in ('yes', 'no'), 'unexpected response code %s' % (response,)
300
322
        return response[0] == 'yes'
301
323
 
 
324
    def has_same_location(self, other):
 
325
        return (self.__class__ == other.__class__ and
 
326
                self.bzrdir.transport.base == other.bzrdir.transport.base)
 
327
        
302
328
    def get_graph(self, other_repository=None):
303
329
        """Return the graph for this repository format"""
304
330
        return self._real_repository.get_graph(other_repository)
337
363
        """See Repository.get_physical_lock_status()."""
338
364
        return False
339
365
 
 
366
    def is_in_write_group(self):
 
367
        """Return True if there is an open write group.
 
368
 
 
369
        write groups are only applicable locally for the smart server..
 
370
        """
 
371
        if self._real_repository:
 
372
            return self._real_repository.is_in_write_group()
 
373
 
 
374
    def is_locked(self):
 
375
        return self._lock_count >= 1
 
376
 
340
377
    def is_shared(self):
341
378
        """See Repository.is_shared()."""
342
379
        path = self.bzrdir._path_for_remote_call(self._client)
408
445
        elif self._lock_mode == 'r':
409
446
            self._real_repository.lock_read()
410
447
 
 
448
    def start_write_group(self):
 
449
        """Start a write group on the decorated repository.
 
450
        
 
451
        Smart methods peform operations in a single step so this api
 
452
        is not really applicable except as a compatibility thunk
 
453
        for older plugins that don't use e.g. the CommitBuilder
 
454
        facility.
 
455
        """
 
456
        self._ensure_real()
 
457
        return self._real_repository.start_write_group()
 
458
 
411
459
    def _unlock(self, token):
412
460
        path = self.bzrdir._path_for_remote_call(self._client)
413
461
        response = self._client.call('Repository.unlock', path, token)
419
467
            raise errors.UnexpectedSmartServerResponse(response)
420
468
 
421
469
    def unlock(self):
 
470
        if self._lock_count == 1 and self._lock_mode == 'w':
 
471
            # don't unlock if inside a write group.
 
472
            if self.is_in_write_group():
 
473
                raise errors.BzrError(
 
474
                    'Must end write groups before releasing write locks.')
422
475
        self._lock_count -= 1
423
476
        if not self._lock_count:
424
477
            mode = self._lock_mode