mercurial/changelog.py
changeset 6259 d60aa0308b02
parent 6212 e75aab656f46
child 6750 fb42030d79d6
child 7035 9d023ef7b467
--- 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)