changeset 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 e05fd574c922
files mercurial/streamclone.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/streamclone.py	Fri Oct 02 22:22:11 2015 -0700
+++ b/mercurial/streamclone.py	Fri Oct 02 21:53:25 2015 -0700
@@ -25,6 +25,10 @@
     a set of repo requirements from the remote, or ``None`` if stream clone
     isn't supported.
     """
+    # Streaming clone only works on empty repositories.
+    if len(repo):
+        return False, None
+
     # Streaming clone only works if all data is being requested.
     if heads:
         return False, None