~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lockdir.py

  • Committer: Martin Pool
  • Date: 2006-05-05 00:55:41 UTC
  • mto: This revision was merged to the branch mainline in revision 1699.
  • Revision ID: mbp@sourcefrog.net-20060505005541-7ad07e37a4508ea8
Create lockdir info files using transport.append

Show diffs side-by-side

added added

removed removed

Lines of Context:
123
123
# lock at the same time they should *both* get it.  But then that's unlikely
124
124
# to be a good idea.
125
125
 
126
 
# TODO: Transport could offer a simpler put() method that avoids the
127
 
# rename-into-place for cases like creating the lock template, where there is
128
 
# no chance that the file already exists.
129
 
 
130
126
# TODO: Perhaps store some kind of note like the bzr command line in the lock
131
127
# info?
132
128
 
199
195
            sio = StringIO()
200
196
            self._prepare_info(sio)
201
197
            sio.seek(0)
202
 
            self.transport.put(tmpname + self.__INFO_NAME, sio)
 
198
            # append will create a new file; we use append rather than put
 
199
            # because we don't want to write to a temporary file and rename
 
200
            # into place, because that's going to happen to the whole
 
201
            # directory
 
202
            self.transport.append(tmpname + self.__INFO_NAME, sio)
203
203
            self.transport.rename(tmpname, self._held_dir)
204
204
            self._lock_held = True
205
205
            self.confirm()