~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/atomicfile.py

  • Committer: Andrew Bennetts
  • Date: 2007-03-26 06:24:01 UTC
  • mto: This revision was merged to the branch mainline in revision 2376.
  • Revision ID: andrew.bennetts@canonical.com-20070326062401-k3nbefzje5332jaf
Deal with review comments from Robert:

  * Add my name to the NEWS file
  * Move the test case to a new module in branch_implementations
  * Remove revision_history cruft from identitymap and test_identitymap
  * Improve some docstrings

Also, this fixes a bug where revision_history was not returning a copy of the
cached data, allowing the cache to be corrupted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        global _hostname
52
52
 
53
53
        self._fd = None
 
54
        assert mode in ('wb', 'wt'), \
 
55
            "invalid AtomicFile mode %r" % mode
54
56
 
55
57
        if _hostname is None:
56
58
            _hostname = socket.gethostname()
62
64
        flags = os.O_EXCL | os.O_CREAT | os.O_WRONLY
63
65
        if mode == 'wb':
64
66
            flags |= osutils.O_BINARY
65
 
        elif mode != 'wt':
66
 
            raise ValueError("invalid AtomicFile mode %r" % mode)
67
67
 
68
68
        if new_mode is not None:
69
69
            local_mode = new_mode