[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 04:20:45 CDT 2010


On Tue, Aug 31, 2010 at 11:09:57AM +0200, Sune Foldager wrote:
> On 31-08-2010 10:52, Benoit Boissinot wrote:
> >On Mon, Aug 30, 2010 at 06:21:40PM +0200, Sune Foldager wrote:
> >>@@ -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?
> 
> Can't the remote repository be a localrepo-instance? Then I think it
> will be needed, no?

a localrepo instance doesn't support stream_out(), so no.
> 
> >(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...)
> 
> Does this mean that you, refering to my point 4, think we should
> join the two capabilities?

yes, I don't really see any other use currently.
> 
> >>-        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.
> 
> Yes, we will probably need to rewrite requirements in this case, and
> rewrite store-opener-options as well....

Or put the stream stuff as a new branch in hg.py (where clone already
chooses between cp -al, cp -r and localrepo.clone())

> maybe. Does the parentdelta
> store option force parentdelta-interpretation; isn't there a revlog
> flag for it?

Sorry, for what?
> 
> >>--- 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.
> 
> How should the server know if the repo is compatible? It should
> check requirements against a hard-coded set of "old supported
> stuff". Is that worth it? Won't people always be using the new
> formats with new hg init's?

if the building of the requirements is already in wireproto, it's not
really harder to do:

requiredformats = repo.supportedformats & repo.requirements
if not requiredformats - set(['revlogv1']):
   caps.append('stream')
else:
   caps.append('streamreqs=%s' % ','.join(requiredformats))

-- 
:wq


More information about the Mercurial-devel mailing list