rollback: unlink files truncated to length 0
authorBrendan Cully <brendan@kublai.com>
Mon, 31 Mar 2008 23:02:25 -0700
changeset 6441 c9b8f2820bc0
parent 6437 101526031d06
child 6442 fa5454a451c6
rollback: unlink files truncated to length 0
mercurial/transaction.py
--- a/mercurial/transaction.py	Mon Mar 31 23:14:25 2008 -0500
+++ b/mercurial/transaction.py	Mon Mar 31 23:02:25 2008 -0700
@@ -96,9 +96,13 @@
     files = {}
     for l in open(file).readlines():
         f, o = l.split('\0')
-        files[f] = o
+        files[f] = int(o)
     for f in files:
         o = files[f]
-        opener(f, "a").truncate(int(o))
+        if o:
+            opener(f, "a").truncate(int(o))
+        else:
+            fn = opener(f).name
+            os.unlink(fn)
     os.unlink(file)