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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-14 00:01:32 UTC
  • mfrom: (4957.1.1 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100114000132-3p3rabnonjw3gzqb
(jam) Merge bzr.stable, bringing in bug fixes #175839, #504390

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
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
110
110
    debug,
111
111
    errors,
112
112
    lock,
 
113
    osutils,
113
114
    )
114
115
import bzrlib.config
 
116
from bzrlib.decorators import only_raises
115
117
from bzrlib.errors import (
116
118
        DirectoryNotEmpty,
117
119
        FileExists,
294
296
                                            info_bytes)
295
297
        return tmpname
296
298
 
 
299
    @only_raises(LockNotHeld, LockBroken)
297
300
    def unlock(self):
298
301
        """Release a held lock
299
302
        """
422
425
 
423
426
        peek() reads the info file of the lock holder, if any.
424
427
        """
425
 
        return self._parse_info(self.transport.get(path))
 
428
        return self._parse_info(self.transport.get_bytes(path))
426
429
 
427
430
    def peek(self):
428
431
        """Check if the lock is held by anyone.
455
458
                   )
456
459
        return s.to_string()
457
460
 
458
 
    def _parse_info(self, info_file):
459
 
        return rio.read_stanza(info_file.readlines()).as_dict()
 
461
    def _parse_info(self, info_bytes):
 
462
        # TODO: Handle if info_bytes is empty
 
463
        return rio.read_stanza(osutils.split_lines(info_bytes)).as_dict()
460
464
 
461
465
    def attempt_lock(self):
462
466
        """Take the lock; fail if it's already held.