mercurial/transaction.py
changeset 42963 8502f76dbfd7
parent 41365 876494fd967d
child 43050 a614f26d4897
equal deleted inserted replaced
42962:d6227c6c0814 42963:8502f76dbfd7
    52     for f, o, _ignore in entries:
    52     for f, o, _ignore in entries:
    53         if o or not unlink:
    53         if o or not unlink:
    54             checkambig = checkambigfiles and (f, '') in checkambigfiles
    54             checkambig = checkambigfiles and (f, '') in checkambigfiles
    55             try:
    55             try:
    56                 fp = opener(f, 'a', checkambig=checkambig)
    56                 fp = opener(f, 'a', checkambig=checkambig)
       
    57                 if fp.tell() < o:
       
    58                     raise error.Abort(_(
       
    59                             "attempted to truncate %s to %d bytes, but it was "
       
    60                             "already %d bytes\n") % (f, o, fp.tell()))
    57                 fp.truncate(o)
    61                 fp.truncate(o)
    58                 fp.close()
    62                 fp.close()
    59             except IOError:
    63             except IOError:
    60                 report(_("failed to truncate %s\n") % f)
    64                 report(_("failed to truncate %s\n") % f)
    61                 raise
    65                 raise