Mercurial > hg
comparison mercurial/streamclone.py @ 26447:591088f7028a
streamclone: add explicit check for empty local repo
Stream clone doesn't work with non-empty local repositories. In upcoming
patches, we'll move stream cloning to the regular pull code path. Add an
explicit check on the repository being empty to prevent streaming clones
to non-empty repos.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 02 Oct 2015 21:53:25 -0700 |
parents | 3ea10bb761ce |
children | 362793295640 |
comparison
equal
deleted
inserted
replaced
26446:3ea10bb761ce | 26447:591088f7028a |
---|---|
23 Returns a tuple of (supported, requirements). ``supported`` is True if | 23 Returns a tuple of (supported, requirements). ``supported`` is True if |
24 streaming clone is supported and False otherwise. ``requirements`` is | 24 streaming clone is supported and False otherwise. ``requirements`` is |
25 a set of repo requirements from the remote, or ``None`` if stream clone | 25 a set of repo requirements from the remote, or ``None`` if stream clone |
26 isn't supported. | 26 isn't supported. |
27 """ | 27 """ |
28 # Streaming clone only works on empty repositories. | |
29 if len(repo): | |
30 return False, None | |
31 | |
28 # Streaming clone only works if all data is being requested. | 32 # Streaming clone only works if all data is being requested. |
29 if heads: | 33 if heads: |
30 return False, None | 34 return False, None |
31 | 35 |
32 # If we don't have a preference, let the server decide for us. This | 36 # If we don't have a preference, let the server decide for us. This |