mercurial/streamclone.py
changeset 50519 58e4842fbfc1
parent 50518 f697af015683
child 50520 a6543983b8f4
equal deleted inserted replaced
50518:f697af015683 50519:58e4842fbfc1
    67     isn't supported.
    67     isn't supported.
    68     """
    68     """
    69     repo = pullop.repo
    69     repo = pullop.repo
    70     remote = pullop.remote
    70     remote = pullop.remote
    71 
    71 
       
    72     # should we consider streaming clone at all ?
       
    73     streamrequested = pullop.streamclonerequested
       
    74     # If we don't have a preference, let the server decide for us. This
       
    75     # likely only comes into play in LANs.
       
    76     if streamrequested is None:
       
    77         # The server can advertise whether to prefer streaming clone.
       
    78         streamrequested = remote.capable(b'stream-preferred')
       
    79     if not streamrequested:
       
    80         return False, None
       
    81 
    72     # Streaming clone only works on an empty destination repository
    82     # Streaming clone only works on an empty destination repository
    73     if len(repo):
    83     if len(repo):
    74         return False, None
    84         return False, None
    75 
    85 
    76     # Streaming clone only works if all data is being requested.
    86     # Streaming clone only works if all data is being requested.
    88     # Ensures legacy code path uses available bundle2.
    98     # Ensures legacy code path uses available bundle2.
    89     if bundle2supported and not bundle2:
    99     if bundle2supported and not bundle2:
    90         return False, None
   100         return False, None
    91     # Ensures bundle2 doesn't try to do a stream clone if it isn't supported.
   101     # Ensures bundle2 doesn't try to do a stream clone if it isn't supported.
    92     elif bundle2 and not bundle2supported:
   102     elif bundle2 and not bundle2supported:
    93         return False, None
       
    94 
       
    95     streamrequested = pullop.streamclonerequested
       
    96 
       
    97     # If we don't have a preference, let the server decide for us. This
       
    98     # likely only comes into play in LANs.
       
    99     if streamrequested is None:
       
   100         # The server can advertise whether to prefer streaming clone.
       
   101         streamrequested = remote.capable(b'stream-preferred')
       
   102 
       
   103     if not streamrequested:
       
   104         return False, None
   103         return False, None
   105 
   104 
   106     # In order for stream clone to work, the client has to support all the
   105     # In order for stream clone to work, the client has to support all the
   107     # requirements advertised by the server.
   106     # requirements advertised by the server.
   108     #
   107     #