mercurial/repair.py
changeset 45871 a985c4fb23ca
parent 45869 63edc384d3b7
child 45872 ec73a6a75985
equal deleted inserted replaced
45870:a6f08085edfe 45871:a985c4fb23ca
   207             with repo.transaction(b"strip") as tr:
   207             with repo.transaction(b"strip") as tr:
   208                 # TODO this code violates the interface abstraction of the
   208                 # TODO this code violates the interface abstraction of the
   209                 # transaction and makes assumptions that file storage is
   209                 # transaction and makes assumptions that file storage is
   210                 # using append-only files. We'll need some kind of storage
   210                 # using append-only files. We'll need some kind of storage
   211                 # API to handle stripping for us.
   211                 # API to handle stripping for us.
   212                 offset = len(tr._entries)
   212                 oldfiles = set(tr._offsetmap.keys())
   213 
   213 
   214                 tr.startgroup()
   214                 tr.startgroup()
   215                 cl.strip(striprev, tr)
   215                 cl.strip(striprev, tr)
   216                 stripmanifest(repo, striprev, tr, files)
   216                 stripmanifest(repo, striprev, tr, files)
   217 
   217 
   218                 for fn in files:
   218                 for fn in files:
   219                     repo.file(fn).strip(striprev, tr)
   219                     repo.file(fn).strip(striprev, tr)
   220                 tr.endgroup()
   220                 tr.endgroup()
   221 
   221 
   222                 for i in pycompat.xrange(offset, len(tr._entries)):
   222                 entries = tr.readjournal()
   223                     file, troffset = tr._entries[i]
   223 
       
   224                 for file, troffset in entries:
       
   225                     if file in oldfiles:
       
   226                         continue
   224                     with repo.svfs(file, b'a', checkambig=True) as fp:
   227                     with repo.svfs(file, b'a', checkambig=True) as fp:
   225                         fp.truncate(troffset)
   228                         fp.truncate(troffset)
   226                     if troffset == 0:
   229                     if troffset == 0:
   227                         repo.store.markremoved(file)
   230                         repo.store.markremoved(file)
   228 
   231