~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: John Arbash Meinel
  • Date: 2011-01-12 20:31:15 UTC
  • mto: This revision was merged to the branch mainline in revision 5603.
  • Revision ID: john@arbash-meinel.com-20110112203115-w55rhrojc21qs8tk
Fix breaking corrupt lock files on Windows.

We were using transport.get() && transport.delete(), without closing the file.
Switch to using transport.get_bytes(), which closes the file properly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 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
430
430
        # there's a small race window between checking it and doing the
431
431
        # rename.
432
432
        broken_info_path = tmpname + self.__INFO_NAME
433
 
        f = self.transport.get(broken_info_path)
434
 
        broken_lines = f.readlines()
 
433
        broken_content = self.transport.get_bytes(broken_info_path)
 
434
        broken_lines = osutils.split_lines(broken_content)
435
435
        if broken_lines != corrupt_info_lines:
436
436
            raise LockBreakMismatch(self, broken_lines, corrupt_info_lines)
437
437
        self.transport.delete(broken_info_path)