Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/streamclone.py @ 32299:076f1ff43f0f
clone: warn when streaming was requested but couldn't be performed
This helps both users and the people who support them figure out why
a stream clone couldn't be performed.
In an upcoming patch we're going to add a way for servers to hard
abort on a full getbundle. In those cases servers might expect
clients to perform a stream clone, so it's important to communicate
why one couldn't be done.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Mon, 08 May 2017 20:01:06 -0700 |
parents | 22fbca1d11ed |
children | 33b7283a3828 |
comparison
equal
deleted
inserted
replaced
32298:9c60d93fd3ab | 32299:076f1ff43f0f |
---|---|
78 requirements.add('revlogv1') | 78 requirements.add('revlogv1') |
79 else: | 79 else: |
80 streamreqs = remote.capable('streamreqs') | 80 streamreqs = remote.capable('streamreqs') |
81 # This is weird and shouldn't happen with modern servers. | 81 # This is weird and shouldn't happen with modern servers. |
82 if not streamreqs: | 82 if not streamreqs: |
83 pullop.repo.ui.warn(_( | |
84 'warning: stream clone requested but server has them ' | |
85 'disabled\n')) | |
83 return False, None | 86 return False, None |
84 | 87 |
85 streamreqs = set(streamreqs.split(',')) | 88 streamreqs = set(streamreqs.split(',')) |
86 # Server requires something we don't support. Bail. | 89 # Server requires something we don't support. Bail. |
87 if streamreqs - repo.supportedformats: | 90 missingreqs = streamreqs - repo.supportedformats |
91 if missingreqs: | |
92 pullop.repo.ui.warn(_( | |
93 'warning: stream clone requested but client is missing ' | |
94 'requirements: %s\n') % ', '.join(sorted(missingreqs))) | |
95 pullop.repo.ui.warn( | |
96 _('(see https://www.mercurial-scm.org/wiki/MissingRequirement ' | |
97 'for more information)\n')) | |
88 return False, None | 98 return False, None |
89 requirements = streamreqs | 99 requirements = streamreqs |
90 | 100 |
91 return True, requirements | 101 return True, requirements |
92 | 102 |