--- a/mercurial/dirstate.py Fri Jun 08 05:31:28 2012 +0300
+++ b/mercurial/dirstate.py Wed May 30 12:55:33 2012 -0700
@@ -498,12 +498,24 @@
return
st = self._opener("dirstate", "w", atomictemp=True)
+ def finish(s):
+ st.write(s)
+ st.close()
+ self._lastnormaltime = 0
+ self._dirty = self._dirtypl = False
+
# use the modification time of the newly created temporary file as the
# filesystem's notion of 'now'
- now = int(util.fstat(st).st_mtime)
+ now = util.fstat(st).st_mtime
+ copymap = self._copymap
+ try:
+ finish(parsers.pack_dirstate(self._map, copymap, self._pl, now))
+ return
+ except AttributeError:
+ pass
+ now = int(now)
cs = cStringIO.StringIO()
- copymap = self._copymap
pack = struct.pack
write = cs.write
write("".join(self._pl))
@@ -526,10 +538,7 @@
e = pack(_format, e[0], e[1], e[2], e[3], len(f))
write(e)
write(f)
- st.write(cs.getvalue())
- st.close()
- self._lastnormaltime = 0
- self._dirty = self._dirtypl = False
+ finish(cs.getvalue())
def _dirignore(self, f):
if f == '.':