comparison mercurial/transaction.py @ 6441:c9b8f2820bc0

rollback: unlink files truncated to length 0
author Brendan Cully <brendan@kublai.com>
date Mon, 31 Mar 2008 23:02:25 -0700
parents 53ed9b40cfc4
children 618140c75d8d
comparison
equal deleted inserted replaced
6437:101526031d06 6441:c9b8f2820bc0
94 94
95 def rollback(opener, file): 95 def rollback(opener, file):
96 files = {} 96 files = {}
97 for l in open(file).readlines(): 97 for l in open(file).readlines():
98 f, o = l.split('\0') 98 f, o = l.split('\0')
99 files[f] = o 99 files[f] = int(o)
100 for f in files: 100 for f in files:
101 o = files[f] 101 o = files[f]
102 opener(f, "a").truncate(int(o)) 102 if o:
103 opener(f, "a").truncate(int(o))
104 else:
105 fn = opener(f).name
106 os.unlink(fn)
103 os.unlink(file) 107 os.unlink(file)
104 108