[PATCH 1 of 1] clone: only use stream when we understand the revlog format
Benoit Boissinot
benoit.boissinot at ens-lyon.org
Tue Aug 31 03:52:02 CDT 2010
On Mon, Aug 30, 2010 at 06:21:40PM +0200, Sune Foldager wrote:
> # HG changeset patch
> # User Sune Foldager <cryo at cyanite.org>
> # Date 1283183902 -7200
> # Node ID 4b312421249ac4829f1d480c3611b3d18c6f2000
> # Parent 6f833fc3ccabd204173bee24ed725269d8475932
> clone: only use stream when we understand the revlog format
>
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -21,7 +21,8 @@
>
> class localrepository(repo.repository):
> capabilities = set(('lookup', 'changegroupsubset', 'branchmap', 'pushkey'))
> - supported = set('revlogv1 store fncache shared parentdelta'.split())
> + localsupported = set(('store', 'fncache', 'shared'))
not of fan of the variable name, might be better to do it the other way
round:
supportedformats = set(('revlogv1', 'parentdelta'))
supported = supportedformats | ...
> + supported = set(('revlogv1', 'parentdelta')) | localsupported
>
> def __init__(self, baseui, path=None, create=0):
> repo.repository.__init__(self)
> @@ -95,6 +96,8 @@
> self.sopener.options = {}
> if 'parentdelta' in requirements:
> self.sopener.options['parentdelta'] = 1
> + reqs = ','.join(r for r in requirements if r not in self.localsupported)
> + self.capabilities.add('requires=' + reqs)
is that needed? shouldn't that go only in wireproto.py?
(and streamcaps=... might be a better capability name, like the original
stream= but we add more useful information and this time we make sure
the clients checks it...)
>
> # These two define the set of tags for this repository. _tags
> # maps tag name to node; _tagtypes maps tag name to 'global' or
> @@ -1780,8 +1783,12 @@
> # and format flags on "stream" capability, and use
> # uncompressed only if compatible.
>
> - if stream and not heads and remote.capable('stream'):
> - return self.stream_in(remote)
> + if stream and not heads and remote.capable('stream2'):
> + reqs = remote.capable('requires')
> + if reqs:
> + reqs = set(reqs.split(','))
> + if not reqs - self.supported:
> + return self.stream_in(remote)
We still have a problem with the code flow, when we hit
localrepo.clone() we already wrote the requirements while they can
depend on the remote repo.
> return self.pull(remote, heads)
>
> def pushkey(self, namespace, key, old, new):
> diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
> --- a/mercurial/wireproto.py
> +++ b/mercurial/wireproto.py
> @@ -172,8 +172,11 @@
> def capabilities(repo, proto):
> caps = 'lookup changegroupsubset branchmap pushkey'.split()
> if _allowstream(repo.ui):
> - caps.append('stream=%d' % repo.changelog.version)
> + caps.append('stream2')
> caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority))
> + reqs = repo.capable('requires')
> + if reqs:
> + caps.append('requires=%s' % reqs)
> return ' '.join(caps)
We should keep stream if the repo is compatible.
--
:wq
More information about the Mercurial-devel
mailing list