mercurial/repair.py
changeset 39686 3d22aef3ecd5
parent 39244 73cf21b2e8a6
child 39745 b2ec79559a4b
equal deleted inserted replaced
39685:4024c363cd33 39686:3d22aef3ecd5
   188                                      compress=False, obsolescence=False)
   188                                      compress=False, obsolescence=False)
   189 
   189 
   190     with ui.uninterruptable():
   190     with ui.uninterruptable():
   191         try:
   191         try:
   192             with repo.transaction("strip") as tr:
   192             with repo.transaction("strip") as tr:
   193                 offset = len(tr.entries)
   193                 # TODO this code violates the interface abstraction of the
       
   194                 # transaction and makes assumptions that file storage is
       
   195                 # using append-only files. We'll need some kind of storage
       
   196                 # API to handle stripping for us.
       
   197                 offset = len(tr._entries)
   194 
   198 
   195                 tr.startgroup()
   199                 tr.startgroup()
   196                 cl.strip(striprev, tr)
   200                 cl.strip(striprev, tr)
   197                 stripmanifest(repo, striprev, tr, files)
   201                 stripmanifest(repo, striprev, tr, files)
   198 
   202 
   199                 for fn in files:
   203                 for fn in files:
   200                     repo.file(fn).strip(striprev, tr)
   204                     repo.file(fn).strip(striprev, tr)
   201                 tr.endgroup()
   205                 tr.endgroup()
   202 
   206 
   203                 for i in pycompat.xrange(offset, len(tr.entries)):
   207                 for i in pycompat.xrange(offset, len(tr._entries)):
   204                     file, troffset, ignore = tr.entries[i]
   208                     file, troffset, ignore = tr._entries[i]
   205                     with repo.svfs(file, 'a', checkambig=True) as fp:
   209                     with repo.svfs(file, 'a', checkambig=True) as fp:
   206                         fp.truncate(troffset)
   210                         fp.truncate(troffset)
   207                     if troffset == 0:
   211                     if troffset == 0:
   208                         repo.store.markremoved(file)
   212                         repo.store.markremoved(file)
   209 
   213