changeset 6259:d60aa0308b02

make sure not to reuse an existing append-file from a previous failed pull
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 14 Mar 2008 21:35:49 +0100
parents b36774d0fce1
children f295206ae1f9
files mercurial/changelog.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)