Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/dirstate.py @ 4330:1b9fc3f48861
use atomictemp files to write the dirstate
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Mon, 09 Apr 2007 04:24:17 -0300 |
parents | c93562fb12cc |
children | 1cc5fc1d0994 2d32e3ae01a7 |
comparison
equal
deleted
inserted
replaced
4329:cea5ba038a1d | 4330:1b9fc3f48861 |
---|---|
313 self.markdirty() | 313 self.markdirty() |
314 | 314 |
315 def write(self): | 315 def write(self): |
316 if not self.dirty: | 316 if not self.dirty: |
317 return | 317 return |
318 st = self.opener("dirstate", "w", atomic=True) | 318 st = self.opener("dirstate", "w", atomictemp=True) |
319 st.write("".join(self.pl)) | 319 st.write("".join(self.pl)) |
320 for f, e in self.map.items(): | 320 for f, e in self.map.items(): |
321 c = self.copied(f) | 321 c = self.copied(f) |
322 if c: | 322 if c: |
323 f = f + "\0" + c | 323 f = f + "\0" + c |
324 e = struct.pack(self.format, e[0], e[1], e[2], e[3], len(f)) | 324 e = struct.pack(self.format, e[0], e[1], e[2], e[3], len(f)) |
325 st.write(e + f) | 325 st.write(e + f) |
326 st.rename() | |
326 self.dirty = 0 | 327 self.dirty = 0 |
327 | 328 |
328 def filterfiles(self, files): | 329 def filterfiles(self, files): |
329 ret = {} | 330 ret = {} |
330 unknown = [] | 331 unknown = [] |