mercurial/streamclone.py
changeset 39757 97f2992c26f6
parent 39700 b10d145837bc
child 39850 d89d5bc06eaa
equal deleted inserted replaced
39756:4a8bfec90ae6 39757:97f2992c26f6
     8 from __future__ import absolute_import
     8 from __future__ import absolute_import
     9 
     9 
    10 import contextlib
    10 import contextlib
    11 import os
    11 import os
    12 import struct
    12 import struct
    13 import warnings
       
    14 
    13 
    15 from .i18n import _
    14 from .i18n import _
    16 from . import (
    15 from . import (
    17     branchmap,
    16     branchmap,
    18     cacheutil,
    17     cacheutil,
   566 
   565 
   567     return len(entries), totalfilesize, chunks
   566     return len(entries), totalfilesize, chunks
   568 
   567 
   569 @contextlib.contextmanager
   568 @contextlib.contextmanager
   570 def nested(*ctxs):
   569 def nested(*ctxs):
   571     with warnings.catch_warnings():
   570     this = ctxs[0]
   572         # For some reason, Python decided 'nested' was deprecated without
   571     rest = ctxs[1:]
   573         # replacement. They officially advertised for filtering the deprecation
   572     with this:
   574         # warning for people who actually need the feature.
   573         if rest:
   575         warnings.filterwarnings("ignore",category=DeprecationWarning)
   574             with nested(*rest):
   576         with contextlib.nested(*ctxs):
   575                 yield
       
   576         else:
   577             yield
   577             yield
   578 
   578 
   579 def consumev2(repo, fp, filecount, filesize):
   579 def consumev2(repo, fp, filecount, filesize):
   580     """Apply the contents from a version 2 streaming clone.
   580     """Apply the contents from a version 2 streaming clone.
   581 
   581