make sure not to reuse an existing append-file from a previous failed pull
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 14 Mar 2008 21:35:49 +0100
changeset 6259 d60aa0308b02
parent 6244 b36774d0fce1
child 6260 f295206ae1f9
make sure not to reuse an existing append-file from a previous failed pull
mercurial/changelog.py
--- a/mercurial/changelog.py	Thu Mar 13 17:39:30 2008 +0100
+++ b/mercurial/changelog.py	Fri Mar 14 21:35:49 2008 +0100
@@ -108,6 +108,9 @@
         # if we're doing an initial clone, divert to another file
         if self._delaycount == 0:
             self._delayname = fp.name
+            if not self.count():
+                # make sure to truncate the file
+                mode = mode.replace('a', 'w')
             return self._realopener(name + ".a", mode)
         # otherwise, divert to memory
         return appender(fp, self._delaybuf)