[PATCH 3 of 5 modernize-streamclone] streamclone: add explicit check for empty local repo
Gregory Szorc
gregory.szorc at gmail.com
Sat Oct 3 00:55:55 CDT 2015
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1443848005 25200
# Fri Oct 02 21:53:25 2015 -0700
# Node ID c12c6134a77f0afd2c48a3a0642199a6667a28a4
# Parent 3b07d689eb21b1bae0baa38fa708fd339f3521af
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.
diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -24,8 +24,12 @@ def canperformstreamclone(repo, remote,
streaming clone is supported and False otherwise. ``requirements`` is
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
More information about the Mercurial-devel
mailing list